using System; using System.Collections.Generic; using ET; using FairyGUI; using UI.MatchingCompetition; using UnityEngine; namespace GFGGame { class MatchingCompetitionSelectView : BaseWindow { private UI_MatchingCompetitionSelectUI _ui; private int _seasonIndex = 0; public override void Dispose() { if (_ui != null) { _ui.Dispose(); } _ui = null; base.Dispose(); } protected override void OnInit() { base.OnInit(); packageName = UI_MatchingCompetitionSelectUI.PACKAGE_NAME; _ui = UI_MatchingCompetitionSelectUI.Create(); this.viewCom = _ui.target; isReturnView = true; isfullScreen = true; _ui.m_BtnBack.onClick.Add(OnClickBtnBack); _ui.m_select1.target.onClick.Add(OnClickBtnSelect1); _ui.m_select2.target.onClick.Add(OnClickBtnSelect2); _ui.m_ruleBtn.onClick.Add(MatchingCompetitionDataManager.Instance.OnClickBtnRule); } protected override void AddEventListener() { base.AddEventListener(); } protected override void OnShown() { base.OnShown(); _ui.m_bg.url = ResPathUtil.GetBgImgPath("gzs_fb_bj"); _ui.m_BtnBack.touchable = true; UpdateView(); } protected override void OnHide() { base.OnHide(); } protected override void RemoveEventListener() { base.RemoveEventListener(); } private void UpdateView() { _ui.m_playerShow1.m_playerImage.m_playerImage.texture = null; _ui.m_playerShow2.m_playerImage.m_playerImage.texture = null; _ui.m_selectText1.alpha = 0; _ui.m_selectText2.alpha = 0; _ui.m_timeText.text = string.Format("剩余次数:{0}", MatchingCompetitionDataManager.Instance.MatchingRemainingTimes); } private void OnClickBtnBack() { _ui.m_BtnBack.touchable = true; ViewManager.GoBackFrom(typeof(MatchingCompetitionSelectView).FullName); } private void OnClickBtnSelect1() { if(MatchingCompetitionDataManager.Instance.MatchingRemainingTimes<=0) { return; } _ui.m_select1.m_c1.selectedIndex = 1; _ui.m_select1.m_numText.text = string.Format("心动值{0}", 0); _ui.m_BtnBack.touchable = false; _ui.m_t0.Play(()=>OnClickBtnBack()); } private void OnClickBtnSelect2() { if (MatchingCompetitionDataManager.Instance.MatchingRemainingTimes <= 0) { return; } _ui.m_select2.m_c1.selectedIndex = 1; _ui.m_select2.m_numText.text = string.Format("心动值{0}", 0); _ui.m_BtnBack.touchable = false; _ui.m_t1.Play(() => OnClickBtnBack()); } } }