public BasicNode(BasicNodeStructure structure, RectangleRenderElementStyle border_style) { Structure = structure; BorderStyle = border_style; BorderElement = new RectangleRenderElement(Position, Width, Height, border_style.FillColor, border_style.BorderColor, border_style.BorderWidth); TriggerAreas.Add(new RectangleHitbox(Position, Width, Height)); }
public TextBoxNode(BasicTextNodeStructure structure, TextRenderElementStyle text_style, RectangleRenderElementStyle border_style) : base(structure, text_style, border_style) { TriggerAreas.Add(new RectangleHitbox(Position, Width, Height)); OnKeyPress += HandleKey; OnFocused += (sender, args) => FillColor = Color.CadetBlue; OnUnfocused += (sender, args) => FillColor = Color.White; }
public ButtonNode(ButtonStructure structure, RectangleRenderElementStyle style, TextRenderElementStyle text_style) { Structure = structure; BorderStyle = style; TextStyle = text_style; BorderElement = new RectangleRenderElement(Position, Width, Height, style.FillColor, style.BorderColor, style.BorderWidth); TextElement = new TextRenderElement(Position, Text, TextColor, TextStyle.FontSize, TextStyle.FontStyle); TriggerAreas.Add(new RectangleHitbox(Position, Width, Height)); ButtonAction = Structure.ButtonAction; OnMouseClick += (object sender, EventArgs e) => { ButtonAction.Invoke(); OnUnfocused?.Invoke(this, new NodeEventArgs(this)); }; }
public void ShowOptions(object sender, EventArgs e) { if (OptionsMenu == null) { OptionsMenu = OptionsPrefab; TriggerAreas.Add(OptionsMenu.TriggerAreas[0]); OnFocused?.Invoke(this, new NodeEventArgs(OptionsMenu)); FocusedNode?.OnUnfocused?.Invoke(this, new NodeEventArgs(FocusedNode)); TriggerAreas.Add(OptionsMenu.TriggerAreas[0]); } else { OnOptionsHide?.Invoke(this, e); } }