MatchingCompetitionGatheringView.cs 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. using System;
  2. using System.Collections.Generic;
  3. using ET;
  4. using FairyGUI;
  5. using UI.MatchingCompetition;
  6. using UnityEngine;
  7. namespace GFGGame
  8. {
  9. //搭配赛集合期间
  10. class MatchingCompetitionGatheringView : BaseWindow
  11. {
  12. private UI_MatchingCompetitionGatheringUI _ui;
  13. private ValueBarController _valueBarController;
  14. private int SuitID;
  15. private EffectUI _effectUI1;
  16. public override void Dispose()
  17. {
  18. EffectUIPool.Recycle(_effectUI1);
  19. _effectUI1 = null;
  20. if (_valueBarController != null)
  21. {
  22. _valueBarController.Dispose();
  23. _valueBarController = null;
  24. }
  25. if (_ui != null)
  26. {
  27. _ui.Dispose();
  28. }
  29. _ui = null;
  30. base.Dispose();
  31. }
  32. protected override void OnInit()
  33. {
  34. base.OnInit();
  35. packageName = UI_MatchingCompetitionGatheringUI.PACKAGE_NAME;
  36. _ui = UI_MatchingCompetitionGatheringUI.Create();
  37. this.viewCom = _ui.target;
  38. isReturnView = true;
  39. isfullScreen = true;
  40. _ui.m_BtnBack.onClick.Add(OnClickBtnBack);
  41. _ui.m_btnUploadWorks.onClick.Add(OnClickBtnUpload);
  42. _ui.m_btnShop.onClick.Add(OnClickBtnShop);
  43. _ui.m_ruleBtn.onClick.Add(MatchingCompetitionDataManager.Instance.OnClickBtnRule);
  44. }
  45. protected override void AddEventListener()
  46. {
  47. base.AddEventListener();
  48. }
  49. protected override void OnShown()
  50. {
  51. base.OnShown();
  52. _ui.m_bg.url = ResPathUtil.GetBgImgPath("gzs_fb_bj");
  53. _ui.m_c1.selectedIndex = 1;
  54. JudgingRoundOpenCfg judgingCfg = JudgingRoundOpenCfgArray.Instance.dataArray[MatchingCompetitionDataManager.Instance.MatchingCompetitionSeason - 1];
  55. SuitID = judgingCfg.ShowSuit;
  56. _ui.m_titleText.text = judgingCfg.Name;
  57. SuitCfg suitCfg = SuitCfgArray.Instance.GetCfg(SuitID);
  58. _ui.m_suitName.text = suitCfg.name;
  59. UpdateView();
  60. Timers.inst.AddUpdate(UpdateTime);
  61. }
  62. protected override void OnHide()
  63. {
  64. DressUpObjUI dressUpObjUI = _ui.m_suitShow.data as DressUpObjUI;
  65. if (dressUpObjUI != null)
  66. {
  67. dressUpObjUI.Dispose();
  68. }
  69. _ui.m_suitShow.data = null;
  70. base.OnHide();
  71. Timers.inst.Remove(UpdateTime);
  72. }
  73. protected override void RemoveEventListener()
  74. {
  75. base.RemoveEventListener();
  76. }
  77. private void UpdateView()
  78. {
  79. if (true)
  80. {
  81. DressUpObjUI dressUpObjUI;
  82. if (_ui.m_suitShow.data == null)
  83. {
  84. _ui.m_suitShow.data = new DressUpObjUI("SceneSuitFoster");
  85. }
  86. bool showAction = SuitCfgArray.Instance.CheckSuitHasAction(SuitID) && DressUpMenuSuitDataManager.CheckSuitHasActionRes(SuitID);
  87. dressUpObjUI = _ui.m_suitShow.data as DressUpObjUI;
  88. dressUpObjUI.ResetSceneObj(100, false, true, null, false);
  89. dressUpObjUI.dressUpObj.PutOnSuitCfg(SuitID, showAction, new int[] { ConstDressUpItemType.BEI_JING }, false, false);
  90. dressUpObjUI.UpdateWrapper(_ui.m_suitShow);
  91. }
  92. }
  93. private void UpdateTime(object param = null)
  94. {
  95. long endTime = MatchingCompetitionDataManager.Instance.MatchingEndTimes;
  96. long curTime = TimeHelper.ServerNow();
  97. if(MatchingCompetitionDataManager.Instance.MatchingState != 1)
  98. {
  99. Timers.inst.Remove(UpdateTime);
  100. PromptController.Instance.ShowFloatTextPrompt("投稿时间已到!");
  101. ViewManager.GoBackFrom(typeof(MatchingCompetitionGatheringView).FullName);
  102. return;
  103. }
  104. if (endTime < curTime + 1)
  105. {
  106. Timers.inst.Remove(UpdateTime);
  107. return;
  108. }
  109. TimeUtil.FormattingTime(curTime, endTime, out int num, out string str);
  110. _ui.m_timeText.text = "投稿剩余时间:" + TimeUtil.FormattingTimeTo_DDHHmm(endTime - curTime);
  111. }
  112. private void OnClickBtnBack()
  113. {
  114. ViewManager.GoBackFrom(typeof(MatchingCompetitionGatheringView).FullName);
  115. }
  116. private void OnClickBtnUpload()
  117. {
  118. ViewManager.Show<DressUpView>(2, false);
  119. }
  120. private void OnClickBtnShop()
  121. {
  122. ViewManager.Show<StoreView>(new object[] { ConstStoreTabId.STORE_EXCHANGE, 3 });
  123. }
  124. }
  125. }