StudioPropertyView.cs 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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. _ui.m_c1.selectedIndex = 1;
  24. _ui.m_listProperty.numItems = StudioCfgArray.Instance.GetCfgs(typeof(StudioPropertyView).Name).Length;
  25. _ui.m_listProperty.selectedIndex = 0;
  26. this.studioCfg = StudioCfgArray.Instance.GetCfgs(typeof(StudioPropertyView).Name)[0];
  27. base.OnShown();
  28. }
  29. protected override void OnHide()
  30. {
  31. base.OnHide();
  32. }
  33. private void OnClickBtnBack()
  34. {
  35. ViewManager.GoBackFrom(typeof(StudioPropertyView).FullName);
  36. }
  37. private void ListPropertyItemRender(int index, GObject obj)
  38. {
  39. GButton item = obj.asButton;
  40. item.data = StudioCfgArray.Instance.GetCfgs(typeof(StudioPropertyView).Name)[index];
  41. }
  42. private void OnClickListProperty(EventContext context)
  43. {
  44. GButton item = (context.data as GObject).asButton;
  45. this.studioCfg = item.data as StudioCfg;
  46. this.storyLevelCfgs = StoryLevelCfgArray.Instance.GetCfgs(this.studioCfg.type, this.studioCfg.subType, this.studioCfg.id);
  47. _ui.m_list.numItems = this.storyLevelCfgs.Length;
  48. }
  49. }
  50. }