2using System.Reflection;
3using System.Runtime.CompilerServices;
4using System.Collections.Generic;
5using System.Collections.Immutable;
7using System.Diagnostics;
11using Microsoft.Xna.Framework;
12using Microsoft.Xna.Framework.Graphics;
18 public partial class RandomTest : FillMethods
20 [HideFromAutoTestRunner]
23 CUIFrame frame = CUIPrefab.NewFrame();
32 frame[
"header"][
"send"] =
new CUIButton(
"send")
34 AddOnMouseDown = (e) =>
36 Stopwatch sw =
new Stopwatch();
40 frame.
Get<
CUITextBlock>(
"header.took").Text = $
"{sw.ElapsedMilliseconds}ms";
48 frame[
"header"][
"recieved"] =
new CUITextBlock(
"recieved")
58 frame[
"header"][
"spam"] = spamButton;
60 frame.OnAnyCommand += (c) => frame.
Get<
CUITextBlock>(
"header.recieved").Text = c.Name;
62 for (
int i = 0; i < 2000; i++)
66 Consumes = $
"data {i}",
67 Command = $
"hi from button {i}",
69 Palette = PaletteOrder.Secondary,
73 b.OnConsume += (data) => b.TextScale =
CUI.Random.NextSingle() * 2.0f;
74 b.OnAnyData += (data) => b.Text = $
"lol data:{data}";
75 frame[
"content"].
Append(b);
78 frame.
Emits.Add(
"data 2");
79 frame.OnUpdate += (d) =>
CUIAnchor is just a Vector2 This is a static class containing some helper methods.
Base class for all components.
virtual CUIComponent Get(string name)
Returns memorized component by name.
void DispatchDown(CUIData data)
Dispathes command down the component tree until someone consumes it.
virtual CUIComponent Append(CUIComponent child, string name=null, [CallerMemberName] string memberName="")
Adds children to the end of the list.
ObservableCollection< string > Emits
Optimization to data flow If not empty component will search for consumers of the data and pass it ...
Draggable and resizable container for other components.
In fact a static class managing static things.
record CUIData(string Name, object Data=null)
Can be dispatched down the component tree to pass some data to the children without creating a hard l...