StudioPropertyView.cs 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. using System.Collections.Generic;
  2. using FairyGUI;
  3. using UI.Studio;
  4. using UnityEngine;
  5. namespace GFGGame
  6. {
  7. public class StudioPropertyView : StudioBaseView
  8. {
  9. //书画副本
  10. public override void Dispose()
  11. {
  12. base.Dispose();
  13. }
  14. protected override void OnInit()
  15. {
  16. base.OnInit();
  17. _ui.m_btnBack.onClick.Add(OnClickBtnBack);
  18. _ui.m_listProperty.itemRenderer = ListPropertyItemRender;
  19. _ui.m_listProperty.onClickItem.Add(OnClickListProperty);
  20. }
  21. protected override void OnShown()
  22. {
  23. StudioCfg[] studioCfgs = StudioCfgArray.Instance.GetCfgs(typeof(StudioPropertyView).Name);
  24. this.studioCfg = studioCfgs[0];
  25. this.studioData = StudioDataManager.Instance.GetStudioDataById(this.studioCfg.id);
  26. this.storyLevelCfgs = StoryLevelCfgArray.Instance.GetCfgs(this.studioCfg.type, this.studioCfg.subType, this.studioCfg.id);
  27. _ui.m_c1.selectedIndex = 1;
  28. _ui.m_listProperty.numItems = studioCfgs.Length;
  29. _ui.m_listProperty.selectedIndex = 0;
  30. _ui.m_list.numItems = this.storyLevelCfgs.Length;
  31. base.OnShown();
  32. }
  33. protected override void OnHide()
  34. {
  35. base.OnHide();
  36. }
  37. private void OnClickBtnBack()
  38. {
  39. ViewManager.GoBackFrom(typeof(StudioPropertyView).FullName);
  40. }
  41. private void ListPropertyItemRender(int index, GObject obj)
  42. {
  43. GButton item = obj.asButton;
  44. item.data = StudioCfgArray.Instance.GetCfgs(typeof(StudioPropertyView).Name)[index];
  45. }
  46. private void OnClickListProperty(EventContext context)
  47. {
  48. GButton item = (context.data as GObject).asButton;
  49. this.studioCfg = item.data as StudioCfg;
  50. this.studioData = StudioDataManager.Instance.GetStudioDataById(this.studioCfg.id);
  51. this.storyLevelCfgs = StoryLevelCfgArray.Instance.GetCfgs(this.studioCfg.type, this.studioCfg.subType, this.studioCfg.id);
  52. _ui.m_list.numItems = this.storyLevelCfgs.Length;
  53. }
  54. }
  55. }