Example #1
0
 protected override void Setup()
 {
     wantsMouseMove            = true;
     canDrawUI                 = false;
     WindowInstance            = this as ConstellationUnityWindow;
     SceneManager.sceneLoaded += OnSceneLoaded;
     EditorApplication.playModeStateChanged += OnPlayStateChanged;
     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);
         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);
 }
Example #2
0
 public static void ShowWindow()
 {
     CopyScriptIcons.Copy();
     WindowInstance = EditorWindow.GetWindow(typeof(ConstellationUnityWindow), false, "Constellation") as ConstellationUnityWindow;
     WindowInstance.scriptDataService = new ConstellationEditorDataService();
     WindowInstance.RequestCompilation();
 }
Example #3
0
 public override void OnInspectorGUI()
 {
     if (GUILayout.Button("Open in Node Editor"))
     {
         if (ConstellationUnityWindow.WindowInstance == null)
         {
             ConstellationUnityWindow.ShowWindow();
         }
         ConstellationUnityWindow.WindowInstance.Open(AssetDatabase.GetAssetPath(target));
     }
     base.OnInspectorGUI();
 }
Example #4
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());
        }
Example #5
0
        static void OnPlayStateChanged(PlayModeStateChange state)
        {
            if (Application.isPlaying)
            {
                ConstellationUnityWindow.ShowWindow();
                WindowInstance.Recover();
                WindowInstance.CompileScripts();
            }

            WindowInstance.Recover();
            WindowInstance.previousSelectedGameObject = null;
            WindowInstance.ResetInstances();
            if (WindowInstance.scriptDataService.GetEditorData().ExampleData.openExampleConstellation&& state == PlayModeStateChange.EnteredPlayMode)
            {
                var nodeExampleLoader = new ExampleSceneLoader();
                nodeExampleLoader.RunExample(WindowInstance.scriptDataService.GetEditorData().ExampleData.constellationName, WindowInstance.scriptDataService);
                WindowInstance.scriptDataService.GetEditorData().ExampleData.openExampleConstellation = false;
            }

            EditorApplication.playModeStateChanged -= OnPlayStateChanged;
            WindowInstance.Repaint();
        }
Example #6
0
 public static void ShowWindow()
 {
     CopyScriptIcons.Copy();
     WindowInstance = EditorWindow.GetWindow(typeof(ConstellationUnityWindow), false, "Constellation") as ConstellationUnityWindow;
 }
Example #7
0
 void OnDestroy()
 {
     WindowInstance = null;
     EditorApplication.playModeStateChanged -= OnPlayStateChanged;
     SceneManager.sceneLoaded -= OnSceneLoaded;
 }
Example #8
0
 public static void ShowWindow()
 {
     WindowInstance = EditorWindow.GetWindow(typeof(ConstellationUnityWindow), false, "Constellation") as ConstellationUnityWindow;
 }