Browse Source

Update to latest GC update

tags/v0.2
NGnius (Graham) 4 years ago
parent
commit
c13789eac2
9 changed files with 17 additions and 16 deletions
  1. +1
    -1
      GamecraftScripting/GamecraftScripting.csproj
  2. +1
    -1
      GamecraftScripting/Serialization/DeserializeFromDiskEntitiesEnginePatch.cs
  3. +1
    -1
      GamecraftScripting/Serialization/SaveGameEnginePatch.cs
  4. +1
    -1
      GamecraftScripting/Serialization/ScriptBuilder.cs
  5. +3
    -3
      GamecraftScripting/Serialization/ScriptDeserializationFactory.cs
  6. +6
    -5
      GamecraftScripting/Serialization/ScriptEntityDescriptor.cs
  7. +1
    -1
      GamecraftScripting/Serialization/ScriptSerializer.cs
  8. +1
    -1
      GamecraftScripting/Serialization/ScriptStruct.cs
  9. +2
    -2
      GamecraftScripting/Serialization/SerializationDescriptorMapPatch.cs

+ 1
- 1
GamecraftScripting/GamecraftScripting.csproj View File

@@ -235,7 +235,7 @@
<HintPath>..\ref\Gamecraft_Data\Managed\StringFormatter.dll</HintPath>
</Reference>
<Reference Include="Svelto.Common">
<HintPath>..\ref\Gamecraft_Data\Managed\Svelto.Common.dll</HintPath>
<HintPath>..\ref\Gamecraft_Data\Managed\Svelto.Common_3.dll</HintPath>
</Reference>
<Reference Include="Svelto.ECS.Debugger">
<HintPath>..\ref\Gamecraft_Data\Managed\Svelto.ECS.Debugger.dll</HintPath>


+ 1
- 1
GamecraftScripting/Serialization/DeserializeFromDiskEntitiesEnginePatch.cs View File

@@ -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();


+ 1
- 1
GamecraftScripting/Serialization/SaveGameEnginePatch.cs View File

@@ -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);


+ 1
- 1
GamecraftScripting/Serialization/ScriptBuilder.cs View File

@@ -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<ScriptEntityDescriptor>(scriptId);
EntityComponentInitializer builder = entityFactory.BuildEntity<ScriptEntityDescriptor>(scriptId);
builder.Init(new ScriptStruct {
name = new ECSString(name),
script = new ECSString(script),


+ 3
- 3
GamecraftScripting/Serialization/ScriptDeserializationFactory.cs View File

@@ -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<ScriptEntityDescriptor>(egid);
entitySerialization.DeserializeEntityStructs(serializationData, entityDescriptor, ref esi, serializationType);
EntityComponentInitializer esi = entityFactory.BuildEntity<ScriptEntityDescriptor>(egid);
entitySerialization.DeserializeEntityComponents(serializationData, entityDescriptor, ref esi, serializationType);
Logging.MetaLog($"Deserialized script named {esi.Get<ScriptStruct>().name.ToString()}");
return esi;
}


+ 6
- 5
GamecraftScripting/Serialization/ScriptEntityDescriptor.cs View File

@@ -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<ScriptStruct>((SerializationType.Network, new ScriptSerializer()),
(SerializationType.Storage, new ScriptSerializer()))
new SerializableComponentBuilder<SerializationType, ScriptStruct>(((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}");
}
}
}

+ 1
- 1
GamecraftScripting/Serialization/ScriptSerializer.cs View File

@@ -7,7 +7,7 @@ using Svelto.ECS.Serialization;

namespace GamecraftScripting.Serialization
{
public class ScriptSerializer : ISerializer<ScriptStruct>
public class ScriptSerializer : IComponentSerializer<ScriptStruct>
{
private static readonly UTF8Encoding utf8Encoding = new UTF8Encoding();



+ 1
- 1
GamecraftScripting/Serialization/ScriptStruct.cs View File

@@ -4,7 +4,7 @@ using Svelto.ECS.Experimental;

namespace GamecraftScripting.Serialization
{
public struct ScriptStruct : IEntityStruct
public struct ScriptStruct : IEntityComponent
{
public ECSString name;



+ 2
- 2
GamecraftScripting/Serialization/SerializationDescriptorMapPatch.cs View File

@@ -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
{