示例#1
0
        public void Recover()
        {
            try
            {
                scriptDataService     = new ConstellationEditorDataService();
                ConstellationCompiler = new ConstellationCompiler();
                scriptDataService.RefreshConstellationEditorDataList();

                if (scriptDataService.OpenEditorData().LastOpenedConstellationPath == null)
                {
                    return;
                }

                if (scriptDataService.OpenEditorData().LastOpenedConstellationPath.Count != 0)
                {
                    var scriptData = scriptDataService.Recover(scriptDataService.OpenEditorData().LastOpenedConstellationPath[0]);
                    if (scriptData != null)
                    {
                        Setup();
                        return;
                    }
                }
            }
            catch (ConstellationError e)
            {
                ShowError(e, e);
            }
            catch (Exception e)
            {
                var formatedError = new UnknowError(this.GetType().Name);
                ShowError(formatedError, e);
            }
        }
示例#2
0
        protected override void Setup()
        {
            wantsMouseMove            = true;
            canDrawUI                 = false;
            WindowInstance            = this as ConstellationUnityWindow;
            SceneManager.sceneLoaded += OnSceneLoaded;
            EditorApplication.playModeStateChanged += OnPlayStateChanged;
            scriptDataService     = new ConstellationEditorDataService();
            ConstellationCompiler = new ConstellationCompiler();
            scriptDataService.RefreshConstellationEditorDataList();

            if (scriptDataService.OpenEditorData().LastOpenedConstellationPath == null)
            {
                return;
            }

            if (scriptDataService.OpenEditorData().LastOpenedConstellationPath.Count != 0)
            {
                var scriptData = scriptDataService.Recover(scriptDataService.OpenEditorData().LastOpenedConstellationPath[0]);
            }
            RequestCompilation();
            if (scriptDataService != null)
            {
                nodeEditorPanel = new NodeEditorPanel(this,
                                                      this,
                                                      scriptDataService.GetCurrentScript(),
                                                      this,
                                                      scriptDataService.GetEditorData().clipBoard,
                                                      scriptDataService.GetLastEditorScrollPositionX(), scriptDataService.GetLastEditorScrollPositionY(), // Saved editor position
                                                      OnLinkAdded, OnLinkRemoved, OnNodeAdded, OnNodeRemoved, OnHelpRequested,                            // callBacks
                                                      SaveConstellationInstance,
                                                      scriptDataService.GetAllNestableScriptsInProject());
                nodeTabPanel = new ConstellationsTabPanel(this);
                if (scriptDataService.GetCurrentScript() != null)
                {
                    WindowInstance.titleContent.text = scriptDataService.GetCurrentScript().name;
                }
                else
                {
                    WindowInstance.titleContent.text = "Constellation";
                }
                scriptDataService.ClearActions();
            }
            nodeSelector = new NodeSelectorPanel(OnNodeAddRequested, scriptDataService.GetAllCustomNodesNames());
        }
        public void Recover()
        {
            scriptDataService     = new ConstellationEditorDataService();
            ConstellationCompiler = new ConstellationCompiler();
            if (scriptDataService.OpenEditorData().LastOpenedConstellationPath == null)
            {
                return;
            }

            if (scriptDataService.OpenEditorData().LastOpenedConstellationPath.Count != 0)
            {
                var scriptData = scriptDataService.Recover(scriptDataService.OpenEditorData().LastOpenedConstellationPath[0]);
                if (scriptData != null)
                {
                    Setup();
                    return;
                }
            }
        }