OtherRoleInfoView.cs 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. using ET;
  2. using FairyGUI;
  3. using UI.CommonGame;
  4. using UI.RoleInfo;
  5. namespace GFGGame
  6. {
  7. public class OtherRoleInfoView : BaseWindow
  8. {
  9. private UI_RoleInfoUI _ui;
  10. private OtherRoleInfoData _roleInfo;
  11. private OtherRoleInfoDetailData _roleDetailInfo;
  12. public override void Dispose()
  13. {
  14. if (_ui != null)
  15. {
  16. _ui.Dispose();
  17. }
  18. _ui = null;
  19. base.Dispose();
  20. }
  21. protected override void OnInit()
  22. {
  23. base.OnInit();
  24. packageName = UI_RoleInfoUI.PACKAGE_NAME;
  25. _ui = UI_RoleInfoUI.Create();
  26. this.viewCom = _ui.target;
  27. isfullScreen = true;
  28. isReturnView = true;
  29. _ui.m_btnBack.onClick.Add(OnBtnBackClick);
  30. _ui.m_photoList.itemRenderer = RenderListItem;
  31. _ui.m_type.SetSelectedIndex(1);
  32. }
  33. protected override void AddEventListener()
  34. {
  35. base.AddEventListener();
  36. EventAgent.AddEventListener(ConstMessage.DOWNLOAD_FINISH, UpdateView);
  37. }
  38. protected override async void OnShown()
  39. {
  40. base.OnShown();
  41. _roleInfo = (this.viewData as object[])[0] as OtherRoleInfoData;
  42. _roleDetailInfo = (this.viewData as object[])[1] as OtherRoleInfoDetailData;
  43. _ui.m_txtRoleName.text = _roleInfo.roleName;
  44. _ui.m_txtLvl.text = _roleInfo.roleLv.ToString();
  45. RoleInfoManager.Instance.UpdateHead(_ui.m_comHead, _roleInfo.headId, _roleInfo.headBorderId);
  46. _roleDetailInfo = await RoleInfoSProxy.ReqOtherRoleDetailInfo(_roleInfo.roleId);
  47. if (_roleDetailInfo != null)
  48. {
  49. Timers.inst.StartCoroutine(PictureStorageHelper.Download(_roleDetailInfo.showPhotoList));
  50. }
  51. UpdateInfo();
  52. UpdateView();
  53. }
  54. protected override void OnHide()
  55. {
  56. base.OnHide();
  57. }
  58. private void OnBtnBackClick()
  59. {
  60. ViewManager.GoBackFrom(typeof(OtherRoleInfoView).FullName);
  61. }
  62. protected override void RemoveEventListener()
  63. {
  64. base.RemoveEventListener();
  65. EventAgent.RemoveEventListener(ConstMessage.DOWNLOAD_FINISH, UpdateView);
  66. }
  67. private void UpdateView()
  68. {
  69. // RoleLevelCfg roleLevelCfg = RoleLevelCfgArray.Instance.GetCfg(_roleInfo.roleLv);
  70. // if (roleLevelCfg.exp > 0)
  71. // {
  72. // _ui.m_txtExp.text = string.Format("{0}/{1}", _roleDetailInfo.RoleExp, roleLevelCfg.exp);
  73. // }
  74. // else
  75. // {
  76. // _ui.m_txtExp.text = "已满级";
  77. // }
  78. _ui.m_txtSlogan.text = _roleDetailInfo.slogan;
  79. //_ui.m_btnFieldGuide.title = string.Format("套装收集度:{0}", _roleDetailInfo.SuitCollectPer);
  80. _ui.m_photoList.numItems = _roleDetailInfo.showPhotoList.Count;
  81. }
  82. private void RenderListItem(int index, GObject obj)
  83. {
  84. PoemPhotoData poemPhotoData = _roleDetailInfo.showPhotoList[index];
  85. UI_ListPhotoItem item = UI_ListPhotoItem.Proxy(obj);
  86. item.target.data = index;
  87. if (poemPhotoData != null && poemPhotoData.Ntexture != null)
  88. {
  89. item.m_type.SetSelectedIndex(1);
  90. item.m_comPhoto.m_loaPhoto.texture = poemPhotoData == null ? null : poemPhotoData.Ntexture;
  91. }
  92. // 隐藏
  93. else
  94. {
  95. item.m_type.SetSelectedIndex(3);
  96. }
  97. UI_ListPhotoItem.ProxyEnd();
  98. }
  99. private void UpdateInfo()
  100. {
  101. //_ui.m_leagueName.text = RoleInfoManager.Instance.GetLeagueName();
  102. _ui.m_txtRoleID.text = _roleInfo.roleId.ToString();
  103. }
  104. }
  105. }