LeagueTeaPartyView.cs 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. using ET;
  2. using FairyGUI;
  3. using Hutool;
  4. using System.Collections.Generic;
  5. using UI.League;
  6. using UnityEngine;
  7. namespace GFGGame
  8. {
  9. public class LeagueTeaPartyView : BaseWindow
  10. {
  11. private UI_LeagueTeaPartyUI _ui;
  12. private List<UI_comTeaPartyItem> teaPartyItemList = new List<UI_comTeaPartyItem>();
  13. private List<TeapartyRoleCfg> teapartyRoleCfg;
  14. public override void Dispose()
  15. {
  16. if (_ui != null)
  17. {
  18. _ui.Dispose();
  19. _ui = null;
  20. }
  21. base.Dispose();
  22. }
  23. protected override void OnInit()
  24. {
  25. base.OnInit();
  26. packageName = UI_LeagueTeaPartyUI.PACKAGE_NAME;
  27. _ui = UI_LeagueTeaPartyUI.Create();
  28. this.viewCom = _ui.target;
  29. isfullScreen = true;
  30. _ui.m_loaBg.url = ResPathUtil.GetBgImgPath("zjm_2_2");
  31. _ui.m_btnBack.onClick.Add(OnBtnBackClick);
  32. _ui.m_btnChat.onClick.Add(OnBtnChatClick);
  33. _ui.m_btnChallenge.onClick.Add(OnBtnChallengeClick);
  34. _ui.m_btnReward.onClick.Add(OnBtnRewardClick);
  35. _ui.m_ListTeaParty.itemRenderer = ListTeaPartyItemRender;
  36. teapartyRoleCfg = TeapartyRoleCfgArray.Instance.GetCfgsByid(1); //LeagueDataManager.Instance.TeaPartyId
  37. }
  38. private void ListTeaPartyItemRender(int index, GObject obj)
  39. {
  40. UI_comTeaPartyItem itemObj = UI_comTeaPartyItem.Proxy(obj);
  41. itemObj.m_btnDetail.onClick.Add(OnBtnDetailClick);
  42. itemObj.m_iconRole.onClick.Add(OnBtnIconRoleClick);
  43. itemObj.m_txtRoleName.text = teapartyRoleCfg[index].name;
  44. itemObj.target.onClick.Add(OnTeaPartyItemTipsClick);
  45. UI_comTeaPartyItem.ProxyEnd();
  46. }
  47. protected override void AddEventListener()
  48. {
  49. base.AddEventListener();
  50. }
  51. protected override void OnShown()
  52. {
  53. base.OnShown();
  54. GetRoleContainerInfos();
  55. var openCfg = TeapartyOpenCfgArray.Instance.GetCfg(1);//LeagueDataManager.Instance.TeaPartyId
  56. _ui.m_txtTeaName.text = openCfg.name;
  57. _ui.m_btnRule.onClick.Add(RuleController.ShowRuleView);
  58. _ui.m_btnRule.data = 300022;
  59. _ui.m_teaPartyItemTips.target.visible = false;
  60. _ui.m_ListTeaParty.numItems = 6;
  61. }
  62. private async void GetRoleContainerInfos()
  63. {
  64. bool result = await LeagueSproxy.GetRoleContainerInfos();
  65. if (result)
  66. {
  67. var roleContainerList = LeagueDataManager.Instance.RoleContainerList;
  68. for (int index = 0; index < roleContainerList.Count; index++){
  69. teaPartyItemList[index].m_txtMaxValue.text = roleContainerList[index].MaxScore.ToString();
  70. }
  71. }
  72. }
  73. protected override void OnHide()
  74. {
  75. base.OnHide();
  76. }
  77. protected override void RemoveEventListener()
  78. {
  79. base.RemoveEventListener();
  80. }
  81. private void OnBtnChatClick()
  82. {
  83. ViewManager.Show<LeagueChatView>();
  84. }
  85. private void OnBtnChallengeClick()
  86. {
  87. PromptController.Instance.ShowFloatTextPrompt("开始挑战");
  88. ViewManager.Show<LeagueTeaPartyOverView>();
  89. }
  90. private void OnBtnRewardClick()
  91. {
  92. ViewManager.Show<LeagueTeaPartyRewardView>();
  93. }
  94. private void OnBtnBackClick()
  95. {
  96. ViewManager.GoBackFrom(typeof(LeagueView).FullName);
  97. }
  98. private void OnBtnDetailClick()
  99. {
  100. _ui.m_teaPartyItemTips.target.visible = true;
  101. }
  102. private void OnTeaPartyItemTipsClick()
  103. {
  104. _ui.m_teaPartyItemTips.target.visible = false;
  105. }
  106. private void OnBtnIconRoleClick()
  107. {
  108. FieldCfg _curCfg;
  109. _curCfg = FieldCfgArray.Instance.dataArray[FieldDataManager.Instance.difficulty];
  110. int curLevelId = StoryLevelCfgArray.Instance.GetCfgsBytypeAndsubTypeAndchapterId(_curCfg.type, 0, _curCfg.id)[0].id;
  111. ViewManager.Show<DressUpFightView>(0, new object[] { typeof(LeagueTeaPartyView).FullName, null }, true);
  112. }
  113. }
  114. }