BaseIconWindow.cs 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. using System;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using wf;
  5. namespace SceneEditWindow
  6. {
  7. public abstract class BaseIconWindow : BasePhotoWindow
  8. {
  9. public override void Awake()
  10. {
  11. base.Awake();
  12. this.tabPanel = this.itemGrit.GetComponent<UIWFTabPanel>();
  13. NDebug.AssertNull(this.tabPanel);
  14. List<int> list = this.CreateItemIdList();
  15. for (int i = 0; i < list.Count; i++)
  16. {
  17. UIWFTabButton uiwftabButton = this.CreateItemObject(this.itemGrit.gameObject, list[i]);
  18. uiwftabButton.name = list[i].ToString();
  19. this.tabButtonDic.Add(list[i], uiwftabButton);
  20. EventDelegate.Add(uiwftabButton.onSelect, delegate()
  21. {
  22. if (!UIWFSelectButton.selected)
  23. {
  24. return;
  25. }
  26. this.OnSelectItem(int.Parse(UIWFSelectButton.current.name));
  27. });
  28. }
  29. Utility.ResetNGUI(this.itemGrit);
  30. UIScrollBar componentInChildren = base.GetComponentInChildren<UIScrollBar>();
  31. Utility.ResetNGUI(componentInChildren);
  32. this.UpdateChildren();
  33. }
  34. protected abstract void OnSelectItem(int selectItemId);
  35. protected abstract UIWFTabButton CreateItemObject(GameObject parent, int createItemId);
  36. protected abstract List<int> CreateItemIdList();
  37. [SerializeField]
  38. public SceneEdit sceneEdit;
  39. [SerializeField]
  40. private UIGrid itemGrit;
  41. protected UIWFTabPanel tabPanel;
  42. protected Dictionary<int, UIWFTabButton> tabButtonDic = new Dictionary<int, UIWFTabButton>();
  43. }
  44. }