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; } }
/// <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; }
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; }