using System.Collections.Generic; using FairyGUI; using UI.Studio; namespace GFGGame { //织物副本 public class StudioFabricView : StudioBaseView { private int _time = 0; public override void Dispose() { base.Dispose(); } protected override void OnInit() { base.OnInit(); packageName = UI_StudioEctypeUI.PACKAGE_NAME; _ui.m_btnBack.onClick.Add(OnClickBtnBack); } protected override void OnShown() { GComponent com = UIPackage.CreateObject(UI_StudioUI.PACKAGE_NAME, "ComFabric").asCom; AddChildCom(com); StudioDataManager.Instance.VIEW_NAME = typeof(StudioFabricView).FullName; this._studioCfg = StudioCfgArray.Instance.GetCfgsByfunId(typeof(StudioFabricView).Name)[0]; this.storyLevelCfgs = StoryLevelCfgArray.Instance.GetCfgsBytypeAndsubTypeAndchapterId(this._studioCfg.type, this._studioCfg.subType, this._studioCfg.id); list.numItems = this.storyLevelCfgs.Count; list.ScrollToView(curIndex); base.OnShown(); //add by zyq for (int i = 0; i < list.numChildren; i++) { list.GetChildAt(i).visible = false; } _time = 0; Timers.inst.Add(0.2f, list.numChildren, OnTimerUpdate, 1); } protected override void OnHide() { base.OnHide(); Timers.inst.Remove(OnTimerUpdate); } private void OnClickBtnBack() { ViewManager.GoBackFrom(typeof(StudioFabricView).FullName); } private void OnTimerUpdate(object param) { list.GetChildAt(_time).visible = true; UI_ListItem listItem = UI_ListItem.Proxy(list.GetChildAt(_time++)); //播放动效 listItem.m_test.Play(); UI_ListItem.ProxyEnd(); } } }