AboutMenu.cs 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. // Magica Cloth.
  2. // Copyright (c) MagicaSoft, 2020-2022.
  3. // https://magicasoft.jp
  4. using UnityEditor;
  5. using UnityEngine;
  6. namespace MagicaCloth
  7. {
  8. /// <summary>
  9. /// Aboutダイアログ
  10. /// </summary>
  11. public class AboutMenu : EditorWindow
  12. {
  13. [SerializeField]
  14. private Texture2D image = null;
  15. public const string MagicaClothVersion = "1.12.3";
  16. public static AboutMenu AboutWindow { get; set; }
  17. private const float windowWidth = 300;
  18. private const float windowHeight = 200;
  19. private const string webUrl = "https://magicasoft.jp";
  20. //=========================================================================================
  21. [MenuItem("Tools/Magica Cloth/About", false)]
  22. static void InitWindow()
  23. {
  24. if (AboutWindow)
  25. return;
  26. AboutWindow = CreateInstance<AboutMenu>();
  27. AboutWindow.position = new Rect(Screen.width / 2, Screen.height / 2, windowWidth, windowHeight);
  28. AboutWindow.minSize = new Vector2(windowWidth, windowHeight);
  29. AboutWindow.maxSize = new Vector2(windowWidth, windowHeight);
  30. AboutWindow.titleContent.text = "About Magica Cloth";
  31. AboutWindow.ShowUtility();
  32. }
  33. //=========================================================================================
  34. private void Awake()
  35. {
  36. }
  37. private void OnEnable()
  38. {
  39. }
  40. private void OnDisable()
  41. {
  42. }
  43. private void OnDestroy()
  44. {
  45. }
  46. private void OnGUI()
  47. {
  48. EditorGUILayout.Space();
  49. EditorGUILayout.Space();
  50. EditorGUILayout.Space();
  51. GUIStyle myStyle = new GUIStyle();
  52. myStyle.alignment = TextAnchor.MiddleCenter;
  53. myStyle.fontSize = 20;
  54. myStyle.normal.textColor = Color.white;
  55. GUILayout.Box(image, myStyle);
  56. EditorGUILayout.Space();
  57. EditorGUILayout.LabelField("Magica Cloth " + MagicaClothVersion, myStyle);
  58. EditorGUILayout.Space();
  59. EditorGUILayout.Space();
  60. EditorGUILayout.Space();
  61. myStyle.fontSize = 12;
  62. EditorGUILayout.LabelField("Copyright © 2020-2022 Magica Soft", myStyle);
  63. EditorGUILayout.LabelField("All Rights Reserved", myStyle);
  64. EditorGUILayout.LabelField(webUrl, myStyle);
  65. EditorGUILayout.Space();
  66. EditorGUILayout.Space();
  67. using (var h = new EditorGUILayout.HorizontalScope())
  68. {
  69. EditorGUILayout.Space();
  70. if (GUILayout.Button("Website"))
  71. {
  72. Application.OpenURL(webUrl);
  73. }
  74. EditorGUILayout.Space();
  75. if (GUILayout.Button("Close"))
  76. {
  77. Close();
  78. }
  79. EditorGUILayout.Space();
  80. }
  81. }
  82. private void OnInspectorUpdate()
  83. {
  84. Repaint();
  85. }
  86. }
  87. }