TechbloxModdingAPI/GamecraftModdingAPI/Persistence/IEntitySerializer.cs
2020-04-28 22:59:36 -04:00

38 lines
1.6 KiB
C#

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>
/// The entity factory used for creating entities and entity components.
/// </summary>
/// <value>The entity factory.</value>
IEntityFactory EntityFactory { set; }
/// <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);
}
}