mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-03-26 22:49:01 +08:00
[unity] Updated editors.
This commit is contained in:
parent
acd50548d5
commit
0a423c3757
@ -110,6 +110,30 @@ namespace Spine {
|
||||
TransformMode.NoScaleOrReflection
|
||||
};
|
||||
|
||||
/// <summary>Returns the version string of binary skeleton data.</summary>
|
||||
public static string GetVersionString (Stream input) {
|
||||
if (input == null) throw new ArgumentNullException("input");
|
||||
|
||||
try {
|
||||
// Hash.
|
||||
int byteCount = ReadVarint(input, true);
|
||||
if (byteCount > 1) input.Position += byteCount - 1;
|
||||
|
||||
// Version.
|
||||
byteCount = ReadVarint(input, true);
|
||||
if (byteCount > 1) {
|
||||
byteCount--;
|
||||
var buffer = new byte[byteCount];
|
||||
ReadFully(input, buffer, 0, byteCount);
|
||||
return System.Text.Encoding.UTF8.GetString(buffer, 0, byteCount);
|
||||
}
|
||||
|
||||
throw new ArgumentException("Stream does not contain a valid binary Skeleton Data.", "input");
|
||||
} catch (Exception e) {
|
||||
throw new ArgumentException("Stream does not contain a valid binary Skeleton Data.\n" + e, "input");
|
||||
}
|
||||
}
|
||||
|
||||
public SkeletonData ReadSkeletonData (Stream input) {
|
||||
if (input == null) throw new ArgumentNullException("input");
|
||||
float scale = Scale;
|
||||
|
||||
@ -1461,25 +1461,6 @@ namespace Spine.Unity.Editor {
|
||||
public static string GetPathSafeRegionName (AtlasRegion region) {
|
||||
return region.name.Replace("/", "_");
|
||||
}
|
||||
|
||||
internal static int ReadVarint (Stream input, bool optimizePositive) {
|
||||
int b = input.ReadByte();
|
||||
int result = b & 0x7F;
|
||||
if ((b & 0x80) != 0) {
|
||||
b = input.ReadByte();
|
||||
result |= (b & 0x7F) << 7;
|
||||
if ((b & 0x80) != 0) {
|
||||
b = input.ReadByte();
|
||||
result |= (b & 0x7F) << 14;
|
||||
if ((b & 0x80) != 0) {
|
||||
b = input.ReadByte();
|
||||
result |= (b & 0x7F) << 21;
|
||||
if ((b & 0x80) != 0) result |= (input.ReadByte() & 0x7F) << 28;
|
||||
}
|
||||
}
|
||||
}
|
||||
return optimizePositive ? result : ((result >> 1) ^ -(result & 1));
|
||||
}
|
||||
}
|
||||
|
||||
public static class SpineHandles {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user