AvatarUtil.cs 537 B

12345678910111213141516171819202122232425
  1. using System;
  2. using UnityEngine;
  3. using UnityEngine.UI;
  4. namespace UI.Hall
  5. {
  6. public class AvatarUtil
  7. {
  8. public static void DisplayAvatar(Image image, string avatarIdString)
  9. {
  10. var avatarId = 1;
  11. try
  12. {
  13. avatarId = int.Parse(avatarIdString);
  14. }
  15. catch (Exception e)
  16. {
  17. }
  18. var s = Resources.Load<Sprite>("Image/Avatar/" + avatarId.ToString("D3"));
  19. image.sprite = s;
  20. }
  21. }
  22. }