示例#1
0
        public void DrawHeader(HelpClicked onHelpClicked)
        {
            var width = Rect.width - 10;

            if (selected)
            {
                var color = GUI.color;
                width -= ButtonSize * 2 + 7;

                //Light gray color for close button
                GUI.color = new Color(0.8f, 0.8f, 0.8f);
                UnityEngine.GUI.Box(new Rect(Rect.width - (ButtonSize + 2), 1, ButtonSize, ButtonSize), "", nodeConfig.RoundButton);
                if (GUI.Button(new Rect(Rect.width - (ButtonSize + 1), 1, ButtonSize - 2, ButtonSize), "", nodeConfig.CloseButton) && Event.current.button == 0)
                {
                    DestroyNode();
                }

                GUI.color = color;
                if (GUI.Button(new Rect(Rect.width - (ButtonSize * 2 + 5), 1, ButtonSize, ButtonSize), "", nodeConfig.HelpStyle) && Event.current.button == 0)
                {
                    onHelpClicked(node.Name);
                }
            }
            if (node.OverrideDisplayedName.Length == 0)
            {
                GUI.Label(new Rect(10, 0, width, 16), node.Name, nodeConfig.HeaderLabel);
            }
            else
            {
                GUI.Label(new Rect(10, 0, width, 16), node.OverrideDisplayedName, nodeConfig.HeaderLabel);
            }
        }
示例#2
0
 private void Help_Executed(object sender, ExecutedRoutedEventArgs e)
 {
     if (HelpClicked != null)
     {
         HelpClicked.Invoke();
     }
 }
示例#3
0
        public void DrawHeader(HelpClicked onHelpClicked)
        {
            var width = Rect.width - 10;

            if (selected)
            {
                var color = GUI.color;
                width -= ButtonSize * 2 + 7;

                //Light gray color for close button
                GUI.color = new Color(0.8f, 0.8f, 0.8f);
                UnityEngine.GUI.Box(new Rect(Rect.width - (ButtonSize + 2), 1, ButtonSize, ButtonSize), "", UnityEngine.GUI.skin.GetStyle("sv_label_0"));
                if (GUI.Button(new Rect(Rect.width - (ButtonSize + 1), 1, ButtonSize - 2, ButtonSize), "", UnityEngine.GUI.skin.GetStyle("WinBtnClose")) && Event.current.button == 0)
                {
                    DestroyNode();
                }

                GUI.color = color;
                if (GUI.Button(new Rect(Rect.width - (ButtonSize * 2 + 5), 1, ButtonSize, ButtonSize), "", nodeConfig.HelpStyle) && Event.current.button == 0)
                {
                    onHelpClicked(node.Name);
                }
            }

            GUI.Label(new Rect(10, 0, width, 16), node.Name, UnityEngine.GUI.skin.GetStyle("MiniLabel"));
        }
示例#4
0
 public NodeEditorNodes(EditorWindow _editorWindow,
                        NodeConfig _nodeConfig,
                        ConstellationScript _constellationScript,
                        IUndoable _undoable,
                        NodeEditorSelection _nodeEditorSelection,
                        ILinkEditor _linkEditor,
                        IGUI _gui,
                        IVisibleObject _visibleObject,
                        NodeAdded _nodeAdded,
                        NodeRemoved _nodeRemoved,
                        HelpClicked _helpClicked)
 {
     linkEditor          = _linkEditor;
     editorWindow        = _editorWindow;
     Nodes               = new List <NodeView> ();
     nodeConfig          = _nodeConfig;
     constellationScript = _constellationScript;
     isInstance          = constellationScript.IsInstance;
     nodesFactory        = new NodesFactory();
     undoable            = _undoable;
     nodeEditorSelection = _nodeEditorSelection;
     GUI            = _gui;
     visibleObject  = _visibleObject;
     OnNodeAdded   += _nodeAdded;
     OnNodeRemoved += _nodeRemoved;
     OnHelpClicked += _helpClicked;
     SetNodes();
 }
示例#5
0
        private void Draw(HelpClicked _onHelpClicked)
        {
            DrawAttributes();
            DrawInputs();
            DrawOutputs();
            DrawHeader(_onHelpClicked);

            if (DrawDescription)
            {
                DrawHelp(Description);
            }
        }
示例#6
0
        public void DrawContent(HelpClicked _onHelpClicked)
        {
            var current = Event.current;

            //Only draw node on Repaint if it's not selected
            if (current.IsRepaint())
            {
                Draw(_onHelpClicked);
            }

            //Draw on multiple events for buttons to work
            if (selected && !current.IsRepaint())
            {
                Draw(_onHelpClicked);
            }
        }
示例#7
0
        public NodeEditorPanel(IGUI _gui,
                               EditorWindow _editorWindow,
                               ConstellationScript _script,
                               IUndoable _undoable,
                               ClipBoard _editorClipBoard,
                               float positionX,
                               float positionY,
                               LinkAdded linkAdded,
                               LinkRemoved onLinkRemoved,
                               NodeAdded nodeAdded,
                               NodeRemoved nodeRemoved,
                               HelpClicked onHelpClicked,
                               ApplyInstanceChanges applyInstanceChanges)
        {
            isTutorial          = false;
            nodesFactory        = new NodesFactory();
            constellationScript = _script;
            undoable            = _undoable;
            Nodes            = new List <NodeView> ();
            GUI              = _gui;
            EditorWindow     = _editorWindow;
            editorScrollSize = new Vector2(500, 500);
            Background       = AssetDatabase.LoadAssetAtPath(editorPath + "background.png", typeof(Texture2D)) as Texture2D;
            var allNodes = NodesFactory.GetAllNodes();

            nodes           = new string[allNodes.Length];
            editorScrollPos = new Vector2(positionX, positionY);

            for (var i = 0; i < allNodes.Length; i++)
            {
                nodes[i] = allNodes[i];
            }
            OnLinkAdded            += linkAdded;
            OnNodeAdded            += nodeAdded;
            OnNodeRemoved          += nodeRemoved;
            OnApplyInstanceChanges += applyInstanceChanges;
            OnHelpClicked          += onHelpClicked;
            OnLinkRemoved          += onLinkRemoved;
            nodeEditorSelection     = new NodeEditorSelection(GUI, _editorClipBoard);
        }
示例#8
0
 /// <summary>
 /// Raises the <see cref="HelpClicked"/> event.
 /// </summary>
 protected virtual void OnHelpClicked()
 {
     HelpClicked?.Invoke(this, EventArgs.Empty);
 }
示例#9
0
 private void ToolStripButtonHelp_Click(object sender, EventArgs e)
 {
     HelpClicked.Invoke(this, EventArgs.Empty);
 }