UserInfoComp.cs 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. using System;
  2. using Api;
  3. using Plugins.CxShine.Singleton;
  4. using UnityEngine.UI;
  5. namespace UI.Hall
  6. {
  7. public class UserInfoComp : UnitySingleton<UserInfoComp>
  8. {
  9. public Text Diamond;
  10. public Text NickName;
  11. public Text UserId;
  12. public Image Avatar;
  13. private void Start()
  14. {
  15. RefreshSelfUI();
  16. }
  17. public void RefreshSelfUI()
  18. {
  19. AccountManager.Instance.requestSelfInfo(data =>
  20. {
  21. NickName.text = AccountManager.Instance.selfInfo.name + "";
  22. UserId.text = "ID:" + AccountManager.Instance.selfInfo.playerId + "";
  23. if (Diamond != null)
  24. {
  25. Diamond.text = "" + AccountManager.Instance.selfInfo.diamond + "";
  26. }
  27. AvatarUtil.DisplayAvatar(Avatar, AccountManager.Instance.selfInfo.avatar);
  28. },((i, s) =>
  29. {
  30. }));
  31. }
  32. }
  33. }