diff --git a/GamecraftScripting/GamecraftScripting.csproj b/GamecraftScripting/GamecraftScripting.csproj index 87a0c2f..ab0e3bc 100644 --- a/GamecraftScripting/GamecraftScripting.csproj +++ b/GamecraftScripting/GamecraftScripting.csproj @@ -235,7 +235,7 @@ ..\ref\Gamecraft_Data\Managed\StringFormatter.dll - ..\ref\Gamecraft_Data\Managed\Svelto.Common.dll + ..\ref\Gamecraft_Data\Managed\Svelto.Common_3.dll ..\ref\Gamecraft_Data\Managed\Svelto.ECS.Debugger.dll diff --git a/GamecraftScripting/Serialization/DeserializeFromDiskEntitiesEnginePatch.cs b/GamecraftScripting/Serialization/DeserializeFromDiskEntitiesEnginePatch.cs index a8fcce4..b450842 100644 --- a/GamecraftScripting/Serialization/DeserializeFromDiskEntitiesEnginePatch.cs +++ b/GamecraftScripting/Serialization/DeserializeFromDiskEntitiesEnginePatch.cs @@ -57,7 +57,7 @@ namespace GamecraftScripting.Serialization { EGID newScriptId = new EGID(j, ScriptBuilder.ScriptGroup); // why doesn't \/this\/ do anything? - ____entitySerializer.DeserializeNewEntity(newScriptId, ____serializationData, SerializationType.Storage); + ____entitySerializer.DeserializeNewEntity(newScriptId, ____serializationData, (int)SerializationType.Storage); } bbr = new BinaryBufferReader(____bytesStream.ToArrayFast(out count), ____serializationData.dataPos); uint actualStart = bbr.ReadUint(); diff --git a/GamecraftScripting/Serialization/SaveGameEnginePatch.cs b/GamecraftScripting/Serialization/SaveGameEnginePatch.cs index 464bec2..d9d5d9d 100644 --- a/GamecraftScripting/Serialization/SaveGameEnginePatch.cs +++ b/GamecraftScripting/Serialization/SaveGameEnginePatch.cs @@ -39,7 +39,7 @@ namespace GamecraftScripting.Serialization for (uint i = 0; i < count; i++) { EGID scriptId = new EGID(i, ScriptBuilder.ScriptGroup); - entitySerializer.SerializeEntity(scriptId, serializationData, SerializationType.Storage); + entitySerializer.SerializeEntity(scriptId, serializationData, (int)SerializationType.Storage); } bbw = new BinaryBufferWriter(serializationData.data.ToArrayFast(out buffLen), serializationData.dataPos); serializationData.data.ExpandBy(4u); diff --git a/GamecraftScripting/Serialization/ScriptBuilder.cs b/GamecraftScripting/Serialization/ScriptBuilder.cs index 29d2a90..cc5f8eb 100644 --- a/GamecraftScripting/Serialization/ScriptBuilder.cs +++ b/GamecraftScripting/Serialization/ScriptBuilder.cs @@ -13,7 +13,7 @@ namespace GamecraftScripting.Serialization public static EGID BuildScriptEntity(string name, string script, IEntityFactory entityFactory) { EGID scriptId = new EGID(nextScriptId++, ScriptGroup); - EntityStructInitializer builder = entityFactory.BuildEntity(scriptId); + EntityComponentInitializer builder = entityFactory.BuildEntity(scriptId); builder.Init(new ScriptStruct { name = new ECSString(name), script = new ECSString(script), diff --git a/GamecraftScripting/Serialization/ScriptDeserializationFactory.cs b/GamecraftScripting/Serialization/ScriptDeserializationFactory.cs index 4055dc6..8e84b77 100644 --- a/GamecraftScripting/Serialization/ScriptDeserializationFactory.cs +++ b/GamecraftScripting/Serialization/ScriptDeserializationFactory.cs @@ -13,11 +13,11 @@ namespace GamecraftScripting.Serialization this.entityFactory = entityFactory; } - public EntityStructInitializer BuildDeserializedEntity(EGID egid, ISerializationData serializationData, ISerializableEntityDescriptor entityDescriptor, SerializationType serializationType, IEntitySerialization entitySerialization) + public EntityComponentInitializer BuildDeserializedEntity(EGID egid, ISerializationData serializationData, ISerializableEntityDescriptor entityDescriptor, int serializationType, IEntitySerialization entitySerialization) { Logging.MetaLog(entityFactory == null); - EntityStructInitializer esi = entityFactory.BuildEntity(egid); - entitySerialization.DeserializeEntityStructs(serializationData, entityDescriptor, ref esi, serializationType); + EntityComponentInitializer esi = entityFactory.BuildEntity(egid); + entitySerialization.DeserializeEntityComponents(serializationData, entityDescriptor, ref esi, serializationType); Logging.MetaLog($"Deserialized script named {esi.Get().name.ToString()}"); return esi; } diff --git a/GamecraftScripting/Serialization/ScriptEntityDescriptor.cs b/GamecraftScripting/Serialization/ScriptEntityDescriptor.cs index 2d4a835..2946573 100644 --- a/GamecraftScripting/Serialization/ScriptEntityDescriptor.cs +++ b/GamecraftScripting/Serialization/ScriptEntityDescriptor.cs @@ -1,4 +1,5 @@ using System; +using RobocraftX.Common; using Svelto.ECS; using Svelto.ECS.Serialization; @@ -9,12 +10,12 @@ namespace GamecraftScripting.Serialization [HashName("GamecraftScriptingScriptEntityDescriptorV0")] public class _ScriptEntityDescriptor : IEntityDescriptor { - public IEntityBuilder[] entitiesToBuild => _entityBuilders; + public IComponentBuilder[] componentsToBuild => _entityBuilders; - private static readonly IEntityBuilder[] _entityBuilders = new IEntityBuilder[1] + private static readonly IComponentBuilder[] _entityBuilders = new IComponentBuilder[1] { - new SerializableEntityBuilder((SerializationType.Network, new ScriptSerializer()), - (SerializationType.Storage, new ScriptSerializer())) + new SerializableComponentBuilder(((int)SerializationType.Network, new ScriptSerializer()), + ((int)SerializationType.Storage, new ScriptSerializer())) }; } @@ -22,7 +23,7 @@ namespace GamecraftScripting.Serialization { GamecraftModdingAPI.Utility.Logging.MetaLog("ScriptEntityDescriptor Initialized"); GamecraftModdingAPI.Utility.Logging.MetaLog($"Entities to serialize: {entitiesToSerialize.Length}"); - GamecraftModdingAPI.Utility.Logging.MetaLog($"Entities to serialize: {entitiesToBuild.Length}"); + GamecraftModdingAPI.Utility.Logging.MetaLog($"Entities to serialize: {componentsToBuild.Length}"); } } } diff --git a/GamecraftScripting/Serialization/ScriptSerializer.cs b/GamecraftScripting/Serialization/ScriptSerializer.cs index a888ce9..26ba2f5 100644 --- a/GamecraftScripting/Serialization/ScriptSerializer.cs +++ b/GamecraftScripting/Serialization/ScriptSerializer.cs @@ -7,7 +7,7 @@ using Svelto.ECS.Serialization; namespace GamecraftScripting.Serialization { - public class ScriptSerializer : ISerializer + public class ScriptSerializer : IComponentSerializer { private static readonly UTF8Encoding utf8Encoding = new UTF8Encoding(); diff --git a/GamecraftScripting/Serialization/ScriptStruct.cs b/GamecraftScripting/Serialization/ScriptStruct.cs index e5f4530..95763d9 100644 --- a/GamecraftScripting/Serialization/ScriptStruct.cs +++ b/GamecraftScripting/Serialization/ScriptStruct.cs @@ -4,7 +4,7 @@ using Svelto.ECS.Experimental; namespace GamecraftScripting.Serialization { - public struct ScriptStruct : IEntityStruct + public struct ScriptStruct : IEntityComponent { public ECSString name; diff --git a/GamecraftScripting/Serialization/SerializationDescriptorMapPatch.cs b/GamecraftScripting/Serialization/SerializationDescriptorMapPatch.cs index 4d3cdfa..00e789d 100644 --- a/GamecraftScripting/Serialization/SerializationDescriptorMapPatch.cs +++ b/GamecraftScripting/Serialization/SerializationDescriptorMapPatch.cs @@ -15,9 +15,9 @@ namespace GamecraftScripting.Serialization { if (descriptor.entitiesToSerialize.Length == 0) { - if (descriptor.entitiesToBuild.Length != 0) + if (descriptor.componentsToBuild.Length != 0) { - Logging.MetaLog($"Descriptor: {descriptor.entitiesToBuild[0].GetType().FullName} (hash:{descriptor.hash})"); + Logging.MetaLog($"Descriptor: {descriptor.componentsToBuild[0].GetType().FullName} (hash:{descriptor.hash})"); } else {