2using System.Collections.Generic;
4using System.Reflection;
7using Microsoft.Xna.Framework;
8using Microsoft.Xna.Framework.Input;
9using Microsoft.Xna.Framework.Graphics;
10using System.Diagnostics;
14 public class CUIComponentSelector : CUIVerticalList, IRefreshable
16 public class Button : CUIToggleButton
18 public CUIComponent Target;
19 public Button(CUIComponent target) : base()
22 Text = target.ToString();
24 ToggleOnClick =
false;
27 OnMouseEnter += (e) => {
if (Target !=
null) Target.DebugHighlight =
true; };
28 OnMouseLeave += (e) => {
if (Target !=
null) Target.DebugHighlight =
false; };
32 private CUIComponent selected;
33 public CUIComponent Selected
39 OnSelect?.Invoke(value);
42 public event Action<CUIComponent> OnSelect;
49 List<CUIComponent> all = CUIComponent.AllComponents.Where(c => !c.IgnoreDebug).ToList();
50 foreach (CUIComponent c
in all)
54 State = c == Selected,
62 public CUIComponentSelector() : base()
69 if (o is CUIComponent c)
76 OnMouseDown += (e) => Refresh();
PaletteOrder Palette
This palette will be used to resolve palette styles Primary, Secondary, Tertiary,...
virtual CUIComponent Append(CUIComponent child, string name=null, [CallerMemberName] string memberName="")
Adds children to the end of the list.
void AddCommand(string name, Action< object > action)
Manually adds command.
void DispatchUp(CUICommand command)
Dispathes command up the component tree until someone consumes it.
Vector2 TextAlign
A Vector2 ([0..1],[0..1])
record CUICommand(string Name, object Data=null)
Can be dispatched up the component tree to notify parent about something add pass some event data wit...