增加版本转换接口

This commit is contained in:
ww-rm
2025-03-18 12:15:07 +08:00
parent 58071e1de1
commit 4d68b48367
5 changed files with 81 additions and 49 deletions

View File

@@ -19,7 +19,7 @@ namespace SpineViewer.Spine.Implementations.SkeletonConverter
private readonly List<JsonObject> idx2event = [];
protected override JsonObject ReadBinary(string binPath)
public override JsonObject ReadBinary(string binPath)
{
var root = new JsonObject();
using var input = File.OpenRead(binPath);
@@ -809,7 +809,7 @@ namespace SpineViewer.Spine.Implementations.SkeletonConverter
private readonly Dictionary<string, int> path2idx = [];
private readonly Dictionary<string, int> event2idx = [];
protected override void WriteBinary(JsonObject root, string binPath, bool nonessential = false)
public override void WriteBinary(JsonObject root, string binPath, bool nonessential = false)
{
this.nonessential = nonessential;
this.root = root;
@@ -902,6 +902,16 @@ namespace SpineViewer.Spine.Implementations.SkeletonConverter
}
public override JsonObject ToVersion(JsonObject root, Version version)
{
root = version switch
{
Version.V38 => root.DeepClone().AsObject(),
_ => throw new NotImplementedException(),
};
return root;
}
//public void WriteFloatArray(float[] array)
//{
// foreach (var i in array)