Exemplo n.º 1
0
    private void DrawMultipleChoicesNode()
    {
        Rect _r = new Rect(NodeRect.position.x + 10, NodeRect.position.y + 15, NodeRect.width - 20, 20);

        for (int i = 0; i < m_part.Contents.Count; i++)
        {
            _r = new Rect(NodeRect.position.x + 30, NodeRect.position.y + 40 + (i * (MULTIPLE_CONTENT_HEIGHT + 10)), NodeRect.width - 50, MULTIPLE_CONTENT_HEIGHT);
            m_part.Contents[i] = EditorGUI.TextArea(_r, m_part.Contents[i]);
            OutPoints[i].Draw(_r);
            _r = new Rect(NodeRect.position.x + 10, NodeRect.position.y + 40 + (i * (MULTIPLE_CONTENT_HEIGHT + 10)) + (MULTIPLE_CONTENT_HEIGHT / 2) - 10, 20, 20);
            if (GUI.Button(_r, "-"))
            {
                OutPoints[i].ClearPoint();
                OutPoints[i] = null;
                OutPoints.RemoveAt(i);
                m_part.Contents.RemoveAt(i);
                Rect _rect = NodeRect;
                _rect.height -= (10 + MULTIPLE_CONTENT_HEIGHT);
                NodeRect      = _rect;
                return;
            }
        }
        _r = new Rect(NodeRect.position.x + NodeRect.width - 30, NodeRect.position.y + NodeRect.height - 30, 20, 20);
        if (GUI.Button(_r, "+"))
        {
            m_part.Contents.Add("");
            OutPoints.Add(new ConnectionPoint(this, ConnectionPointType.Out, m_outPointStyle, m_onClickOutPoint));
            Rect _rect = NodeRect;
            _rect.height += (10 + MULTIPLE_CONTENT_HEIGHT);
            NodeRect      = _rect;
        }
    }
Exemplo n.º 2
0
    /// <summary>
    /// Init the node
    /// </summary>
    /// <param name="_position"></param>
    /// <param name="_width"></param>
    /// <param name="_height"></param>
    /// <param name="_nodeStyle"></param>
    /// <param name="_selectedNodeStyle"></param>
    /// <param name="_inPointStyle"></param>
    /// <param name="_outPointStyle"></param>
    /// <param name="_onClickInPoint"></param>
    /// <param name="_onClickOutPoint"></param>
    /// <param name="_onRemoveNodeAction"></param>
    public Node(Vector2 _position, float _width, float _height, GUIStyle _nodeStyle, GUIStyle _selectedNodeStyle, GUIStyle _inPointStyle, GUIStyle _outPointStyle, Action <ConnectionPoint> _onClickInPoint, Action <ConnectionPoint> _onClickOutPoint, Action <Node> _onRemoveNodeAction)
    {
        NodeRect            = new Rect(_position.x, _position.y, _width, _height);
        m_defaultNodeStyle  = _nodeStyle;
        m_selectedNodeStyle = _selectedNodeStyle;
        m_nodeStyle         = m_defaultNodeStyle;
        InPoint             = new ConnectionPoint(this, ConnectionPointType.In, _inPointStyle, _onClickInPoint);
        if (OutPoints == null)
        {
            OutPoints = new List <ConnectionPoint>();
        }
        m_onClickOutPoint = _onClickOutPoint;
        m_outPointStyle   = _outPointStyle;
        OutPoints.Add(new ConnectionPoint(this, ConnectionPointType.Out, m_outPointStyle, m_onClickOutPoint));

        m_onRemoveNode = _onRemoveNodeAction;
    }
Exemplo n.º 3
0
    private void DrawBasicNode()
    {
        Rect _r = new Rect(NodeRect.position.x + 10, NodeRect.position.y + 15, NodeRect.width - 20, TITLE_HEIGHT);

        GUI.Label(_r, m_part.Speaker);
        _r.y += 25;
        string[] _test = new string[] { "test", "Encore un", "Et un dernier test" };
        EditorGUI.Popup(_r, 0, _test);
        _r = new Rect(NodeRect.position.x + 10, NodeRect.position.y + 70, NodeRect.width - 20, BASIC_CONTENT_HEIGHT);
        Color _original = GUI.backgroundColor;

        GUI.backgroundColor = new Color(1.0f, 1.0f, 1.0f, .5f);
        GUI.Box(_r, m_part.Contents[0]);
        GUI.backgroundColor = _original;
        //EditorGUI.TextArea(_r, m_part.Contents[0]);
        OutPoints.ForEach(p => p.Draw(NodeRect));
    }
Exemplo n.º 4
0
 /// <summary>
 /// Draw the Node
 /// </summary>
 public virtual void Draw()
 {
     InPoint.Draw(NodeRect);
     OutPoints.ForEach(p => p.Draw(NodeRect));
     GUI.Box(NodeRect, NodeTitle, m_nodeStyle);
 }
Exemplo n.º 5
0
 public ConditionNode(Vector2 _position, float _width, float _height, GUIStyle _nodeStyle, GUIStyle _selectedNodeStyle, GUIStyle _inPointStyle, GUIStyle _outPointStyle, Action <ConnectionPoint> _onClickInPoint, Action <ConnectionPoint> _onClickOutPoint, Action <Node> _onRemoveNodeAction)
     : base(_position, _width, _height, _nodeStyle, _selectedNodeStyle, _inPointStyle, _outPointStyle, _onClickInPoint, _onClickOutPoint, _onRemoveNodeAction)
 {
     OutPoints.Add(new ConnectionPoint(this, ConnectionPointType.Out, m_outPointStyle, m_onClickOutPoint));
     m_popupStyle = EditorStyles.popup;
 }