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; private bool isRefresh = false; 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; isRefresh = (bool)this.viewData; UpdateView(); UpdatePlayer(); } protected override void OnHide() { base.OnHide(); } protected override void RemoveEventListener() { base.RemoveEventListener(); } private void UpdatePlayer() { _ui.m_playerShow1.m_playerImage.m_playerImage.texture = MatchingTwoDataManager.Instance.LeftRoleInfo.Ntexture; _ui.m_playerShow2.m_playerImage.m_playerImage.texture = MatchingTwoDataManager.Instance.RightRoleInfo.Ntexture; MatchingPhotoWorksData otherLeftdata = MatchingTwoDataManager.Instance.LeftRoleInfo; JudgingRoundRoleInfo otherInfo = otherLeftdata.JudgingInfo; RoleInfoManager.Instance.UpdateHead(_ui.m_player1.m_head, otherInfo.HeadItemId, otherInfo.HeadBorderItemId); _ui.m_player1.m_nameText.text = otherInfo.RoleName.ToString(); MatchingPhotoWorksData otherRightdata = MatchingTwoDataManager.Instance.RightRoleInfo; JudgingRoundRoleInfo otherRightInfo = otherRightdata.JudgingInfo; RoleInfoManager.Instance.UpdateHead(_ui.m_player2.m_head, otherRightInfo.HeadItemId, otherRightInfo.HeadBorderItemId); _ui.m_player2.m_nameText.text = otherInfo.RoleName.ToString(); } private void UpdateView() { _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) { PromptController.Instance.ShowFloatTextPrompt("评选次数不足"); 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) { PromptController.Instance.ShowFloatTextPrompt("评选次数不足"); 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()); } } }