Browse Source

fix bug

tags/2.9.1
sebas77 5 years ago
parent
commit
bd1c1ea69e
8 changed files with 12 additions and 11 deletions
  1. +1
    -1
      Svelto.ECS/Serialization/DefaultVersioningFactory.cs
  2. +2
    -2
      Svelto.ECS/Serialization/EnginesRoot.GenericEntitySerialization.cs
  3. +1
    -1
      Svelto.ECS/Serialization/IEntitySerialization.cs
  4. +1
    -1
      Svelto.ECS/Serialization/ISerializableEntityBuilder.cs
  5. +1
    -1
      Svelto.ECS/Serialization/ISerializableEntityDescriptor.cs
  6. +1
    -1
      Svelto.ECS/Serialization/ISerializer.cs
  7. +3
    -2
      Svelto.ECS/Serialization/SerializableEntityBuilder.cs
  8. +2
    -2
      Svelto.ECS/Serialization/SerializableEntityDescriptor.cs

+ 1
- 1
Svelto.ECS/Serialization/DefaultVersioningFactory.cs View File

@@ -12,7 +12,7 @@ namespace Svelto.ECS.Serialization
{
var initializer = _factory.BuildEntity<T>(egid, _implementors);
entitySerialization.DeserializeEntityStructs(serializationData, entityDescriptor, initializer, SerializationType.Storage);
entitySerialization.DeserializeEntityStructs(serializationData, entityDescriptor, ref initializer, SerializationType.Storage);

return initializer;
}


+ 2
- 2
Svelto.ECS/Serialization/EnginesRoot.GenericEntitySerialization.cs View File

@@ -65,7 +65,7 @@ namespace Svelto.ECS
? entityDescriptor.entitiesToSerialize
: entityDescriptor.entitiesToBuild);

DeserializeEntityStructs(serializationData, entityDescriptor, initializer, serializationType);
DeserializeEntityStructs(serializationData, entityDescriptor, ref initializer, serializationType);

return initializer;
}
@@ -94,7 +94,7 @@ namespace Svelto.ECS

public void DeserializeEntityStructs(ISerializationData serializationData,
ISerializableEntityDescriptor entityDescriptor,
in EntityStructInitializer initializer, SerializationType serializationType)
ref EntityStructInitializer initializer, SerializationType serializationType)
{
foreach (var serializableEntityBuilder in entityDescriptor.entitiesToSerialize)
{


+ 1
- 1
Svelto.ECS/Serialization/IEntitySerialization.cs View File

@@ -37,7 +37,7 @@ namespace Svelto.ECS.Serialization
/// <param name="serializationType"></param>
void DeserializeEntityStructs(ISerializationData serializationData,
ISerializableEntityDescriptor entityDescriptor,
in EntityStructInitializer initializer, SerializationType serializationType);
ref EntityStructInitializer initializer, SerializationType serializationType);

/// <summary>
/// Contrary to the other Deserialize methods that assume that the entity exists, this method is used to deserialise


+ 1
- 1
Svelto.ECS/Serialization/ISerializableEntityBuilder.cs View File

@@ -10,6 +10,6 @@ namespace Svelto.ECS.Serialization

void Deserialize(ISerializationData serializationData, in EntityStructInitializer initializer, SerializationType serializationType);
void CopySerializedEntityStructs(in EntityStructInitializer sourceInitializer, in EntityStructInitializer destinationInitializer);
void CopySerializedEntityStructs(in EntityStructInitializer sourceInitializer, in EntityStructInitializer destinationInitializer, SerializationType serializationType);
}
}

+ 1
- 1
Svelto.ECS/Serialization/ISerializableEntityDescriptor.cs View File

@@ -5,6 +5,6 @@ namespace Svelto.ECS.Serialization
uint hash { get; }
ISerializableEntityBuilder[] entitiesToSerialize { get; }
void CopySerializedEntityStructs(in EntityStructInitializer sourceInitializer, in EntityStructInitializer destinationInitializer);
void CopySerializedEntityStructs(in EntityStructInitializer sourceInitializer, in EntityStructInitializer destinationInitializer, SerializationType serializationType);
}
}

+ 1
- 1
Svelto.ECS/Serialization/ISerializer.cs View File

@@ -9,7 +9,7 @@ namespace Svelto.ECS.Serialization
{
bool Serialize(in T value, ISerializationData serializationData);
bool Deserialize(ref T value, ISerializationData serializationData);
uint size { get; }
}



+ 3
- 2
Svelto.ECS/Serialization/SerializableEntityBuilder.cs View File

@@ -84,9 +84,10 @@ namespace Svelto.ECS.Serialization
}

public void CopySerializedEntityStructs(in EntityStructInitializer sourceInitializer,
in EntityStructInitializer destinationInitializer)
in EntityStructInitializer destinationInitializer, SerializationType serializationType)
{
destinationInitializer.CopyFrom(sourceInitializer.Get<T>());
if ((_serializers[(int) serializationType] is DontSerialize<T>) == false)
destinationInitializer.CopyFrom(sourceInitializer.Get<T>());
}

readonly ISerializer<T>[] _serializers;


+ 2
- 2
Svelto.ECS/Serialization/SerializableEntityDescriptor.cs View File

@@ -99,11 +99,11 @@ namespace Svelto.ECS.Serialization
return (indexSerial, indexDynamic);
}
public void CopySerializedEntityStructs(in EntityStructInitializer sourceInitializer, in EntityStructInitializer destinationInitializer)
public void CopySerializedEntityStructs(in EntityStructInitializer sourceInitializer, in EntityStructInitializer destinationInitializer, SerializationType serializationType)
{
foreach (ISerializableEntityBuilder e in entitiesToSerialize)
{
e.CopySerializedEntityStructs(sourceInitializer, destinationInitializer);
e.CopySerializedEntityStructs(sourceInitializer, destinationInitializer, serializationType);
}
}



Loading…
Cancel
Save