MatchingCompetitionSelectView.cs 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  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. class MatchingCompetitionSelectView : BaseWindow
  10. {
  11. private UI_MatchingCompetitionSelectUI _ui;
  12. private int _seasonIndex = 0;
  13. public override void Dispose()
  14. {
  15. if (_ui != null)
  16. {
  17. _ui.Dispose();
  18. }
  19. _ui = null;
  20. base.Dispose();
  21. }
  22. protected override void OnInit()
  23. {
  24. base.OnInit();
  25. packageName = UI_MatchingCompetitionSelectUI.PACKAGE_NAME;
  26. _ui = UI_MatchingCompetitionSelectUI.Create();
  27. this.viewCom = _ui.target;
  28. isReturnView = true;
  29. isfullScreen = true;
  30. _ui.m_BtnBack.onClick.Add(OnClickBtnBack);
  31. _ui.m_select1.target.onClick.Add(OnClickBtnSelect1);
  32. _ui.m_select2.target.onClick.Add(OnClickBtnSelect2);
  33. _ui.m_ruleBtn.onClick.Add(MatchingCompetitionDataManager.Instance.OnClickBtnRule);
  34. }
  35. protected override void AddEventListener()
  36. {
  37. base.AddEventListener();
  38. }
  39. protected override void OnShown()
  40. {
  41. base.OnShown();
  42. _ui.m_bg.url = ResPathUtil.GetBgImgPath("gzs_fb_bj");
  43. _ui.m_BtnBack.touchable = true;
  44. UpdateView();
  45. }
  46. protected override void OnHide()
  47. {
  48. base.OnHide();
  49. }
  50. protected override void RemoveEventListener()
  51. {
  52. base.RemoveEventListener();
  53. }
  54. private void UpdateView()
  55. {
  56. _ui.m_playerShow1.m_playerImage.m_playerImage.texture = null;
  57. _ui.m_playerShow2.m_playerImage.m_playerImage.texture = null;
  58. _ui.m_selectText1.alpha = 0;
  59. _ui.m_selectText2.alpha = 0;
  60. _ui.m_timeText.text = string.Format("剩余次数:{0}", MatchingCompetitionDataManager.Instance.MatchingRemainingTimes);
  61. }
  62. private void OnClickBtnBack()
  63. {
  64. _ui.m_BtnBack.touchable = true;
  65. ViewManager.GoBackFrom(typeof(MatchingCompetitionSelectView).FullName);
  66. }
  67. private void OnClickBtnSelect1()
  68. {
  69. if(MatchingCompetitionDataManager.Instance.MatchingRemainingTimes<=0)
  70. {
  71. return;
  72. }
  73. _ui.m_select1.m_c1.selectedIndex = 1;
  74. _ui.m_select1.m_numText.text = string.Format("心动值{0}", 0);
  75. _ui.m_BtnBack.touchable = false;
  76. _ui.m_t0.Play(()=>OnClickBtnBack());
  77. }
  78. private void OnClickBtnSelect2()
  79. {
  80. if (MatchingCompetitionDataManager.Instance.MatchingRemainingTimes <= 0)
  81. {
  82. return;
  83. }
  84. _ui.m_select2.m_c1.selectedIndex = 1;
  85. _ui.m_select2.m_numText.text = string.Format("心动值{0}", 0);
  86. _ui.m_BtnBack.touchable = false;
  87. _ui.m_t1.Play(() => OnClickBtnBack());
  88. }
  89. }
  90. }