From 8bced33fc65dd56186b2bc19e12a161ac1ec8f46 Mon Sep 17 00:00:00 2001 From: Harald Csaszar Date: Thu, 27 May 2021 19:39:18 +0200 Subject: [PATCH] [xna] Fixed a compile error in Atlas loading (in a non-Unity #if codebranch). --- spine-csharp/src/Atlas.cs | 10 ++++++++-- spine-xna/example/src/ExampleGame.cs | 4 ++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/spine-csharp/src/Atlas.cs b/spine-csharp/src/Atlas.cs index 4a03e655b..56f4dc58b 100644 --- a/spine-csharp/src/Atlas.cs +++ b/spine-csharp/src/Atlas.cs @@ -68,7 +68,10 @@ namespace Spine { var file = await folder.GetFileAsync(path).AsTask().ConfigureAwait(false); using (var reader = new StreamReader(await file.OpenStreamForReadAsync().ConfigureAwait(false))) { try { - Load(reader, Path.GetDirectoryName(path), textureLoader); + Atlas atlas = new Atlas(reader, Path.GetDirectoryName(path), textureLoader); + this.pages = atlas.pages; + this.regions = atlas.regions; + this.textureLoader = atlas.textureLoader; } catch (Exception ex) { throw new Exception("Error reading atlas file: " + path, ex); } @@ -87,7 +90,10 @@ namespace Spine { using (StreamReader reader = new StreamReader(path)) { #endif // WINDOWS_PHONE try { - Load(reader, Path.GetDirectoryName(path), textureLoader); + Atlas atlas = new Atlas(reader, Path.GetDirectoryName(path), textureLoader); + this.pages = atlas.pages; + this.regions = atlas.regions; + this.textureLoader = atlas.textureLoader; } catch (Exception ex) { throw new Exception("Error reading atlas file: " + path, ex); } diff --git a/spine-xna/example/src/ExampleGame.cs b/spine-xna/example/src/ExampleGame.cs index 34f54b961..889e305e7 100644 --- a/spine-xna/example/src/ExampleGame.cs +++ b/spine-xna/example/src/ExampleGame.cs @@ -95,7 +95,7 @@ namespace Spine { skeletonDebugRenderer.DisableAll(); skeletonDebugRenderer.DrawClipping = true; - // String name = "spineboy-pro"; + //String name = "spineboy-pro"; String name = "raptor-pro"; // String name = "tank-pro"; //String name = "coin-pro"; @@ -103,7 +103,7 @@ namespace Spine { name = "raptor-pro"; // we only have normalmaps for raptor String atlasName = name.Replace("-pro", "").Replace("-ess", ""); - bool binaryData = false; + bool binaryData = name.Contains("spineboy"); Atlas atlas; if (!useNormalmapShader) {