TabsPane.cs 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. using System;
  2. using UnityEngine;
  3. namespace COM3D2.MeidoPhotoStudio.Plugin
  4. {
  5. public class TabsPane : BasePane
  6. {
  7. private static SelectionGrid Tabs;
  8. private static Constants.Window selectedTab;
  9. public static Constants.Window SelectedTab
  10. {
  11. get => selectedTab;
  12. set => Tabs.SelectedItem = (int)value;
  13. }
  14. public static event EventHandler TabChange;
  15. static TabsPane()
  16. {
  17. string[] tabs = { "Call", "Pose", "Face", "BG", "BG2" };
  18. Tabs = new SelectionGrid(tabs, tabs.Length);
  19. Tabs.ControlEvent += (s, a) => OnChangeTab();
  20. }
  21. private static void OnChangeTab()
  22. {
  23. selectedTab = (Constants.Window)Tabs.SelectedItem;
  24. TabChange?.Invoke(null, EventArgs.Empty);
  25. }
  26. public static void Draw()
  27. {
  28. GUIStyle tabStyle = new GUIStyle(GUI.skin.toggle);
  29. tabStyle.padding.right = -6;
  30. Tabs.Draw(tabStyle, GUILayout.ExpandWidth(false));
  31. MiscGUI.BlackLine();
  32. }
  33. }
  34. }