public Node(Vector2 position, Vector2 dimensions, NodeStyleInfo styleInfo, Action <ConnectionPointBase> onClickInPoint, Action <ConnectionPointBase> onClickOutPoint, Action <Node> onClickRemoveNode, string inPointId = null, string outPointId = null) { rect = new Rect(position.x, position.y, dimensions.x, dimensions.y); inPoint = new NodeConnectionPoint(this, ConnectionPointType.In, styleInfo.inPointStyle, onClickInPoint, inPointId); outPoint = new NodeConnectionPoint(this, ConnectionPointType.Out, styleInfo.outPointStyle, onClickOutPoint, outPointId); OnRemoveNode = onClickRemoveNode; }
protected void OnClickOutPoint(ConnectionPointBase outPoint) { selectedOutPoint = outPoint as NodeConnectionPoint; if (selectedInPoint != null) { if (selectedOutPoint.node != selectedInPoint.node) { CreateConnection(); } ClearConnectionSelection(); } }
public Connection(NodeConnectionPoint inPoint, NodeConnectionPoint outPoint, Action <Connection> onClickRemoveConnection) { this.inPoint = inPoint; this.outPoint = outPoint; this.OnClickRemoveConnection = onClickRemoveConnection; }
protected void ClearConnectionSelection() { selectedInPoint = null; selectedOutPoint = null; }