StudioPropertyView.cs 1.7 KB

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