wip: Serialization Test
This commit is contained in:
@@ -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; } = [];
|
||||
}
|
||||
|
@@ -1,7 +0,0 @@
|
||||
namespace Engine.Serialization.DTOs;
|
||||
|
||||
internal record struct BehaviourDTO(
|
||||
string ClassType,
|
||||
int Priority,
|
||||
StateEnableDTO StateEnable
|
||||
);
|
6
Engine.Serialization/DTOs/ClassInterchangeableDto.cs
Normal file
6
Engine.Serialization/DTOs/ClassInterchangeableDto.cs
Normal file
@@ -0,0 +1,6 @@
|
||||
namespace Engine.Serialization;
|
||||
|
||||
public class ClassInterchangeableDto : EntityDto
|
||||
{
|
||||
public string ClassType { get; set; } = null!;
|
||||
}
|
8
Engine.Serialization/DTOs/EntityDto.cs
Normal file
8
Engine.Serialization/DTOs/EntityDto.cs
Normal file
@@ -0,0 +1,8 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Engine.Serialization;
|
||||
|
||||
public class EntityDto
|
||||
{
|
||||
public Dictionary<string, object?> Fields { get; set; } = [];
|
||||
}
|
@@ -1,8 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Engine.Serialization.DTOs;
|
||||
|
||||
internal record struct GameManagerDTO(
|
||||
string ClassType,
|
||||
List<GameObjectDTO> GameObjects
|
||||
);
|
@@ -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!;
|
||||
}
|
||||
|
@@ -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;
|
||||
|
||||
}
|
||||
|
@@ -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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user