CrabUI
Loading...
Searching...
No Matches
CrabUI.CUIProp< T > Class Template Reference

Wrapper object for prop value, setters, side effects, metadata etc. More...

Public Member Functions

void SetHost (CUIComponent host)
 
void SetName (string name)
 
void SetValue (T value, [CallerMemberName] string memberName="")
 
 CUIProp (CUIComponent host, string name)
 

Public Attributes

CUIComponent Host
 
string Name = "Unknown"
 
Action< T, CUIComponentOnSet
 
Func< T, CUIComponent, T > Validate
 
bool LayoutProp
 
bool DecorProp
 
bool AbsoluteProp
 
bool ChildProp
 
bool ShowInDebug = true
 
Value
 

Detailed Description

Wrapper object for prop value, setters, side effects, metadata etc.

Template Parameters
TType of the prop

Definition at line 23 of file CUIProp.cs.

Constructor & Destructor Documentation

◆ CUIProp() [1/2]

Definition at line 70 of file CUIProp.cs.

70{ }

◆ CUIProp() [2/2]

CrabUI.CUIProp< T >.CUIProp ( CUIComponent host,
string name )

Definition at line 72 of file CUIProp.cs.

73 {
74 Name = name;
75 Host = host;
76 }

Member Function Documentation

◆ SetHost()

void CrabUI.CUIProp< T >.SetHost ( CUIComponent host)

◆ SetValue()

void CrabUI.CUIProp< T >.SetValue ( T value,
[CallerMemberName] string memberName = "" )

Definition at line 39 of file CUIProp.cs.

40 {
41 if (Host == null)
42 {
43 CUI.Log($"{Name} CUIProp doens't have a Host! Type: {typeof(T)} Value: {value} memberName: {memberName}", Color.Red);
44 return;
45 }
46
47 if (Validate == null)
48 {
49 Value = value;
50 }
51 else
52 {
53 Value = Validate.Invoke(value, Host);
54 }
55
56 OnSet?.Invoke(value, Host);
57
58 if (ShowInDebug)
59 {
60 CUIDebug.Capture(null, Host, "SetValue", memberName, Name, Value.ToString());
61 }
62
63
64 if (LayoutProp) Host.OnPropChanged();
65 if (DecorProp) Host.OnDecorPropChanged();
66 if (AbsoluteProp) Host.OnAbsolutePropChanged();
67 if (ChildProp) Host.OnChildrenPropChanged();
68 }

Member Data Documentation

◆ AbsoluteProp

bool CrabUI.CUIProp< T >.AbsoluteProp

Definition at line 34 of file CUIProp.cs.

◆ ChildProp

bool CrabUI.CUIProp< T >.ChildProp

Definition at line 35 of file CUIProp.cs.

◆ DecorProp

bool CrabUI.CUIProp< T >.DecorProp

Definition at line 33 of file CUIProp.cs.

◆ Host

Definition at line 28 of file CUIProp.cs.

◆ LayoutProp

bool CrabUI.CUIProp< T >.LayoutProp

Definition at line 32 of file CUIProp.cs.

◆ Name

string CrabUI.CUIProp< T >.Name = "Unknown"

Definition at line 29 of file CUIProp.cs.

◆ OnSet

Action<T, CUIComponent> CrabUI.CUIProp< T >.OnSet

Definition at line 30 of file CUIProp.cs.

◆ ShowInDebug

bool CrabUI.CUIProp< T >.ShowInDebug = true

Definition at line 36 of file CUIProp.cs.

◆ Validate

Func<T, CUIComponent, T> CrabUI.CUIProp< T >.Validate

Definition at line 31 of file CUIProp.cs.

◆ Value

T CrabUI.CUIProp< T >.Value

Definition at line 38 of file CUIProp.cs.


The documentation for this class was generated from the following file: