Esempio n. 1
0
        private void InitializeContextMenus()
        {
            ConnectNodeInputMode nodeConnector = NodeEditor.GetInputMode <ConnectNodeInputMode>();

            nodeContextMenu = new GUIGenericMenu();

            if (EditorApplication.isPlaying)
            {
                nodeContextMenu.AddMenuItem(string.Empty, "Load Scene", LoadScene);
                nodeContextMenu.AddSeparator();
            }
            else
            {
                nodeContextMenu.AddMenuItem(string.Empty, "Load Scene", LoadSceneInEditor, OpenSceneMode.Single);
                nodeContextMenu.AddMenuItem(string.Empty, "Load Scene Additive", LoadSceneInEditor, OpenSceneMode.Additive);
                nodeContextMenu.AddSeparator();
            }

            nodeContextMenu.AddMenuItem(string.Empty,
                                        "Make Transition", nodeConnector.Activate);
            nodeContextMenu.AddMenuItem(string.Empty, "Set as Entry", SetAsEntryNode);
            nodeContextMenu.AddSeparator();
            nodeContextMenu.AddMenuItem(string.Empty, "Delete", DeleteEditorComponent, false);
            nodeContextMenu.AddMenuItem(string.Empty, "Delete and Exclude Scene", DeleteEditorComponent, true);

            connectorContextMenu = new GUIGenericMenu();
            connectorContextMenu.AddMenuItem(string.Empty, "Delete", DeleteEditorComponent);
        }
Esempio n. 2
0
    private void OnGUI()
    {
        if (nodeEditor == null)
        {
            GUIGenericMenu nodeMenu = new GUIGenericMenu();

            nodeMenu.AddMenuItem("Make Transition", StartConnection);
            nodeMenu.AddMenuItem("Create Node", CreateNewNode);
            nodeMenu.AddMenuItem("Create/Items/", "Node");
            nodeMenu.AddMenuItem("Delete Node", Delete);

            nodeEditor = new NodeEditor();
            nodeEditor.EnableBoxSelect();
            nodeEditor.EnableNodeSelect();
            nodeEditor.EnableConnectorSelect();
            nodeEditor.EnableNodeDrag();
            nodeEditor.EnableNodeRightClick();
            nodeEditor.EnableConnectorRightClick();
            nodeEditor.EnableInputMode <ConnectorMakerMode>(2);

            connectorMode = new ConnectNodeInputMode(nodeEditor, 2);
            nodeEditor.EnableInputMode(connectorMode);

            Node node1 = new TextNode(Vector2.zero, "Test", null, nodeMenu);
            Node node2 = new TextNode(Vector2.one * 50f, "Test 2", null, nodeMenu);

            GUIGenericMenu connectMenu = new GUIGenericMenu();
            connectMenu.AddMenuItem("Delete Connection", DeleteConnection);
            nodeEditor.AddNode(node1);
            nodeEditor.AddNode(node2);
            //nodeEditor.AddConnector(new Connector(connectMenu, node1, node2));
            // nodeEditor.AddConnector(new Connector(connectMenu, node1, nodeEditor.MouseNode));
        }

        if (nodeEditor.OnGUI(position.WithPosition(Vector2.zero)))
        {
            Repaint();
        }
    }