예제 #1
0
 /// <summary>
 /// Shows the window.
 /// </summary>
 public static void Show()
 {
     if (instance == null)
     {
         instance = new ConfirmImportInProgressWindow();
         instance.BuildGUI();
     }
 }
예제 #2
0
        /// <summary>
        /// Hides the window.
        /// </summary>
        public static void Hide()
        {
            if (instance != null)
            {
                instance.Close();
            }

            instance = null;
        }
예제 #3
0
        /// <summary>
        /// Called 60 times per second by the runtime.
        /// </summary>
        static void OnEditorUpdate()
        {
            if (delayQuit && !ProjectLibrary.ImportInProgress)
            {
                ConfirmImportInProgressWindow.Hide();

                EditorApplication.SaveProject();
                EditorApplication.Quit();

                delayQuit = false;
            }

            app.OnEditorUpdate();
        }
예제 #4
0
        /// <summary>
        /// Called when the user requests that the editor shuts down. You must manually close the editor from this
        /// method if you choose to accept the users request.
        /// </summary>
        static void OnEditorQuitRequested()
        {
            if (delayQuit)
            {
                return;
            }

            EditorApplication.AskToSaveSceneAndContinue(
                () =>
            {
                if (ProjectLibrary.ImportInProgress)
                {
                    ConfirmImportInProgressWindow.Show();
                    delayQuit = true;
                }
                else
                {
                    EditorApplication.SaveProject();
                    EditorApplication.Quit();
                }
            });
        }
예제 #5
0
        /// <summary>
        /// Attempts to unload the currently loaded project. Offers the user a chance to save the current scene if it is
        /// modified. Automatically saves all project data before unloading.
        /// </summary>
        /// <param name="onDone">Callback to trigger when project project unload is done.</param>
        private static void TryUnloadProject(Action onDone)
        {
            if (delayUnloadProject)
            {
                return;
            }

            AskToSaveSceneAndContinue(
                () =>
            {
                if (ProjectLibrary.ImportInProgress)
                {
                    ConfirmImportInProgressWindow.Show();
                    delayUnloadCallback = onDone;
                    delayUnloadProject  = true;
                }
                else
                {
                    UnloadProject();
                    onDone?.Invoke();
                }
            });
        }