コード例 #1
0
 public StartNodeElement()
 {
     _nodeNameLabel = new NodeNameLabel("Start From Here", 140);
     _rect          = _rect = new Rect(0, 0, _nodeNameLabel.Width + EditorConstants.NodePadding * 2, _nodeNameLabel.Height + EditorConstants.NodePadding * 3);
     _defaultStyle  = EditorConstants.GetNodeStyle();
     _selectedStyle = EditorConstants.GetSelectedNodeStyle();
 }
コード例 #2
0
 public ElementLabel(IElement innerElement, string name)
 {
     _element              = innerElement;
     _elementName          = name + ":";
     _labelRect            = new Rect(0, 0, EditorConstants.ElementLabelWidth, EditorConstants.LineHeight);
     _labelStyle           = EditorConstants.GetLabelStyle();
     _labelStyle.alignment = TextAnchor.MiddleLeft;
 }
 public ExpandingTextField(string startingInput, Func <string, bool> onChange)
 {
     _input          = startingInput;
     _onChange       = onChange;
     _style          = EditorConstants.GetTextFieldStyle();
     _style.wordWrap = true;
     _lineHeight     = _style.CalcHeight(new GUIContent("Q"), 999);
     _rect           = new Rect(0, 0, EditorConstants.TextFieldWidth, _lineHeight * Mathf.Max(1, _style.CalcLines(_input, EditorConstants.TextFieldWidth)));
 }
コード例 #4
0
 public NodeNameLabel(string name, float width)
 {
     _name            = name;
     Width            = width;
     _rect            = new Rect(0, 0, width, EditorConstants.LineHeight);
     _style           = EditorConstants.GetLabelStyle();
     _style.alignment = TextAnchor.MiddleCenter;
     _style.fontStyle = FontStyle.Bold;
 }
コード例 #5
0
 public TextButton(string text, Action onClick, float width)
 {
     _text                 = text;
     _onClick              = onClick;
     _labelStyle           = EditorConstants.GetLabelStyle();
     _labelStyle.alignment = TextAnchor.MiddleCenter;
     _rect                 = new Rect(0, 0, width, EditorConstants.LineHeight);
     _buttonStyle          = EditorConstants.GetButtonStyle();
 }
コード例 #6
0
 public NodeElement(NodeContent content, Action removeNode)
 {
     _content          = content;
     _contentSize      = new Vector2(0, 0);
     _rect             = new Rect(0, 0, 0, 0);
     _nodeNameLabel    = new NodeNameLabel(_content.Name, _content.Width - EditorConstants.NodePadding * 2);
     _removeNodeButton = new TextButton("X", removeNode, EditorConstants.ButtonHeight);
     UpdateDimensions();
     _defaultStyle  = EditorConstants.GetNodeStyle();
     _selectedStyle = EditorConstants.GetSelectedNodeStyle();
 }
コード例 #7
0
 public TextButton(string text, Action onClick)
     : this(text, onClick, EditorConstants.GetLabelStyle().CalcSize(new GUIContent(text)).x + EditorConstants.ButtonPadding * 2)
 {
 }