StudioFabricView.cs 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. using System.Collections.Generic;
  2. using FairyGUI;
  3. using UI.Studio;
  4. namespace GFGGame
  5. {
  6. //织物副本
  7. public class StudioFabricView : StudioBaseView
  8. {
  9. private int _time = 0;
  10. public override void Dispose()
  11. {
  12. base.Dispose();
  13. }
  14. protected override void OnInit()
  15. {
  16. base.OnInit();
  17. packageName = UI_StudioEctypeUI.PACKAGE_NAME;
  18. _ui.m_btnBack.onClick.Add(OnClickBtnBack);
  19. }
  20. protected override void OnShown()
  21. {
  22. GComponent com = UIPackage.CreateObject(UI_StudioUI.PACKAGE_NAME, "ComFabric").asCom;
  23. AddChildCom(com);
  24. StudioDataManager.Instance.VIEW_NAME = typeof(StudioFabricView).FullName;
  25. this._studioCfg = StudioCfgArray.Instance.GetCfgsByfunId(typeof(StudioFabricView).Name)[0];
  26. this.storyLevelCfgs = StoryLevelCfgArray.Instance.GetCfgsBytypeAndsubTypeAndchapterId(this._studioCfg.type, this._studioCfg.subType, this._studioCfg.id);
  27. list.numItems = this.storyLevelCfgs.Count;
  28. list.ScrollToView(curIndex);
  29. base.OnShown();
  30. //add by zyq
  31. for (int i = 0; i < list.numChildren; i++)
  32. {
  33. list.GetChildAt(i).visible = false;
  34. }
  35. _time = 0;
  36. Timers.inst.Add(0.2f, list.numChildren, OnTimerUpdate, 1);
  37. }
  38. protected override void OnHide()
  39. {
  40. base.OnHide();
  41. Timers.inst.Remove(OnTimerUpdate);
  42. }
  43. private void OnClickBtnBack()
  44. {
  45. ViewManager.GoBackFrom(typeof(StudioFabricView).FullName);
  46. }
  47. private void OnTimerUpdate(object param)
  48. {
  49. list.GetChildAt(_time).visible = true;
  50. UI_ListItem listItem = UI_ListItem.Proxy(list.GetChildAt(_time++));
  51. //播放动效
  52. listItem.m_test.Play();
  53. UI_ListItem.ProxyEnd();
  54. }
  55. }
  56. }