Beispiel #1
0
        void Update()
        {
            if (Application.isPlaying)
            {
                RequestRepaint();
                if (nodeEditorPanel != null && previousSelectedGameObject != null)
                {
                    nodeEditorPanel.Update(currentConstellation.Constellation);
                }

                var selectedGameObjects = Selection.gameObjects;
                if (selectedGameObjects.Length == 0 || selectedGameObjects[0] == previousSelectedGameObject)
                {
                    return;
                }

                var selectedConstellation = selectedGameObjects[0].GetComponent <ConstellationBehaviour> () as ConstellationBehaviour;
                if (selectedConstellation != null)
                {
                    currentConstellation       = selectedConstellation;
                    previousSelectedGameObject = selectedGameObjects[0];
                    Open(AssetDatabase.GetAssetPath(selectedConstellation.ConstellationData));
                }
            }
        }
Beispiel #2
0
        void Update()
        {
            try {
                if (Application.isPlaying && IsConstellationSelected())
                {
                    RequestRepaint();
                    if (nodeEditorPanel != null && previousSelectedGameObject != null && scriptDataService.GetCurrentScript().IsInstance)
                    {
                        nodeEditorPanel.Update(currentEditableConstellation.GetConstellation());
                    }

                    var selectedGameObjects = Selection.gameObjects;
                    if (selectedGameObjects.Length == 0 || selectedGameObjects[0] == previousSelectedGameObject || selectedGameObjects[0].activeInHierarchy == false)
                    {
                        return;
                    }
                    else if (scriptDataService.GetCurrentScript().IsInstance)
                    {
                        scriptDataService.CloseCurrentConstellationInstance();
                        previousSelectedGameObject = selectedGameObjects[0];
                        RequestSetup();
                    }

                    var selectedConstellation = selectedGameObjects[0].GetComponent <ConstellationEditable>() as ConstellationEditable;
                    if (selectedConstellation != null)
                    {
                        currentEditableConstellation = selectedConstellation;
                        previousSelectedGameObject   = selectedGameObjects[0];
                        OpenConstellationInstance(selectedConstellation.GetConstellation(), AssetDatabase.GetAssetPath(selectedConstellation.GetConstellationData()));
                        if (selectedConstellation.GetConstellation() == null)
                        {
                            return;
                        }
                        selectedConstellation.Initialize();
                    }

                    if (requestSetup == true)
                    {
                        Setup();
                        requestSetup = false;
                    }

                    if (requestCompilation == true)
                    {
                        CompileScripts();
                        requestCompilation = false;
                    }
                }
            } catch (ConstellationError e) {
                ShowError(e);
            } catch (Exception e) {
                var unknowError = new UnknowError(this.GetType().Name);
                ShowError(unknowError, e);
            }
        }