From 1057889c2176dd74f3634bbfb4845e98ff9194b1 Mon Sep 17 00:00:00 2001 From: Harald Csaszar Date: Fri, 26 Mar 2021 09:48:16 +0100 Subject: [PATCH 1/2] [xna][monogame] Fixed examples using incorrect time update, leading to jittery playback. Closes #1868. --- spine-monogame/example/ExampleGame.cs | 2 +- spine-xna/example/src/ExampleGame.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/spine-monogame/example/ExampleGame.cs b/spine-monogame/example/ExampleGame.cs index 3c5e9ee0c..27e537a59 100644 --- a/spine-monogame/example/ExampleGame.cs +++ b/spine-monogame/example/ExampleGame.cs @@ -294,7 +294,7 @@ namespace Spine { } protected override void Draw(GameTime gameTime) { - currentScreen.Render(gameTime.ElapsedGameTime.Milliseconds / 1000.0f); + currentScreen.Render((float)(gameTime.ElapsedGameTime.TotalMilliseconds / 1000.0)); } } } diff --git a/spine-xna/example/src/ExampleGame.cs b/spine-xna/example/src/ExampleGame.cs index 9c42ed311..e2c8bd8e7 100644 --- a/spine-xna/example/src/ExampleGame.cs +++ b/spine-xna/example/src/ExampleGame.cs @@ -192,7 +192,7 @@ namespace Spine { protected override void Draw (GameTime gameTime) { GraphicsDevice.Clear(Color.Black); - state.Update(gameTime.ElapsedGameTime.Milliseconds / 1000f); + state.Update((float)(gameTime.ElapsedGameTime.TotalMilliseconds / 1000.0)); state.Apply(skeleton); skeleton.UpdateWorldTransform(); if (skeletonRenderer.Effect is BasicEffect) { From 1d2df650081324375761d9300ee8829ee6e0f0df Mon Sep 17 00:00:00 2001 From: Harald Csaszar Date: Fri, 2 Apr 2021 09:26:33 +0200 Subject: [PATCH 2/2] [unity] Improved binary vs json file detection upon skeleton import checks, should fix a reported (potentially asian locale related) issue. Closes #1867. --- .../Asset Types/SkeletonDataCompatibility.cs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/spine-unity/Assets/Spine/Runtime/spine-unity/Asset Types/SkeletonDataCompatibility.cs b/spine-unity/Assets/Spine/Runtime/spine-unity/Asset Types/SkeletonDataCompatibility.cs index 2eb9c8c74..2be8e6cda 100644 --- a/spine-unity/Assets/Spine/Runtime/spine-unity/Asset Types/SkeletonDataCompatibility.cs +++ b/spine-unity/Assets/Spine/Runtime/spine-unity/Asset Types/SkeletonDataCompatibility.cs @@ -167,11 +167,14 @@ namespace Spine.Unity { } public static bool IsJsonFile (TextAsset file) { - string fileText = file.text; + byte[] content = file.bytes; const int maxCharsToCheck = 256; - int numCharsToCheck = Math.Min(fileText.Length, maxCharsToCheck); - for (int i = 0; i < numCharsToCheck; ++i) { - char c = fileText[i]; + int numCharsToCheck = Math.Min(content.Length, maxCharsToCheck); + int i = 0; + if (content.Length >= 3 && content[0] == 0xEF && content[1] == 0xBB && content[2] == 0xBF) // skip potential BOM + i = 3; + for (; i < numCharsToCheck; ++i) { + char c = (char)content[i]; if (char.IsWhiteSpace(c)) continue; return c == '{';