示例#1
0
        void nodeDelete(List <NodeLayout> list)
        {
            foreach (var l in list)
            {
                foreach (var pin in l.Node.PinCollection.Get())
                {
                    WireController.Disconnect(pin);
                }

                _loadedGraph.ZoomOffset = _zoomArea.ZoomOffset;

                string path = AssetDatabase.GetAssetPath(l.Node.Root);
                _loadedGraph.Nodes.Remove(l.Node);
                AssetDatabase.ImportAsset(path);
                LoadGraph(_loadedGraph);
            }
        }
示例#2
0
        void InitControls()
        {
            _nodeSelection = new NodeSelection();
            _nodeSelection.VisualEditor = this;

            _zoomArea = new ZoomableArea(1, 12, DrawZoomAreaContent);
            if (_loadedGraph != null)
            {
                _zoomArea.PanTo(_loadedGraph.ZoomOffset);
            }

            // Create the wire controller
            if (_loadedGraph != null)
            {
                _wireController = new WireController(_loadedGraph, this);
            }

            _nodeMenu = new GenericMenu();
        }
示例#3
0
        /// <summary>
        /// Bridge method to prevent initialization order issue.
        /// </summary>
        /// <param name="pin">Pin.</param>
        void onPinClicked(Pin pin)
        {
            Event e = Event.current;

            if (e.button == (int)MouseButton.Right)
            {
                WireController.Disconnect(pin);
            }
            else if (e.button == (int)MouseButton.Left)
            {
                if (_wireController.IsPinSelected)
                {
                    _wireController.Connect(pin);
                }
                else
                {
                    _wireController.Select(pin);
                }
            }
        }