OtherRoleInfoView.cs 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  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. _ui.m_btnBack.onClick.Add(OnBtnBackClick);
  29. _ui.m_list.itemRenderer = RenderListItem;
  30. _ui.m_loaBg.url = ResPathUtil.GetBgImgPath("xc_bjbj");
  31. }
  32. protected override void AddEventListener()
  33. {
  34. base.AddEventListener();
  35. EventAgent.AddEventListener(ConstMessage.DOWNLOAD_FINISH, UpdateView);
  36. }
  37. protected override async void OnShown()
  38. {
  39. base.OnShown();
  40. _roleInfo = (this.viewData as object[])[0] as OtherRoleInfoData;
  41. _roleDetailInfo = (this.viewData as object[])[1] as OtherRoleInfoDetailData;
  42. _ui.m_txtRoleName.text = _roleInfo.roleName;
  43. _ui.m_txtLvl.text = _roleInfo.roleLv.ToString();
  44. RoleInfoManager.Instance.UpdateHead(_ui.m_comHead, _roleInfo.headId, _roleInfo.headBorderId);
  45. _roleDetailInfo = await RoleInfoSProxy.ReqOtherRoleDetailInfo(_roleInfo.roleId);
  46. if (_roleDetailInfo != null)
  47. {
  48. Timers.inst.StartCoroutine(PictureStorageHelper.Download(_roleDetailInfo.showPhotoList));
  49. }
  50. }
  51. protected override void OnHide()
  52. {
  53. base.OnHide();
  54. }
  55. private void OnBtnBackClick()
  56. {
  57. ViewManager.GoBackFrom(typeof(OtherRoleInfoView).FullName);
  58. }
  59. protected override void RemoveEventListener()
  60. {
  61. base.RemoveEventListener();
  62. EventAgent.RemoveEventListener(ConstMessage.DOWNLOAD_FINISH, UpdateView);
  63. }
  64. private void UpdateView()
  65. {
  66. // RoleLevelCfg roleLevelCfg = RoleLevelCfgArray.Instance.GetCfg(_roleInfo.roleLv);
  67. // if (roleLevelCfg.exp > 0)
  68. // {
  69. // _ui.m_txtExp.text = string.Format("{0}/{1}", _roleDetailInfo.RoleExp, roleLevelCfg.exp);
  70. // }
  71. // else
  72. // {
  73. // _ui.m_txtExp.text = "已满级";
  74. // }
  75. _ui.m_txtSlogan.text = _roleDetailInfo.slogan;
  76. _ui.m_btnFieldGuide.title = string.Format("套装收集度:{0}", _roleDetailInfo.SuitCollectPer);
  77. _ui.m_list.numItems = _roleDetailInfo.showPhotoList.Count;
  78. }
  79. private void RenderListItem(int index, GObject obj)
  80. {
  81. PoemPhotoData poemPhotoData = _roleDetailInfo.showPhotoList[index];
  82. UI_ListPhotoItem item = UI_ListPhotoItem.Proxy(obj);
  83. item.target.data = index;
  84. item.m_imgNone.visible = poemPhotoData == null;
  85. item.m_grpLock.visible = false;
  86. if (RoleInfoManager.GetPosType(index) == MonthCardType.Gold && !RoleDataManager.CheckIsMonthCardOpenByType(MonthCardType.Gold)
  87. || RoleInfoManager.GetPosType(index) == MonthCardType.BlackGold && !RoleDataManager.CheckIsMonthCardOpenByType(MonthCardType.BlackGold))
  88. {
  89. item.m_comPhoto.m_loaPhoto.texture = null;
  90. item.m_imgNone.visible = true;
  91. return;
  92. }
  93. item.m_comPhoto.m_loaPhoto.texture = poemPhotoData == null ? null : poemPhotoData.Ntexture;
  94. UI_ListPhotoItem.ProxyEnd();
  95. }
  96. }
  97. }