Core(Box.cs) - Update class to be json serialisable

This commit is contained in:
miku-666
2025-12-12 00:23:39 +01:00
parent b27ed9784e
commit c9869171f5
2 changed files with 12 additions and 19 deletions

View File

@@ -1,13 +1,24 @@
using System.Numerics;
using Newtonsoft.Json;
namespace PckStudio.Core
{
public class Box(Vector3 position, Vector3 size, Vector2 uv, float inflate, bool mirror)
{
[JsonProperty("pos", Required = Required.Always)]
public Vector3 Position { get; } = position;
[JsonProperty("size", Required = Required.Always)]
public Vector3 Size { get; } = size;
[JsonProperty("uv", Required = Required.Always)]
public Vector2 Uv { get; } = uv;
[JsonProperty("mirror", NullValueHandling = NullValueHandling.Ignore)]
public float Inflate { get; } = inflate;
[JsonProperty("inflate", NullValueHandling = NullValueHandling.Ignore)]
public bool Mirror { get; } = mirror;
}
}

View File

@@ -25,24 +25,6 @@ namespace PckStudio.Core.Json
public Vector3 Rotation { get; set; } = Vector3.Zero;
[JsonProperty("boxes")]
public ModelDefaultBox[] Boxes { get; set; }
}
public class ModelDefaultBox
{
[JsonProperty("pos")]
public Vector3 Position { get; set; }
[JsonProperty("size")]
public Vector3 Size { get; set; }
[JsonProperty("uv")]
public Vector2 Uv { get; set; }
[JsonProperty("mirror")]
public bool Mirror { get; set; } = false;
[JsonProperty("inflate")]
public float Inflate { get; set; } = 0f;
public Box[] Boxes { get; set; }
}
}