Reset() public static method

public static Reset ( ) : void
return void
コード例 #1
0
        // GUI function for the main view
        void DrawMainViewGUI()
        {
            FeedbackQueue.Reset();

            _scrollMain = EditorGUILayout.BeginScrollView(
                _scrollMain, false, false,
                GUIStyles.horizontalScrollbar,
                GUIStyles.verticalScrollbar,
                GUIStyles.background
                );

            // Draw the link lines.
            if (Event.current.type == EventType.Repaint)
            {
                foreach (var node in _patch.nodeList)
                {
                    if (!node.DrawLinkLines(_patch))
                    {
                        // Request repaint if position info is not ready.
                        Repaint();
                        break;
                    }
                }
            }

            // Draw all the nodes and make the bounding box.
            BeginWindows();
            foreach (var node in _patch.nodeList)
            {
                node.DrawWindowGUI();
                _mainViewSize = Vector2.Max(_mainViewSize, node.windowPosition);
            }
            EndWindows();

            // Place an empty box to expand the scroll view.
            GUILayout.Box(
                "", EditorStyles.label,
                GUILayout.Width(_mainViewSize.x + 256),
                GUILayout.Height(_mainViewSize.y + 128)
                );

            // Draw working link line while wiring.
            if (_wiring != null)
            {
                DrawWorkingLink();
            }

            EditorGUILayout.EndScrollView();

            // Process all the feedback from the leaf UI elements.
            while (!FeedbackQueue.IsEmpty)
            {
                ProcessUIFeedback(FeedbackQueue.Dequeue());
            }
        }
コード例 #2
0
        private void EventHandler()
        {
            FeedbackQueue.Reset();

            var e          = Event.current;
            var activeNode = GetActiveNode();

            if (e.isKey && e.keyCode == KeyCode.Delete)
            {
                if (NodeLink.SelectedLink == null)
                {
                    return;
                }
                NodeLink.SelectedLink.RemoveLink();
                _patch.Rescan();
                Repaint();
            }
            else if (e.isKey && e.keyCode == KeyCode.C && e.modifiers == EventModifiers.Control)
            {
                if (activeNode == null)
                {
                    return;
                }
                _currentCopiedNode = activeNode;
            }
            else if (e.isKey && e.keyCode == KeyCode.V && e.modifiers == EventModifiers.Control && _currentCopiedNode != null)
            {
                var nodeBase = Instantiate(_currentCopiedNode._instance);
                nodeBase.name = ObjectNames.NicifyVariableName(_currentCopiedNode.typeName);
                nodeBase.wiringNodePosition += Vector2.one * 50;
                var copiedNode = _patch.AddNodeInstance(nodeBase);
                copiedNode.RemoveAllLinks(_patch);

                foreach (var node in _patch.nodeList)
                {
                    node.RemoveLinksTo(copiedNode, _patch);
                }

                Undo.RegisterCreatedObjectUndo(nodeBase.gameObject, "Paste Node");
            }
            else if (e.isMouse && e.button == 0 && e.modifiers == EventModifiers.None)
            {
                NodeLink.SelectedLink = null;
                foreach (var node in _patch.nodeList)
                {
                    if (node.CachedLinks == null)
                    {
                        node.CacheLinks(_patch);
                    }

                    foreach (var link in node.CachedLinks)
                    {
                        var pos = (e.mousePosition - new Vector2(0, 16 / _zoom) + _scrollPosition) / _zoom;
                        if (link.OnLine(pos))
                        {
                            NodeLink.SelectedLink = link;
                            Node.ActiveNode       = null;
                        }
                    }
                }
            }
        }