CrabUI
|
All components are serializable
Every property marked with [CUISerializable] is serializable
Every type that have Parse and ToString methods can be serialized
For types that doesn't have them methods from CUIExtensions will be used
Also you can parse/serialize simple types manually with CUIParser
You can save and load them to / from file like this:
public void SaveToFile(string path, CUIAttribute propAttribute = CUIAttribute.CUISerializable) public static CUIComponent LoadFromFile(string path, bool saveAfterLoad = false) public static T LoadFromFile<T>(string path, bool saveAfterLoad = false) public void LoadFromTheSameFile() public void SaveToTheSamePath()
Right after the component is loaded, its Hydrate method is called
Also note that Deserialization doesn't remove children so be careful not to create duplicates
States are just shalow clones of component
They are stored in
ComponentA.States
You can manipulate them with:
ComponentA.SaveStateAs(string name) ComponentA.LoadState(string name) ComponentA.ForgetState(string name) ComponentA.ApplyState(CUIComponent state)
Also you can clone component with
ComponentA.Clone()