habeebweeb 4 rokov pred
rodič
commit
4387fd7274

+ 39 - 0
COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/GUI/Controls/Modal.cs

@@ -0,0 +1,39 @@
+using UnityEngine;
+
+namespace COM3D2.MeidoPhotoStudio.Plugin
+{
+    internal static class Modal
+    {
+        private static BaseWindow currentModal;
+        public static bool Visible
+        {
+            get => currentModal?.Visible ?? false;
+            set
+            {
+                if (currentModal == null) return;
+                currentModal.Visible = value;
+            }
+        }
+
+        public static void Show(BaseWindow modalWindow)
+        {
+            if (currentModal != null) Close();
+            currentModal = modalWindow;
+            Visible = true;
+        }
+
+        public static void Close()
+        {
+            Visible = false;
+            currentModal = null;
+        }
+
+        public static void Draw()
+        {
+            GUIStyle windowStyle = new GUIStyle(GUI.skin.box);
+            currentModal.WindowRect = GUI.ModalWindow(
+                currentModal.windowID, currentModal.WindowRect, currentModal.GUIFunc, "", windowStyle
+            );
+        }
+    }
+}

+ 3 - 0
COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/MeidoPhotoStudio.cs

@@ -299,6 +299,7 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
                 windowManager.DrawWindows();
 
                 if (DropdownHelper.Visible) DropdownHelper.HandleDropdown();
+                if (Modal.Visible) Modal.Draw();
             }
         }
 
@@ -378,6 +379,8 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
             messageWindowManager.Deactivate();
             windowManager.Deactivate();
 
+            Modal.Close();
+
             GameObject dailyPanel = GameObject.Find("UI Root")?.transform.Find("DailyPanel")?.gameObject;
             dailyPanel?.SetActive(true);
         }