void DispatchMenuItemEvent(GraphMenuAction action, GraphContextMenuEvent e) { if (MenuItemClicked != null) { MenuItemClicked(action, e); } }
protected void DispatchMenuItemEvent(object action, GraphContextMenuEvent e) { if (MenuItemClicked != null) { MenuItemClicked(action, e); } }
GraphContextMenuEvent BuildEvent(object userdata) { var e = new GraphContextMenuEvent(); e.userdata = userdata; e.sourcePin = sourcePin; e.mouseWorldPosition = mouseWorldPosition; return(e); }
void OnMenuItemClicked(GraphMenuAction action, GraphContextMenuEvent e) { var mouseScreen = lastMousePosition; GraphNode node = null; if (action == GraphMenuAction.AddGameObjectNode) { node = CreateNode <GameObjectNode>(mouseScreen); SelectNode(node); } else if (action == GraphMenuAction.AddSpriteNode) { node = CreateNode <SpriteNode>(mouseScreen); SelectNode(node); } else if (action == GraphMenuAction.AddMarkerNode) { node = CreateNode <MarkerNode>(mouseScreen); SelectNode(node); } else if (action == GraphMenuAction.AddMarkerEmitterNode) { if (e.userdata != null) { var markerName = e.userdata as String; node = CreateMarkerEmitterNode(mouseScreen, markerName); if (node != null) { SelectNode(node); } } } if (node != null) { // Check if the menu was created by dragging out a link if (e.sourcePin != null) { GraphPin targetPin = e.sourcePin.PinType == GraphPinType.Input ? node.OutputPins[0] : node.InputPins[0]; // Align the target pin with the mouse position where the link was dragged and released node.Position = e.mouseWorldPosition - targetPin.Position; GraphPin inputPin, outputPin; if (e.sourcePin.PinType == GraphPinType.Input) { inputPin = e.sourcePin; outputPin = targetPin; } else { inputPin = targetPin; outputPin = e.sourcePin; } CreateLinkBetweenPins(outputPin, inputPin); } } }
protected abstract void OnMenuItemClicked(object userdata, GraphContextMenuEvent e);