using System.Collections.Generic; using ET; using FairyGUI; using UI.Studio; using UnityEngine; namespace GFGGame { public class StudioFilingView : BaseWindow { private UI_StudioFilingUI _ui; private FilingCfg _filingCfg; private List _storyLevelCfgs; public override void Dispose() { if (_ui != null) { _ui.Dispose(); _ui = null; } base.Dispose(); } protected override void OnInit() { base.OnInit(); packageName = UI_StudioFilingUI.PACKAGE_NAME; _ui = UI_StudioFilingUI.Create(); this.viewCom = _ui.target; isfullScreen = true; _ui.m_list.itemRenderer = RenderListItem; _ui.m_list.onClickItem.Add(OnListItemClick); _ui.m_btnBack.onClick.Add(Hide); _ui.m_btnChange.onClick.Add(OnBtnChangeClick); _ui.m_btnReward.onClick.Add(OnBtnRewardClick); _ui.m_btnAdd.onClick.Add(OnBtnAddClick); _ui.m_btnSuit.onClick.Add(OnBtnSuitClick); } protected override void AddEventListener() { base.AddEventListener(); } protected override void OnShown() { base.OnShown(); UpdateView(); } protected override void OnHide() { base.OnHide(); ViewManager.GoBackFrom(typeof(StudioFilingView).FullName); } protected override void RemoveEventListener() { base.RemoveEventListener(); } private void UpdateView() { _filingCfg = FilingCfgArray.Instance.GetCfg(StudioDataManager.Instance.filingChapterId); _ui.m_txtTitle.SetVar("name", _filingCfg.name).FlushVars(); SuitCfg suitCfg = SuitCfgArray.Instance.GetCfg(_filingCfg.suitId); _ui.m_txtSuitName.text = suitCfg.name; DressUpMenuSuitDataManager.GetTotalProgress(out int haveCount, out int totalCount); _ui.m_txtSuitProgress.text = string.Format("({0}/{1})", haveCount, totalCount); _storyLevelCfgs = StoryLevelCfgArray.Instance.GetCfgsBytypeAndsubTypeAndchapterId(_filingCfg.type, 0, StudioDataManager.Instance.filingChapterId); _ui.m_list.numItems = _storyLevelCfgs.Count; } private void RenderListItem(int index, GObject obj) { UI_ListLevel item = UI_ListLevel.Proxy(obj); item.m_c1.selectedIndex = index % 2; item.m_txtName.text = _storyLevelCfgs[index].name; item.m_imgLock.visible = InstanceZonesDataManager.CheckLevelPass(_storyLevelCfgs[index].id); item.m_comFlower.m_c1.selectedIndex = InstanceZonesDataManager.GetStarCountHistory(_storyLevelCfgs[index].id); item.target.data = _storyLevelCfgs[index]; UI_ListLevel.ProxyEnd(); } private void OnListItemClick(EventContext context) { GObject obj = context.data as GObject; StoryLevelCfg storyLevelCfg = obj.data as StoryLevelCfg; if (!string.IsNullOrEmpty(storyLevelCfg.storyStartID)) { StoryController.ShowFilingStoryDialog(storyLevelCfg.storyStartID); } else { InstanceZonesController.ShowLevelView(storyLevelCfg.id, StudioDataManager.Instance.OnFinishStoryLevel); } } private void OnBtnChangeClick() { } private void OnBtnRewardClick() { } private void OnBtnAddClick() { } private void OnBtnSuitClick() { } } }