namespace OECS; /// /// Describes a component type discovered at compile time by the source generator. /// Used by to save/load components without reflection. /// public sealed class ComponentDescriptor { /// /// The assembly-qualified name of the component type, for stable serialization /// across assemblies. /// public string TypeName { get; } /// /// The of the component. /// public Type Type { get; } /// /// Serializes a boxed component instance to a MessagePack byte array. /// public Func Serialize { get; } /// /// Deserializes a MessagePack byte array and adds the component to the entity /// via the typed method. No reflection. /// public Action DeserializeAndAdd { get; } /// /// Deserializes a MessagePack byte array to a boxed component object. /// Used by for relationship fixup before adding. /// public Func Deserialize { get; } public ComponentDescriptor( string typeName, Type type, Func serialize, Action deserializeAndAdd, Func deserialize) { TypeName = typeName; Type = type; Serialize = serialize; DeserializeAndAdd = deserializeAndAdd; Deserialize = deserialize; } }