Beispiel #1
0
    void OnGUI()
    {
        if (!IsConstellationSelected())
        {
            StartPanel.Draw(this);
            return;
        }
        else
        {
            try
            {
                TopBarPanel.Draw(this, this, this);
                var constellationName = NodeTabPanel.Draw(ScriptDataService.OpenedScripts.ToArray());
                if (constellationName != null)
                {
                    var selectedGameObjects = Selection.gameObjects;
                    if (Application.isPlaying)
                    {
                        ScriptDataService.CloseCurrentConstellationInstance();
                        Open(ScriptDataService.OpenedScripts.ToArray()[0]);
                        previousSelectedGameObject = selectedGameObjects[0];
                    }
                    Open(constellationName);
                }
                var constellationToRemove = NodeTabPanel.ConstellationToRemove();
                EditorGUILayout.BeginHorizontal();
                if (NodeWindow == null)
                {
                    ParseScript();
                }
                NodeWindow.UpdateSize(position.width - nodeSelectorWidth - splitThickness, position.height - NodeTabPanel.GetHeight());
                NodeWindow.Draw(RequestRepaint, OnEditorEvent, ScriptDataService.GetConstellationEditorConfig(), out nodeWindowSize, out nodeWindowScrollPosition);
                DrawVerticalSplit();
                NodeSelector.Draw(nodeSelectorWidth, position.height, NodeAdded, ScriptDataService.Script.CanChangeType);
                EditorGUILayout.EndHorizontal();
                if (ScriptDataService.CloseOpenedConstellation(constellationToRemove))
                {
                    if (ScriptDataService.OpenedScripts.Count > 0)
                    {
                        Open(ScriptDataService.OpenedScripts[0]);
                    }
                    else
                    {
                        ScriptDataService.Script = null;
                    }
                }
                DrawInstancePannel();
            }
            catch (System.Exception exception)
            {
                UnexpectedError(exception.StackTrace);
            }
        }

        if (requestRepaint)
        {
            Repaint();
        }
    }
 void OnGUI()
 {
     if (!IsConstellationSelected())
     {
         StartPanel.Draw(this);
         return;
     }
     else
     {
         TopBarPanel.Draw(this, this, this, this);
         var constellationName = NodeTabPanel.Draw(ScriptDataService.currentPath.ToArray(), null);
         if (constellationName != null)
         {
             Open(constellationName);
         }
         var constellationToRemove = NodeTabPanel.ConstellationToRemove();
         EditorGUILayout.BeginHorizontal();
         if (NodeWindow == null)
         {
             ParseScript();
         }
         NodeWindow.UpdateSize(position.width - nodeSelectorWidth - splitThickness, position.height - NodeTabPanel.GetHeight());
         NodeWindow.Draw(RequestRepaint, OnEditorEvent);
         DrawVerticalSplit();
         NodeSelector.Draw(nodeSelectorWidth, position.height, NodeAdded);
         EditorGUILayout.EndHorizontal();
         if (ScriptDataService.CloseOpenedConstellation(constellationToRemove))
         {
             if (ScriptDataService.currentPath.Count > 0)
             {
                 Open(ScriptDataService.currentPath[0]);
             }
         }
         DrawInstancePannel();
     }
 }