public NENode(Vector2 position, float width, float height, GUIStyle nodeStyle, GUIStyle selectedStyle, GUIStyle inPointStyle, GUIStyle outPointStyle, Action <NEConnectionPoint> OnClickInPoint, Action <NEConnectionPoint> OnClickOutPoint, Action <NENode> OnClickRemoveNode) { rect = new Rect(position.x, position.y, width, height); style = nodeStyle; inPoint = new NEConnectionPoint(this, ConnectionPointType.In, inPointStyle, OnClickInPoint); outPoint = new NEConnectionPoint(this, ConnectionPointType.Out, outPointStyle, OnClickOutPoint); defaultNodeStyle = nodeStyle; selectedNodeStyle = selectedStyle; OnRemoveNode = OnClickRemoveNode; }
private void OnClickOutPoint(NEConnectionPoint outPoint) { selectedOutPoint = outPoint; if (selectedInPoint != null) { if (selectedOutPoint.node != selectedInPoint.node) { CreateConnection(); ClearConnectionSelection(); } else { ClearConnectionSelection(); } } }
public NEConnection(NEConnectionPoint inPoint, NEConnectionPoint outPoint, Action <NEConnection> OnClickRemoveConnection) { this.inPoint = inPoint; this.outPoint = outPoint; this.OnClickRemoveConnection = OnClickRemoveConnection; }
private void ClearConnectionSelection() { selectedInPoint = null; selectedOutPoint = null; }