LeagueTeaPartyView.cs 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  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. public override void Dispose()
  14. {
  15. if (_ui != null)
  16. {
  17. _ui.Dispose();
  18. _ui = null;
  19. }
  20. base.Dispose();
  21. }
  22. protected override void OnInit()
  23. {
  24. base.OnInit();
  25. packageName = UI_LeagueTeaPartyUI.PACKAGE_NAME;
  26. _ui = UI_LeagueTeaPartyUI.Create();
  27. this.viewCom = _ui.target;
  28. isfullScreen = true;
  29. _ui.m_loaBg.url = ResPathUtil.GetBgImgPath("zjm_2_2");
  30. _ui.m_btnBack.onClick.Add(OnBtnBackClick);
  31. _ui.m_btnChat.onClick.Add(OnBtnChatClick);
  32. _ui.m_btnChallenge.onClick.Add(OnBtnChallengeClick);
  33. _ui.m_btnReward.onClick.Add(OnBtnRewardClick);
  34. teaPartyItemList.Add(_ui.m_teaPartyItem1);
  35. teaPartyItemList.Add(_ui.m_teaPartyItem2);
  36. teaPartyItemList.Add(_ui.m_teaPartyItem3);
  37. teaPartyItemList.Add(_ui.m_teaPartyItem4);
  38. teaPartyItemList.Add(_ui.m_teaPartyItem5);
  39. teaPartyItemList.Add(_ui.m_teaPartyItem6);
  40. _ui.m_teaPartyItemTips.target.onClick.Add(OnTeaPartyItemTipsClick);
  41. int index = 0;
  42. int teaPartyType = 1;
  43. List<TeapartyRoleCfg> teapartyRoleCfg = TeapartyRoleCfgArray.Instance.GetCfgsByid(teaPartyType);
  44. foreach (var itemObj in teaPartyItemList) {
  45. itemObj.m_btnDetail.onClick.Add(OnBtnDetailClick);
  46. itemObj.m_iconRole.onClick.Add(OnBtnIconRoleClick);
  47. itemObj.m_txtRoleName.text = teapartyRoleCfg[index].name;
  48. index += 1;
  49. }
  50. }
  51. protected override void AddEventListener()
  52. {
  53. base.AddEventListener();
  54. }
  55. protected override void OnShown()
  56. {
  57. base.OnShown();
  58. }
  59. protected override void OnHide()
  60. {
  61. base.OnHide();
  62. }
  63. protected override void RemoveEventListener()
  64. {
  65. base.RemoveEventListener();
  66. }
  67. private void OnBtnChatClick()
  68. {
  69. ViewManager.Show<LeagueChatView>();
  70. }
  71. private void OnBtnChallengeClick()
  72. {
  73. PromptController.Instance.ShowFloatTextPrompt("开始挑战");
  74. ViewManager.Show<LeagueTeaPartyOverView>();
  75. }
  76. private void OnBtnRewardClick()
  77. {
  78. ViewManager.Show<LeagueTeaPartyRewardView>();
  79. }
  80. private void OnBtnBackClick()
  81. {
  82. ViewManager.GoBackFrom(typeof(LeagueView).FullName);
  83. }
  84. private void OnBtnDetailClick()
  85. {
  86. _ui.m_teaPartyItemTips.target.visible = true;
  87. }
  88. private void OnTeaPartyItemTipsClick()
  89. {
  90. _ui.m_teaPartyItemTips.target.visible = false;
  91. }
  92. private void OnBtnIconRoleClick()
  93. {
  94. FieldCfg _curCfg;
  95. _curCfg = FieldCfgArray.Instance.dataArray[FieldDataManager.Instance.difficulty];
  96. int curLevelId = StoryLevelCfgArray.Instance.GetCfgsBytypeAndsubTypeAndchapterId(_curCfg.type, 0, _curCfg.id)[0].id;
  97. ViewManager.Show<DressUpFightView>(curLevelId, new object[] { typeof(LeagueTeaPartyView).FullName, null }, true);
  98. }
  99. }
  100. }