LeagueTeaPartyOverView.cs 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  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. isReturnView = true;
  31. _ui.m_loaBg.url = ResPathUtil.GetDressUpPath("chahuibg");
  32. _ui.m_btnBack.onClick.Add(OnBtnBackClick);
  33. teaPartyOverItemList.Add(_ui.m_TeaPartyOverItem1);
  34. teaPartyOverItemList.Add(_ui.m_TeaPartyOverItem2);
  35. teaPartyOverItemList.Add(_ui.m_TeaPartyOverItem3);
  36. teaPartyOverItemList.Add(_ui.m_TeaPartyOverItem4);
  37. teaPartyOverItemList.Add(_ui.m_TeaPartyOverItem5);
  38. teaPartyOverItemList.Add(_ui.m_TeaPartyOverItem6);
  39. teapartyRoleCfg = TeapartyRoleCfgArray.Instance.GetCfgsByid(1); //LeagueDataManager.Instance.TeaPartyId
  40. }
  41. protected override void AddEventListener()
  42. {
  43. base.AddEventListener();
  44. }
  45. protected override void OnShown()
  46. {
  47. base.OnShown();
  48. GetRoleContainerInfos();
  49. Timers.inst.Add(2, 1, UpdateTime);
  50. GetLeagueRatingAward();
  51. }
  52. private async void GetLeagueRatingAward()
  53. {
  54. bool result = await LeagueSproxy.ReportTeapartyComplete(RoleDataManager.roleId);
  55. if (result)
  56. {
  57. }
  58. }
  59. protected override void OnHide()
  60. {
  61. base.OnHide();
  62. Timers.inst.Remove(UpdateTime);
  63. }
  64. protected override void RemoveEventListener()
  65. {
  66. base.RemoveEventListener();
  67. }
  68. private async void GetRoleContainerInfos()
  69. {
  70. bool result = await LeagueSproxy.GetRoleContainerInfos(RoleDataManager.roleId);
  71. if (result)
  72. {
  73. var roleContainerList = LeagueDataManager.Instance.RoleContainerList;
  74. for (int index = 0; index < teaPartyOverItemList.Count; index++)
  75. {
  76. teaPartyOverItemList[index].m_txtRoleName.text = teapartyRoleCfg[index].name;
  77. teaPartyOverItemList[index].m_txtGuildName.text = roleContainerList[index].MaxScoreRoleName;
  78. }
  79. }
  80. }
  81. private void OnBtnBackClick()
  82. {
  83. ViewManager.GoBackFrom(typeof(LeagueTeaPartyOverView).FullName);
  84. }
  85. private void OnBtnRewardClick()
  86. {
  87. ViewManager.Show<LeagueTeaPartyRewardView>();
  88. }
  89. private void UpdateTime(object param)
  90. {
  91. OnBtnRewardClick();
  92. Timers.inst.Remove(UpdateTime);
  93. }
  94. }
  95. }