mirror of
https://github.com/aharabada/glitchy-engine-beef.git
synced 2026-09-05 13:01:52 +00:00
Serialize/Deserialize simple classes
This commit is contained in:
@@ -70,16 +70,24 @@ public enum SerializationType : int32
|
||||
|
||||
class SerializedObject
|
||||
{
|
||||
/// ID used to identify the object represented by this SerializedObject. In case that the represented object is a
|
||||
/// Script Instance, the ID is the UUID of the Entity, random otherwise.
|
||||
/// Todo: This sucks because we don't know all UUIDs beforehand and might accidentally assign the ID of an Entity to some class
|
||||
public UUID Id;
|
||||
|
||||
public String TypeName ~ delete:append _;
|
||||
|
||||
public Dictionary<UUID, SerializedObject> AllObjects;
|
||||
|
||||
private List<String> _ownedString = new List<String>() ~ DeleteContainerAndItems!(_);
|
||||
|
||||
public append Dictionary<StringView, (SerializationType PrimitiveType, uint8[16] Data)> Fields = .();
|
||||
|
||||
public this(Dictionary<UUID, SerializedObject> allObjects, UUID? id = null)
|
||||
[AllowAppend]
|
||||
public this(Dictionary<UUID, SerializedObject> allObjects, StringView? typeName, UUID? id = null)
|
||||
{
|
||||
String typeNameCopy = append String(typeName.Value);
|
||||
|
||||
AllObjects = allObjects;
|
||||
|
||||
if (id == null)
|
||||
@@ -97,6 +105,8 @@ class SerializedObject
|
||||
}
|
||||
|
||||
AllObjects.Add(Id, this);
|
||||
|
||||
TypeName = typeNameCopy;
|
||||
}
|
||||
|
||||
public void AddField(StringView name, SerializationType primitiveType, MonoObject* value)
|
||||
|
||||
Reference in New Issue
Block a user