2using System.Collections.Generic;
4using System.Reflection;
5using System.Diagnostics;
6using System.Runtime.CompilerServices;
10using Microsoft.Xna.Framework;
11using Microsoft.Xna.Framework.Input;
12using Microsoft.Xna.Framework.Graphics;
19 public partial class CUIComponent
21 #region Debug --------------------------------------------------------
26 private bool debug;
public bool Debug
45 foreach (
CUIComponent c
in Children) { c.IgnoreDebug = value; }
49 public void PrintTree(
string offset =
"")
51 CUI.
Log($
"{offset}{this}");
54 child.PrintTree(offset +
"| ");
64 public void Info(
object msg, [CallerFilePath]
string source =
"", [CallerLineNumber]
int lineNumber = 0)
66 var fi =
new FileInfo(source);
68 CUI.
Log($
"{fi.Directory.Name}/{fi.Name}:{lineNumber}", Color.Yellow * 0.5f);
69 CUI.
Log($
"{this} {msg ?? "null"}", Color.Yellow);
73 #region AKA --------------------------------------------------------
78 [CUISerializable]
public string AKA {
get;
set; }
101 if (name ==
null)
return null;
125 if (value.Parent !=
null) Remember(value, name);
137 if (name ==
null)
return null;
141 string[] names = name.Split(
'.');
143 foreach (
string n
in names)
145 component = component.NamedComponents.GetValueOrDefault(n);
147 if (component ==
null)
149 CUI.Warning($
"Failed to Get {name} from {this}, there's no {n}");
Base class for all components.
virtual CUIComponent Get(string name)
Returns memorized component by name.
bool ignoreDebug
For debug frame itself.
Dictionary< string, CUIComponent > NamedComponents
All memorized components.
virtual CUIComponent Append(CUIComponent child, string name=null, [CallerMemberName] string memberName="")
Adds children to the end of the list.
CUIComponent Forget(CUIComponent c)
If it already has AKA.
string AKA
Parent can memorize it's children by their names, AKA.
void Info(object msg, [CallerFilePath] string source="", [CallerLineNumber] int lineNumber=0)
Prints component and then message.
CUIComponent Remember(CUIComponent c)
If it already has AKA.
In fact a static class managing static things.
static void Log(object msg, Color? color=null, [CallerFilePath] string source="", [CallerLineNumber] int lineNumber=0)
Prints a message to console.