示例#1
0
    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);
    }
示例#2
0
    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);
    }