示例#1
0
        internal void Exit()
        {
            Log("Editor exit");

            // Start exit
            StateMachine.GoToState <ClosingState>();

            Scene.ClearRefsToSceneObjects();

            // Release modules (from back to front)
            for (int i = _modules.Count - 1; i >= 0; i--)
            {
                _modules[i].OnExit();
            }

            // Cleanup
            Undo.Dispose();
            Instance = null;

            ScriptsBuilder.ScriptsReloadBegin -= ScriptsBuilder_ScriptsReloadBegin;
            ScriptsBuilder.ScriptsReloadEnd   -= ScriptsBuilder_ScriptsReloadEnd;

            // Invoke new instance if need to open a project
            if (!string.IsNullOrEmpty(_projectToOpen))
            {
                string editorExePath = Globals.StartupPath + "/Win64/FlaxEditor.exe";
                string args          = string.Format("-project \"{0}\"", _projectToOpen);
                _projectToOpen = null;
                Application.StartProcess(editorExePath, args);
            }
        }
示例#2
0
        internal void Exit()
        {
            Log("Editor exit");

            // Start exit
            StateMachine.GoToState <ClosingState>();

            // Cache last opened scene
            {
                var lastSceneId    = SceneManager.ScenesCount > 0 ? SceneManager.Scenes[0].ID : Guid.Empty;
                var lastSceneSpawn = Windows.EditWin.Viewport.ViewRay;
                ProjectCache.SetCustomData(ProjectDataLastScene, lastSceneId.ToString());
                ProjectCache.SetCustomData(ProjectDataLastSceneSpawn, JsonSerializer.Serialize(lastSceneSpawn));
            }

            // Cleanup
            Scene.ClearRefsToSceneObjects(true);

            // Release modules (from back to front)
            for (int i = _modules.Count - 1; i >= 0; i--)
            {
                _modules[i].OnExit();
            }

            // Cleanup
            Undo.Dispose();
            Instance = null;

            ScriptsBuilder.ScriptsReloadBegin -= ScriptsBuilder_ScriptsReloadBegin;
            ScriptsBuilder.ScriptsReloadEnd   -= ScriptsBuilder_ScriptsReloadEnd;

            // Invoke new instance if need to open a project
            if (!string.IsNullOrEmpty(_projectToOpen))
            {
                string editorExePath = Globals.StartupPath + "/Win64/FlaxEditor.exe";
                string args          = string.Format("-project \"{0}\"", _projectToOpen);
                _projectToOpen = null;
                Platform.StartProcess(editorExePath, args);
            }
        }
示例#3
0
文件: Editor.cs 项目: djlw78/FlaxAPI
        internal void Exit()
        {
            Log("Editor exit");

            // Start exit
            StateMachine.GoToState <ClosingState>();

            Scene.ClearRefsToSceneObjects();

            // Release modules (from back to front)
            for (int i = _modules.Count - 1; i >= 0; i--)
            {
                _modules[i].OnExit();
            }

            // Cleanup
            Undo.Dispose();
            Instance = null;

            ScriptsBuilder.ScriptsReloadBegin -= ScriptsBuilder_ScriptsReloadBegin;
            ScriptsBuilder.ScriptsReloadEnd   -= ScriptsBuilder_ScriptsReloadEnd;
        }