using System; using Svelto.ECS; using Svelto.ECS.Serialization; using GamecraftModdingAPI.Utility; namespace GamecraftModdingAPI.Persistence { /// <summary> /// Entity serializer and deserializer interface for storing and retrieving data in a Gamecraft save file (GameSave.GC). /// </summary> public interface IEntitySerializer : IDeserializationFactory, IQueryingEntitiesEngine { /// <summary> /// Serialize the entities. /// </summary> /// <returns>Whether serialization was successful.</returns> /// <param name="serializationData">Serialized data to write to (writes to GameSave.GC).</param> /// <param name="entitiesDB">Entities db for the game.</param> /// <param name="entitySerializer">Entity serializer with support for single-entity serialization.</param> bool Serialize(ref ISerializationData serializationData, EntitiesDB entitiesDB, IEntitySerialization entitySerializer); /// <summary> /// Deserialize the entities. /// </summary> /// <returns>Whether deserialization was successful.</returns> /// <param name="serializationData">Serialized data to read from (read from GameSave.GC).</param> /// <param name="entitySerializer">Entity serializer with support for single-entity deserialization.</param> bool Deserialize(ref ISerializationData serializationData, IEntitySerialization entitySerializer); } }