@@ -26,7 +26,7 @@ public sealed partial class TileAtmosCollectionSerializer : ITypeSerializer<Dict
|
|||||||
{
|
{
|
||||||
node.TryGetValue(new ValueDataNode("version"), out var versionNode);
|
node.TryGetValue(new ValueDataNode("version"), out var versionNode);
|
||||||
var version = ((ValueDataNode?) versionNode)?.AsInt() ?? 1;
|
var version = ((ValueDataNode?) versionNode)?.AsInt() ?? 1;
|
||||||
Dictionary<Vector2i, TileAtmosphere> tiles;
|
Dictionary<Vector2i, TileAtmosphere> tiles = new();
|
||||||
|
|
||||||
// Backwards compatability
|
// Backwards compatability
|
||||||
if (version == 1)
|
if (version == 1)
|
||||||
@@ -36,8 +36,6 @@ public sealed partial class TileAtmosCollectionSerializer : ITypeSerializer<Dict
|
|||||||
var mixies = serializationManager.Read<Dictionary<Vector2i, int>?>(tile2, hookCtx, context);
|
var mixies = serializationManager.Read<Dictionary<Vector2i, int>?>(tile2, hookCtx, context);
|
||||||
var unique = serializationManager.Read<List<GasMixture>?>(node["uniqueMixes"], hookCtx, context);
|
var unique = serializationManager.Read<List<GasMixture>?>(node["uniqueMixes"], hookCtx, context);
|
||||||
|
|
||||||
tiles = new Dictionary<Vector2i, TileAtmosphere>();
|
|
||||||
|
|
||||||
if (unique != null && mixies != null)
|
if (unique != null && mixies != null)
|
||||||
{
|
{
|
||||||
foreach (var (indices, mix) in mixies)
|
foreach (var (indices, mix) in mixies)
|
||||||
@@ -58,15 +56,14 @@ public sealed partial class TileAtmosCollectionSerializer : ITypeSerializer<Dict
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
var dataNode = (MappingDataNode) node["data"];
|
var dataNode = (MappingDataNode) node["data"];
|
||||||
var tileNode = (MappingDataNode) dataNode["tiles"];
|
|
||||||
var chunkSize = serializationManager.Read<int>(dataNode["chunkSize"], hookCtx, context);
|
var chunkSize = serializationManager.Read<int>(dataNode["chunkSize"], hookCtx, context);
|
||||||
|
|
||||||
var unique = serializationManager.Read<List<GasMixture>?>(dataNode["uniqueMixes"], hookCtx, context);
|
dataNode.TryGetValue(new ValueDataNode("uniqueMixes"), out var mixNode);
|
||||||
|
var unique = mixNode == null ? null : serializationManager.Read<List<GasMixture>?>(mixNode, hookCtx, context);
|
||||||
tiles = new Dictionary<Vector2i, TileAtmosphere>();
|
|
||||||
|
|
||||||
if (unique != null)
|
if (unique != null)
|
||||||
{
|
{
|
||||||
|
var tileNode = (MappingDataNode) dataNode["tiles"];
|
||||||
foreach (var (chunkNode, valueNode) in tileNode)
|
foreach (var (chunkNode, valueNode) in tileNode)
|
||||||
{
|
{
|
||||||
var chunkOrigin = serializationManager.Read<Vector2i>(chunkNode, hookCtx, context);
|
var chunkOrigin = serializationManager.Read<Vector2i>(chunkNode, hookCtx, context);
|
||||||
|
|||||||
Reference in New Issue
Block a user