small change

This commit is contained in:
ww-rm
2025-03-20 14:20:45 +08:00
parent a7a5521be1
commit 0129b9df31

View File

@@ -14,7 +14,7 @@ namespace SpineViewer.Spine.Implementations.SkeletonConverter
[SkeletonConverterImplementation(Version.V38)] [SkeletonConverterImplementation(Version.V38)]
class SkeletonConverter38 : SpineViewer.Spine.SkeletonConverter class SkeletonConverter38 : SpineViewer.Spine.SkeletonConverter
{ {
private SkeletonReader reader = null; private BinaryReader reader = null;
private JsonObject root = null; private JsonObject root = null;
private bool nonessential = false; private bool nonessential = false;
@@ -332,7 +332,7 @@ namespace SpineViewer.Spine.Implementations.SkeletonConverter
if (nonessential) reader.ReadInt(); if (nonessential) reader.ReadInt();
break; break;
default: default:
throw new ArgumentException($"Invalid attachment type: {type}"); throw new ArgumentOutOfRangeException($"Invalid attachment type: {type}");
} }
return attachment; return attachment;
} }
@@ -435,7 +435,7 @@ namespace SpineViewer.Spine.Implementations.SkeletonConverter
} }
break; break;
default: default:
throw new ArgumentException($"Invalid slot timeline type: {type}"); throw new ArgumentOutOfRangeException($"Invalid slot timeline type: {type}");
} }
} }
} }
@@ -515,7 +515,7 @@ namespace SpineViewer.Spine.Implementations.SkeletonConverter
} }
break; break;
default: default:
throw new ArgumentException($"Invalid bone timeline type: {type}"); throw new ArgumentOutOfRangeException($"Invalid bone timeline type: {type}");
} }
} }
} }
@@ -633,7 +633,7 @@ namespace SpineViewer.Spine.Implementations.SkeletonConverter
} }
break; break;
default: default:
throw new ArgumentException($"Invalid path timeline type: {type}"); throw new ArgumentOutOfRangeException($"Invalid path timeline type: {type}");
} }
} }
} }
@@ -798,11 +798,11 @@ namespace SpineViewer.Spine.Implementations.SkeletonConverter
obj["c4"] = reader.ReadFloat(); obj["c4"] = reader.ReadFloat();
break; break;
default: default:
throw new ArgumentException($"Invalid curve type: {type}"); ; throw new ArgumentOutOfRangeException($"Invalid curve type: {type}"); ;
} }
} }
private SkeletonWriter writer; private BinaryWriter writer;
private readonly Dictionary<string, int> bone2idx = []; private readonly Dictionary<string, int> bone2idx = [];
private readonly Dictionary<string, int> slot2idx = []; private readonly Dictionary<string, int> slot2idx = [];
private readonly Dictionary<string, int> ik2idx = []; private readonly Dictionary<string, int> ik2idx = [];
@@ -1010,6 +1010,18 @@ namespace SpineViewer.Spine.Implementations.SkeletonConverter
private void WriteSkins() private void WriteSkins()
{ {
//JsonArray skins = [];
//// default skin
//if (ReadSkin(true) is JsonObject data)
// skins.Add(data);
//// other skins
//for (int n = reader.ReadVarInt(); n > 0; n--)
// skins.Add(ReadSkin());
//root["skins"] = skins;
if (!root.ContainsKey("skins")) if (!root.ContainsKey("skins"))
{ {
writer.WriteVarInt(0); writer.WriteVarInt(0);
@@ -1023,6 +1035,7 @@ namespace SpineViewer.Spine.Implementations.SkeletonConverter
} }
} }
private void WriteEvents() private void WriteEvents()
{ {
if (!root.ContainsKey("events")) if (!root.ContainsKey("events"))