UI.cs 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. // Water Geometry Tools
  2. // Staggart Creations (http://staggart.xyz)
  3. // Copyright protected under Unity Asset Store EULA
  4. // Copying or referencing source code for the production of new asset store content is strictly prohibited.
  5. using System;
  6. using UnityEditor;
  7. using UnityEngine;
  8. namespace sc.modeling.water.common.editor
  9. {
  10. public class UI
  11. {
  12. public static void DrawActionBox(string message, MessageType messageType, string buttonLabel = "", Action action = null)
  13. {
  14. EditorGUILayout.HelpBox(message, messageType);
  15. GUILayout.Space(-32);
  16. using (new EditorGUILayout.HorizontalScope())
  17. {
  18. GUILayout.FlexibleSpace();
  19. GUIContent content = new GUIContent(buttonLabel, EditorGUIUtility.IconContent("d_tab_next").image);
  20. if (GUILayout.Button(content, GUILayout.Width(EditorStyles.miniButton.CalcSize(content).x)))
  21. {
  22. action.Invoke();
  23. }
  24. GUILayout.Space(8);
  25. }
  26. GUILayout.Space(11);
  27. }
  28. public static void OpenStorePage(int id, string pubref)
  29. {
  30. Application.OpenURL($"https://assetstore.unity.com/packages/slug/{id}?id=1011l7Uk8&pubref={pubref}");
  31. }
  32. public static void DrawHeader(string assetName, string version)
  33. {
  34. EditorGUILayout.LabelField($"{assetName} (version {version})", EditorStyles.centeredGreyMiniLabel);
  35. EditorGUILayout.Space();
  36. }
  37. public static void DrawFooter()
  38. {
  39. EditorGUILayout.Space();
  40. EditorGUILayout.LabelField(new GUIContent("- Staggart Creations -"), EditorStyles.centeredGreyMiniLabel);
  41. }
  42. }
  43. }