This commit is contained in:
badlogic 2021-04-02 21:36:04 +02:00
commit 525c8e1837
4 changed files with 10 additions and 8 deletions

View File

@ -288,8 +288,7 @@ namespace Spine {
if (cos < -1) {
cos = -1;
a2 = MathUtils.PI * bendDir;
}
else if (cos > 1) {
} else if (cos > 1) {
cos = 1;
a2 = 0;
if (stretch) {

View File

@ -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));
}
}
}

View File

@ -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 == '{';

View File

@ -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) {