OtherRoleInfoView.cs 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  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_OtherRoleInfoUI _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_OtherRoleInfoUI.PACKAGE_NAME;
  25. _ui = UI_OtherRoleInfoUI.Create();
  26. this.viewCom = _ui.target;
  27. isfullScreen = true;
  28. isReturnView = true;
  29. _ui.m_btnBack.onClick.Add(OnBtnBackClick);
  30. _ui.m_list.itemRenderer = RenderListItem;
  31. _ui.m_loaBg.url = ResPathUtil.GetBgImgPath("xc_bjbj");
  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. }
  52. protected override void OnHide()
  53. {
  54. base.OnHide();
  55. }
  56. private void OnBtnBackClick()
  57. {
  58. ViewManager.GoBackFrom(typeof(OtherRoleInfoView).FullName);
  59. }
  60. protected override void RemoveEventListener()
  61. {
  62. base.RemoveEventListener();
  63. EventAgent.RemoveEventListener(ConstMessage.DOWNLOAD_FINISH, UpdateView);
  64. }
  65. private void UpdateView()
  66. {
  67. // RoleLevelCfg roleLevelCfg = RoleLevelCfgArray.Instance.GetCfg(_roleInfo.roleLv);
  68. // if (roleLevelCfg.exp > 0)
  69. // {
  70. // _ui.m_txtExp.text = string.Format("{0}/{1}", _roleDetailInfo.RoleExp, roleLevelCfg.exp);
  71. // }
  72. // else
  73. // {
  74. // _ui.m_txtExp.text = "已满级";
  75. // }
  76. _ui.m_txtSlogan.text = _roleDetailInfo.slogan;
  77. _ui.m_btnFieldGuide.title = string.Format("套装收集度:{0}", _roleDetailInfo.SuitCollectPer);
  78. _ui.m_list.numItems = _roleDetailInfo.showPhotoList.Count;
  79. }
  80. private void RenderListItem(int index, GObject obj)
  81. {
  82. PoemPhotoData poemPhotoData = _roleDetailInfo.showPhotoList[index];
  83. UI_ListPhotoItem item = UI_ListPhotoItem.Proxy(obj);
  84. item.target.data = index;
  85. item.m_imgNone.visible = poemPhotoData == null;
  86. item.m_grpLock.visible = false;
  87. if (RoleInfoManager.GetPosType(index) == MonthCardType.Gold && !RoleDataManager.CheckIsMonthCardOpenByType(MonthCardType.Gold)
  88. || RoleInfoManager.GetPosType(index) == MonthCardType.BlackGold && !RoleDataManager.CheckIsMonthCardOpenByType(MonthCardType.BlackGold))
  89. {
  90. item.m_comPhoto.m_loaPhoto.texture = null;
  91. item.m_imgNone.visible = true;
  92. return;
  93. }
  94. item.m_comPhoto.m_loaPhoto.texture = poemPhotoData == null ? null : poemPhotoData.Ntexture;
  95. UI_ListPhotoItem.ProxyEnd();
  96. }
  97. }
  98. }