Exemple #1
0
        private void EditNode()
        {
            var viewModel = new NodeEditorViewModel(SelectedNodeLayout);
            var editor    = new NodeEditorView {
                DataContext = viewModel
            };

            editor.ShowDialog();
        }
        public NodeEditorWindow()
        {
            NodeEditor.Logger                = new NodeEditorLogger();
            NodeEditor.Assertions            = new NodeEditorAssertions();
            NodeEditor.InstantiateLoggerFunc = () => new NodeEditorLogger();

            _graph = new NodeGraph();
            _graph.SetDefaultGraphType(new GameObjectGraphType());
            _view         = new NodeEditorView(_graph.Helper);
            _input        = new NodeEditorUserEventsListener(_view);
            _controller   = new NodeEditorController(_graph, _input);
            _pinConnector = new NodeEditorPinConnector(_graph, _view.ConnectorView, _input);
            _rootHandler  = new NodeEditorRootFinder(_controller);
        }
        public NodeEditorUserEventsListener(NodeEditorView editorView)
        {
            _editorView = editorView;

            _editorView.ContextMenu.AddNode    += ContextMenu_AddNode;
            _editorView.ContextMenu.ClearNodes += ContextMenu_ClearNodes;

            _editorView.MenuView.Revert += MenuView_Revert;
            _editorView.MenuView.Run    += MenuView_Run;
            _editorView.MenuView.Save   += MenuView_Save;

            _editorView.Properties.GraphProperties.AddVariable     += GraphProperties_AddVariable;
            _editorView.Properties.GraphProperties.AddVariableNode += GraphProperties_AddVariableNode;
            _editorView.Properties.GraphProperties.RemoveVariable  += GraphProperties_RemoveVariable;

            _inputListener = new EditorInputListener();
            _inputListener.DeletePressed += InputListener_DeletePressed;
            _inputListener.MouseDown     += InputListener_MouseDown;
            _inputListener.MouseUp       += InputListener_MouseUp;
            _inputListener.KeyPressed    += InputListener_KeyPressed;
        }