Mirror of Svelto.ECS because we're a fan of it
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

23 lines
1.1KB

  1. using Svelto.Common;
  2. namespace Svelto.ECS.Serialization
  3. {
  4. //TODO: Unit test. Delete this comment once Unit test is written
  5. public class DefaultVersioningFactory<T> : IDeserializationFactory where T : IEntityDescriptor, new()
  6. {
  7. public EntityInitializer BuildDeserializedEntity
  8. (EGID egid, ISerializationData serializationData, ISerializableEntityDescriptor entityDescriptor
  9. , int serializationType, IEntitySerialization entitySerialization, IEntityFactory factory
  10. , bool enginesRootIsDeserializationOnly)
  11. {
  12. var entityDescriptorEntitiesToSerialize = enginesRootIsDeserializationOnly ? entityDescriptor.componentsToSerialize : entityDescriptor.componentsToBuild;
  13. var initializer = factory.BuildEntity(egid, entityDescriptorEntitiesToSerialize, TypeCache<T>.type);
  14. entitySerialization.DeserializeEntityComponents(serializationData, entityDescriptor, ref initializer
  15. , serializationType);
  16. return initializer;
  17. }
  18. }
  19. }