void HandleInputs() { bool bIsUsed = false; Event e = Event.current; if (e.type == EventType.Layout || e.type == EventType.Repaint) { return; } if (e.keyCode == KeyCode.E) { bool bFoundNode = false; foreach (ConversationNode Node in _instance.daNodes) { if (Node.IsPosWithin(e.mousePosition - GetNodesOffset())) { bFoundNode = true; if (e.type == EventType.KeyDown && nodeCurrentlyLinked == null) { nodeCurrentlyLinked = Node; break; } if (e.type == EventType.KeyUp && nodeCurrentlyLinked != null) { nodeCurrentlyLinked.LinkTo(new NodeLink(new List <string> { }, Node)); nodeCurrentlyLinked = null; bIsUsed = true; break; } } } if (!bFoundNode && e.type == EventType.KeyUp && nodeCurrentlyLinked != null) { nodeCurrentlyLinked = null; bIsUsed = true; } } else { if (e.type == EventType.MouseDown) { GUI.FocusControl(null); if (nodeCurrentlySelected) { nodeCurrentlySelected.SetSelected(false); } } foreach (ConversationNode Node in _instance.daNodes) { if (Node.IsPosWithin(e.mousePosition - GetNodesOffset()) && e.button == 0 && e.type == EventType.MouseDown) { nodeCurrentlySelected = Node; nodeCurrentlySelected.SetSelected(true); } if ((Node.IsBeingDragged() && (e.type == EventType.MouseDrag || e.type == EventType.MouseUp)) || (Node.IsPosWithin(e.mousePosition - GetNodesOffset()) && e.button == 0)) { bIsUsed = true; Node.HandleMouseEvents(e, vNodesPosOffset); break; } } if (e.button == 2) { if (e.type == EventType.MouseDown) { bIsScrollingOffset = true; } if (e.type == EventType.MouseUp) { bIsScrollingOffset = false; } if (bIsScrollingOffset && e.type == EventType.MouseDrag) { bIsUsed = true; vNodesPosOffset += e.delta; } } } if (bIsUsed) { e.Use(); //Eat the event so it doesn't propagate through the editor. } }