123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126 |
- 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<StoryLevelCfg> _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);
- _ui.m_loaBg.url = ResPathUtil.GetBgImgPath("tc_bjbj");
- }
- protected override void AddEventListener()
- {
- base.AddEventListener();
- EventAgent.AddEventListener(ConstMessage.STORY_LEVEL_CHANGE, UpdateView);
- }
- protected override void OnShown()
- {
- base.OnShown();
- UpdateView();
- }
- protected override void OnHide()
- {
- base.OnHide();
- ViewManager.GoBackFrom(typeof(StudioFilingView).FullName);
- }
- protected override void RemoveEventListener()
- {
- base.RemoveEventListener();
- EventAgent.RemoveEventListener(ConstMessage.STORY_LEVEL_CHANGE, UpdateView);
- }
- 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.GetSuitProgressBySuitId(_filingCfg.suitId, out int count, out int totalCount);
- _ui.m_txtSuitProgress.text = string.Format("({0}/{1})", count, totalCount);
- _storyLevelCfgs = StoryLevelCfgArray.Instance.GetCfgsBytypeAndsubTypeAndchapterId(_filingCfg.type, 0, StudioDataManager.Instance.filingChapterId);
- _ui.m_list.numItems = _storyLevelCfgs.Count;
- }
- private void RenderListItem(int index, GObject obj)
- {
- int _index = _storyLevelCfgs.Count - index - 1;
- UI_ListLevel item = UI_ListLevel.Proxy(obj);
- item.m_c1.selectedIndex = _index % 2;
- item.m_txtName.text = _storyLevelCfgs[_index].name;
- item.m_imgLock.visible = _index > 0 && !InstanceZonesDataManager.CheckLevelPass(_storyLevelCfgs[_index - 1].id);
- item.m_comFlower.m_c1.selectedIndex = InstanceZonesDataManager.GetStarCountHistory(_storyLevelCfgs[_index].id);
- item.target.data = _index;// _storyLevelCfgs[_index];
- UI_ListLevel.ProxyEnd();
- }
- private void OnListItemClick(EventContext context)
- {
- GObject obj = context.data as GObject;
- int index = (int)obj.data;
- StoryLevelCfg storyLevelCfg = _storyLevelCfgs[index];
- if (index > 0 && !InstanceZonesDataManager.CheckLevelPass(_storyLevelCfgs[index - 1].id))
- {
- PromptController.Instance.ShowFloatTextPrompt("需通关前置关卡");
- return;
- }
- MainStoryDataManager.currentLevelCfgId = storyLevelCfg.id;
- InstanceZonesController.ShowLevelView(storyLevelCfg.id, StudioDataManager.Instance.OnFinishFilingStoryLevel);
- }
- private void OnBtnChangeClick()
- {
- }
- private void OnBtnRewardClick()
- {
- }
- private void OnBtnAddClick()
- {
- }
- private void OnBtnSuitClick()
- {
- }
- }
- }
|