修复附件类型枚举量的字符串大小写问题

This commit is contained in:
ww-rm
2025-05-28 16:05:09 +08:00
parent b81d13b582
commit 49f6b28aef
3 changed files with 15 additions and 4 deletions

View File

@@ -51,6 +51,17 @@ namespace SpineViewer.Spine.Implementations.SkeletonConverter
[RotateMode.ChainScale] = "chainScale", [RotateMode.ChainScale] = "chainScale",
}; };
private static readonly Dictionary<AttachmentType, string> AttachmentTypeJsonValue = new()
{
[AttachmentType.Region] = "region",
[AttachmentType.Boundingbox] = "bounding",
[AttachmentType.Mesh] = "mesh",
[AttachmentType.Linkedmesh] = "linkedmesh",
[AttachmentType.Path] = "path",
[AttachmentType.Point] = "point",
[AttachmentType.Clipping] = "clipping",
};
private BinaryReader reader = null; private BinaryReader reader = null;
private JsonObject root = null; private JsonObject root = null;
private bool nonessential = false; private bool nonessential = false;
@@ -298,7 +309,7 @@ namespace SpineViewer.Spine.Implementations.SkeletonConverter
var name = reader.ReadStringRef() ?? keyName; var name = reader.ReadStringRef() ?? keyName;
var type = (AttachmentType)reader.ReadByte(); var type = (AttachmentType)reader.ReadByte();
attachment["name"] = name; attachment["name"] = name;
attachment["type"] = type.ToString(); attachment["type"] = AttachmentTypeJsonValue[type];
switch (type) switch (type)
{ {
case AttachmentType.Region: case AttachmentType.Region:

View File

@@ -52,9 +52,9 @@ namespace SpineViewer.Spine.Implementations.SkeletonConverter
private static readonly Dictionary<AttachmentType, string> AttachmentTypeJsonValue = new() private static readonly Dictionary<AttachmentType, string> AttachmentTypeJsonValue = new()
{ {
[AttachmentType.Region] = "region", [AttachmentType.Region] = "region",
[AttachmentType.Boundingbox] = "boundingBox", [AttachmentType.Boundingbox] = "boundingbox",
[AttachmentType.Mesh] = "mesh", [AttachmentType.Mesh] = "mesh",
[AttachmentType.Linkedmesh] = "linkedMesh", [AttachmentType.Linkedmesh] = "linkedmesh",
[AttachmentType.Path] = "path", [AttachmentType.Path] = "path",
[AttachmentType.Point] = "point", [AttachmentType.Point] = "point",
[AttachmentType.Clipping] = "clipping", [AttachmentType.Clipping] = "clipping",

View File

@@ -52,7 +52,7 @@ namespace SpineViewer.Spine.Implementations.SkeletonConverter
[AttachmentType.Region] = "region", [AttachmentType.Region] = "region",
[AttachmentType.Boundingbox] = "bounding", [AttachmentType.Boundingbox] = "bounding",
[AttachmentType.Mesh] = "mesh", [AttachmentType.Mesh] = "mesh",
[AttachmentType.Linkedmesh] = "linkedMesh", [AttachmentType.Linkedmesh] = "linkedmesh",
[AttachmentType.Path] = "path", [AttachmentType.Path] = "path",
[AttachmentType.Point] = "point", [AttachmentType.Point] = "point",
[AttachmentType.Clipping] = "clipping", [AttachmentType.Clipping] = "clipping",