123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101 |
- 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();
- EventAgent.AddEventListener(ConstMessage.DOWNLOAD_FINISH, UpdateView);
- }
- protected override void RemoveEventListener()
- {
- base.RemoveEventListener();
- EventAgent.RemoveEventListener(ConstMessage.DOWNLOAD_FINISH, UpdateView);
- }
- 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();
- }
- private void UpdateView()
- {
- if(MatchingCompetitionDataManager.Instance._BeforeWorksList.Count == 0)
- {
- _ui.m_descText.visible = true;
- }
- else
- {
- _ui.m_descText.visible = false;
- }
- _ui.m_worksList.numItems = MatchingCompetitionDataManager.Instance._BeforeWorksList.Count;
- }
- private void RenderRankList(int index, GObject obj)
- {
- UI_Component5 item = UI_Component5.Proxy(obj);
- JudgingRoundOpenCfg judingCfg = JudgingRoundOpenCfgArray.Instance.GetCfg(MatchingCompetitionDataManager.Instance._BeforeWorksList[index].WorksInfo.OldJudgingRoundOpenId);
- item.m_seasonText.text = string.Format("第{0}期",MatchingCompetitionDataManager.Instance._BeforeWorksList[index].WorksInfo.OldJudgingRoundOpenId.ToString());
- item.m_seasonName.text = judingCfg.Name;
- item.m_openTime.visible = false;
- //string themeTime = TimeUtil.FormattingTimeTo_yyyMMdd2(MatchingCompetitionDataManager.Instance._BeforeWorksList[index]);
- item.m_playerImage.texture = MatchingCompetitionDataManager.Instance._BeforeWorksList[index].Ntexture;
- 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<MatchingCompetitionWorksListView>(index);
- }
- }
- private void OnClickBtnBack()
- {
- ViewManager.GoBackFrom(typeof(MatchingCompetitionWorksView).FullName);
- }
- }
- }
|