using System; using System.Collections.Generic; using ET; using FairyGUI; using UI.MatchingCompetition; using UnityEngine; namespace GFGGame { class MatchingCompetitionWorksListView : BaseWindow { private UI_MatchingCompetitionWorkListUI _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_MatchingCompetitionWorkListUI.PACKAGE_NAME; _ui = UI_MatchingCompetitionWorkListUI.Create(); this.viewCom = _ui.target; isReturnView = true; isfullScreen = true; _ui.m_workList.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; _seasonIndex = (int)this.viewData; UpdateView(); } protected override void OnHide() { base.OnHide(); } private void UpdateView() { _ui.m_workList.numItems = MatchingCompetitionDataManager.Instance._BeforeRankList.Count; } private void RenderRankList(int index, GObject obj) { UI_Component6 item = UI_Component6.Proxy(obj); if((index +1) >=1 && (index + 1)<=3) { item.m_c1.selectedIndex = index + 1; } else { item.m_c1.selectedIndex = 0; } MatchingPhotoWorksData otherdata = MatchingCompetitionDataManager.Instance._BeforeRankList[index]; JudgingRoundRoleInfo otherInfo = otherdata.JudgingInfo; otherInfo.Rank = index; RoleInfoManager.Instance.UpdateHead(item.m_head, otherInfo.HeadItemId, otherInfo.HeadBorderItemId); item.m_nameText.text = otherInfo.RoleName.ToString(); item.m_countText.text = otherInfo.Score.ToString(); item.m_playerImage.texture = otherdata.Ntexture; if (item.target.data == null) { item.target.onClick.Add(OnClickBtnItem); } item.target.data = index; UI_Component6.ProxyEnd(); } private void OnClickBtnItem(EventContext context) { GObject item = context.sender as GObject; int index = (int)item.data; MatchingPhotoWorksData otherInfo = MatchingCompetitionDataManager.Instance._BeforeRankList[index]; List AllIdList = new List(); foreach(var info in otherInfo.JudgingInfo.CollocationInfoList) { AllIdList.Add(MatchingCompetitionDataManager.Instance.GetIDByString(info.ItemId)); } MatchingCompetitionDataManager.Instance.DetailNtexture = otherInfo.Ntexture; ViewManager.Show(AllIdList); } private void OnClickBtnBack() { ViewManager.GoBackFrom(typeof(MatchingCompetitionWorksListView).FullName); } } }