LeagueTeaPartyOverView.cs 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  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 LeagueTeaPartyOverView : BaseWindow
  10. {
  11. private UI_LeagueTeaPartyOverUI _ui;
  12. private List<UI_comTeaPartyOverItem> teaPartyOverItemList = new List<UI_comTeaPartyOverItem>();
  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_LeagueTeaPartyOverUI.PACKAGE_NAME;
  27. _ui = UI_LeagueTeaPartyOverUI.Create();
  28. this.viewCom = _ui.target;
  29. isfullScreen = true;
  30. _ui.m_loaBg.url = ResPathUtil.GetDressUpPath("chahuibg");
  31. _ui.m_btnBack.onClick.Add(OnBtnBackClick);
  32. _ui.m_btnReward.onClick.Add(OnBtnRewardClick);
  33. _ui.m_btnRule.onClick.Add(RuleController.ShowRuleView);
  34. _ui.m_btnRule.data = 300022;
  35. teaPartyOverItemList.Add(_ui.m_TeaPartyOverItem1);
  36. teaPartyOverItemList.Add(_ui.m_TeaPartyOverItem2);
  37. teaPartyOverItemList.Add(_ui.m_TeaPartyOverItem3);
  38. teaPartyOverItemList.Add(_ui.m_TeaPartyOverItem4);
  39. teaPartyOverItemList.Add(_ui.m_TeaPartyOverItem5);
  40. teaPartyOverItemList.Add(_ui.m_TeaPartyOverItem6);
  41. teapartyRoleCfg = TeapartyRoleCfgArray.Instance.GetCfgsByid(1); //LeagueDataManager.Instance.TeaPartyId
  42. }
  43. protected override void AddEventListener()
  44. {
  45. base.AddEventListener();
  46. }
  47. protected override void OnShown()
  48. {
  49. base.OnShown();
  50. GetRoleContainerInfos();
  51. Timers.inst.Add(2, 1, UpdateTime);
  52. }
  53. protected override void OnHide()
  54. {
  55. base.OnHide();
  56. Timers.inst.Remove(UpdateTime);
  57. }
  58. protected override void RemoveEventListener()
  59. {
  60. base.RemoveEventListener();
  61. }
  62. private async void GetRoleContainerInfos()
  63. {
  64. bool result = await LeagueSproxy.GetRoleContainerInfos(RoleDataManager.roleId);
  65. if (result)
  66. {
  67. for (int index = 0; index < teaPartyOverItemList.Count; index++)
  68. {
  69. teaPartyOverItemList[index].m_txtRoleName.text = teapartyRoleCfg[index].name;
  70. teaPartyOverItemList[index].m_txtGuildName.text = teapartyRoleCfg[index].name;
  71. }
  72. }
  73. }
  74. private void OnBtnBackClick()
  75. {
  76. ViewManager.GoBackFrom(typeof(LeagueView).FullName);
  77. }
  78. private void OnBtnRewardClick()
  79. {
  80. ViewManager.Show<LeagueTeaPartyRewardView>();
  81. }
  82. private void UpdateTime(object param)
  83. {
  84. OnBtnRewardClick();
  85. Timers.inst.Remove(UpdateTime);
  86. }
  87. }
  88. }