StudioPropertyView.cs 2.6 KB

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