habeebweeb 4 лет назад
Родитель
Сommit
8eb5bd71b4

+ 1 - 0
COM3D2.MeidoPhotoStudio.Plugin/Config/MeidoPhotoStudio/Translations/en/translation.ui.json

@@ -330,6 +330,7 @@
         "okButton": "OK"
     },
     "systemMessage": {
+        "exitConfirm": "Are you sure you want to quit {0}?\nAny unsaved data will be lost.",
         "initializing": "Initializing",
         "noMaids": "No Maids",
         "noProps": "No Props"

+ 33 - 16
COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/MeidoPhotoStudio.cs

@@ -375,23 +375,40 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
         {
             if (meidoManager.Busy || SceneManager.Busy) return;
 
-            ResetCalcNearClip();
-
-            uiActive = false;
-            active = false;
-
-            meidoManager.Deactivate();
-            environmentManager.Deactivate();
-            propManager.Deactivate();
-            lightManager.Deactivate();
-            effectManager.Deactivate();
-            messageWindowManager.Deactivate();
-            windowManager.Deactivate();
-
-            Modal.Close();
+            SystemDialog sysDialog = GameMain.Instance.SysDlg;
 
-            GameObject dailyPanel = GameObject.Find("UI Root")?.transform.Find("DailyPanel")?.gameObject;
-            dailyPanel?.SetActive(true);
+            if (sysDialog.IsDecided)
+            {
+                uiActive = false;
+                active = false;
+                string exitMessage = string.Format(Translation.Get("systemMessage", "exitConfirm"), pluginName);
+                sysDialog.Show(exitMessage, SystemDialog.TYPE.OK_CANCEL,
+                    f_dgOk: () =>
+                    {
+                        sysDialog.Close();
+                        ResetCalcNearClip();
+
+                        meidoManager.Deactivate();
+                        environmentManager.Deactivate();
+                        propManager.Deactivate();
+                        lightManager.Deactivate();
+                        effectManager.Deactivate();
+                        messageWindowManager.Deactivate();
+                        windowManager.Deactivate();
+
+                        Modal.Close();
+
+                        GameObject dailyPanel = GameObject.Find("UI Root")?.transform.Find("DailyPanel")?.gameObject;
+                        dailyPanel?.SetActive(true);
+                    },
+                    f_dgCancel: () =>
+                    {
+                        sysDialog.Close();
+                        uiActive = true;
+                        active = true;
+                    }
+                );
+            }
         }
 
         private void SetNearClipPlane()