using System; using System.Collections.Generic; using ET; using FairyGUI; using UI.MatchingCompetition; using UnityEngine; namespace GFGGame { class MatchingCompetitionWorksView : BaseWindow { private UI_MatchingCompetitionWorksUI _ui; private int _currentIndex = 0; public override void Dispose() { if (_ui != null) { _ui.Dispose(); } _ui = null; base.Dispose(); } protected override void OnInit() { base.OnInit(); packageName = UI_MatchingCompetitionWorksUI.PACKAGE_NAME; _ui = UI_MatchingCompetitionWorksUI.Create(); this.viewCom = _ui.target; isReturnView = true; isfullScreen = true; _ui.m_worksList.itemRenderer = RenderRankList; _ui.m_BtnBack.onClick.Add(OnClickBtnBack); } protected override void AddEventListener() { base.AddEventListener(); } protected override void OnShown() { base.OnShown(); _ui.m_bg.url = ResPathUtil.GetBgImgPath("pxs_bj"); _ui.m_titleText.text = JudgingRoundOpenCfgArray.Instance.dataArray[MatchingCompetitionDataManager.Instance.MatchingCompetitionSeason - 1].Name; UpdateView(); } protected override void OnHide() { base.OnHide(); } protected override void RemoveEventListener() { base.RemoveEventListener(); } private void UpdateView() { _ui.m_worksList.numItems = MatchingCompetitionDataManager.Instance._BeforeWorksList.Count; } private void RenderRankList(int index, GObject obj) { UI_Component5 item = UI_Component5.Proxy(obj); if (item.target.data == null) { item.target.onClick.Add(OnClickBtnItem); } item.target.data = index; UI_Component5.ProxyEnd(); } private async void OnClickBtnItem(EventContext context) { GObject item = context.sender as GObject; int index = (int)item.data +1; bool result = await MatchingCompetitionSproxy.ReqBeforeRank(index); if(result) { ViewManager.Show(index); } } private void OnClickBtnBack() { ViewManager.GoBackFrom(typeof(MatchingCompetitionWorksView).FullName); } } }