public Node( Vector2 position, Action <ConnectionPoint> OnClickInPoint, Action <ConnectionPoint> OnClickOutPoint, Action <Node> OnClickRemoveNode, DataGraphNode newDataNode, NodeBasedEditor editor ) { dataNode = newDataNode; currentEditor = editor; SetStyles(); UpdateSize(); rect = new Rect(position.x, position.y, width, height); inPoint = new ConnectionPoint(this, ConnectionPointType.In, OnClickInPoint); outPoint = new ConnectionPoint(this, ConnectionPointType.Out, OnClickOutPoint); OnRemoveNode = OnClickRemoveNode; if (dataNode.uiSettings != null) { rect = dataNode.uiSettings.rect; } else { dataNode.SetUIRect(rect); } inspector = Editor.CreateEditor(dataNode); }
public void Draw() { inPoint.Draw(); outPoint.Draw(); UpdateSize(); rect.width = width; rect.height = height; GUILayout.BeginArea(rect, style); inspector.OnInspectorGUI(); GUILayout.EndArea(); dataNode.SetUIRect(rect); }