wip: Serialization Test

This commit is contained in:
2024-02-12 10:48:56 +03:00
parent 0148afea52
commit 1df5eee59d
20 changed files with 103 additions and 604 deletions

View File

@@ -1,8 +1,8 @@
using System.Collections.Generic;
namespace Engine.Serialization.DTOs;
namespace Engine.Serialization;
internal record struct BehaviourControllerDTO(
string ClassType,
List<BehaviourDTO> Behaviours
);
public class BehaviourControllerDto : ClassInterchangeableDto
{
public Dictionary<string, object?> Behaviours { get; set; } = [];
}

View File

@@ -1,7 +0,0 @@
namespace Engine.Serialization.DTOs;
internal record struct BehaviourDTO(
string ClassType,
int Priority,
StateEnableDTO StateEnable
);

View File

@@ -0,0 +1,6 @@
namespace Engine.Serialization;
public class ClassInterchangeableDto : EntityDto
{
public string ClassType { get; set; } = null!;
}

View File

@@ -0,0 +1,8 @@
using System.Collections.Generic;
namespace Engine.Serialization;
public class EntityDto
{
public Dictionary<string, object?> Fields { get; set; } = [];
}

View File

@@ -1,8 +0,0 @@
using System.Collections.Generic;
namespace Engine.Serialization.DTOs;
internal record struct GameManagerDTO(
string ClassType,
List<GameObjectDTO> GameObjects
);

View File

@@ -1,10 +1,10 @@
namespace Engine.Serialization.DTOs;
namespace Engine.Serialization;
internal record struct GameObjectDTO(
string ClassType,
string Id,
string Name,
TransformDTO Transform,
BehaviourControllerDTO BehaviourController,
StateEnableDTO StateEnable
);
public class GameObjectDto : ClassInterchangeableDto
{
string Id { get; set; } = null!;
string Name { get; set; } = null!;
TransformDto Transform { get; set; } = null!;
BehaviourControllerDto BehaviourController { get; set; } = null!;
StateEnableDto StateEnable { get; set; } = null!;
}

View File

@@ -1,6 +1,7 @@
namespace Engine.Serialization.DTOs;
namespace Engine.Serialization;
internal record struct StateEnableDTO(
string ClassType,
bool Enabled
);
public class StateEnableDto : ClassInterchangeableDto
{
public bool Enabled { get; set; } = false;
}

View File

@@ -1,11 +1,11 @@
using Syntriax.Engine.Core;
namespace Engine.Serialization.DTOs;
namespace Engine.Serialization;
internal record struct TransformDTO(
string ClassType,
string? ParentId,
Vector2D Position,
Vector2D Scale,
float Rotation
);
public class TransformDto : ClassInterchangeableDto
{
string? ParentId { get; set; } = null;
Vector2D Position { get; set; } = Vector2D.Zero;
Vector2D Scale { get; set; } = Vector2D.Zero;
float Rotation { get; set; } = 0f;
}