MiscGUI.cs 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. using System;
  2. using UnityEngine;
  3. namespace COM3D2.MeidoPhotoStudio.Plugin
  4. {
  5. public static class MiscGUI
  6. {
  7. private static GUIStyle lineStyleWhite;
  8. private static GUIStyle lineStyleBlack;
  9. private static GUIStyle textureBoxStyle;
  10. static MiscGUI()
  11. {
  12. lineStyleWhite = new GUIStyle(GUI.skin.box);
  13. lineStyleWhite.padding = lineStyleWhite.border = new RectOffset(0, 0, 1, 1);
  14. lineStyleWhite.margin = new RectOffset(0, 0, 8, 8);
  15. lineStyleWhite.normal.background = Utility.MakeTex(2, 2, new Color(1f, 1f, 1f, 0.2f));
  16. lineStyleBlack = new GUIStyle(lineStyleWhite);
  17. lineStyleBlack.normal.background = Utility.MakeTex(2, 2, new Color(0f, 0f, 0f, 0.3f));
  18. textureBoxStyle = new GUIStyle(GUI.skin.box);
  19. textureBoxStyle.normal.background = Utility.MakeTex(2, 2, new Color(0f, 0f, 0f, 0f));
  20. }
  21. private static void Line(GUIStyle style) => GUILayout.Box(GUIContent.none, style, GUILayout.Height(1));
  22. public static void WhiteLine() => Line(lineStyleWhite);
  23. public static void BlackLine() => Line(lineStyleBlack);
  24. public static void DrawTexture(Texture texture, params GUILayoutOption[] layoutOptions)
  25. {
  26. GUILayout.Box(texture, textureBoxStyle, layoutOptions);
  27. }
  28. public static void Header(string text, params GUILayoutOption[] layoutOptions)
  29. {
  30. GUIStyle style = new GUIStyle(GUI.skin.label);
  31. style.padding = new RectOffset(7, 0, 0, 0);
  32. GUILayout.Label(text, style, layoutOptions);
  33. }
  34. }
  35. }