示例#1
0
        public static void UnloadGraph()
        {
            SelectionManager.ClearSelection();

            EditorConfig.editingGraph = null;
        }
示例#2
0
        void DrawOutline(Rect p_rect)
        {
            if (SelectionManager.IsSelected(Graph.Nodes.IndexOf(this)))
            {
                GUI.color = Color.green;
                GUI.Box(new Rect(p_rect.x - 2, p_rect.y - 2, p_rect.width + 4, p_rect.height + 4),
                    "",  DashEditorCore.Skin.GetStyle("NodeSelected"));
            }
                
            if (IsExecuting || executeTime > 0)
            {
                if (!IsExecuting)
                {
                    executeTime -= .2f;
                }
                GUI.color = Color.cyan;
                GUI.Box(new Rect(p_rect.x - 2, p_rect.y - 2, p_rect.width + 4, p_rect.height + 4),
                    "",  DashEditorCore.Skin.GetStyle("NodeSelected"));
            }
            
            if (SelectionManager.IsSelecting(Graph.Nodes.IndexOf(this)))
            {
                GUI.color = Color.yellow;
                GUI.Box(new Rect(p_rect.x - 2, p_rect.y - 2, p_rect.width + 4, p_rect.height + 4),
                    "",  DashEditorCore.Skin.GetStyle("NodeSelected"));
            }
                
            if (hasErrorsInExecution)
            {
                GUI.color = Color.red;
                GUI.Box(new Rect(p_rect.x - 2, p_rect.y - 2, p_rect.width + 4, p_rect.height + 4),
                    "",  DashEditorCore.Skin.GetStyle("NodeSelected"));
                GUI.DrawTexture(new Rect(p_rect.x + 2, p_rect.y - 22, 16, 16),
                    IconManager.GetIcon("error_icon"));
            }

            int labelOffset = 0;
            if (this is InputNode)
            {
                InputNode node = this as InputNode;
                if (DashEditorCore.EditorConfig.editingController != null &&
                    DashEditorCore.EditorConfig.editingController.autoStart &&
                    DashEditorCore.EditorConfig.editingController.autoStartInput == node.Model.inputName) 
                {
                    GUI.color = Color.white;
                    GUIStyle style = new GUIStyle();
                    style.normal.textColor = Color.green;
                    style.fontStyle = FontStyle.Bold;
                    style.fontSize = 20;
                    style.alignment = TextAnchor.UpperCenter;
                    GUI.Label(new Rect(p_rect.x, p_rect.y + rect.height, rect.width, 20), "[START]", style);
                    labelOffset++;
                }
            }
            
            if (this is InputNode)
            {
                InputNode node = this as InputNode;
                if (DashEditorCore.EditorConfig.editingController != null &&
                    DashEditorCore.EditorConfig.editingController.autoOnEnable &&
                    DashEditorCore.EditorConfig.editingController.autoOnEnableInput == node.Model.inputName) 
                {
                    GUI.color = Color.white;
                    GUIStyle style = new GUIStyle();
                    style.normal.textColor = Color.green;
                    style.fontStyle = FontStyle.Bold;
                    style.fontSize = 20;
                    style.alignment = TextAnchor.UpperCenter;
                    GUI.Label(new Rect(p_rect.x, p_rect.y + rect.height + labelOffset * 25, rect.width, 20), "[ONENABLE]", style);
                    labelOffset++;
                }
            }

            if (Graph.previewNode == this)
            {
                GUI.color = Color.white;
                GUIStyle style = new GUIStyle();
                style.normal.textColor = Color.magenta;
                style.fontStyle = FontStyle.Bold;
                style.fontSize = 20;
                style.alignment = TextAnchor.UpperCenter;
                GUI.Label(new Rect(p_rect.x, p_rect.y + rect.height + labelOffset * 25, rect.width, 20), "[PREVIEW]", style);
            }

            GUI.color = Color.white;
        }