mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2025-12-20 09:16:01 +08:00
Fixed file loading for XNA on Windows Phone 7.
This commit is contained in:
parent
f3be613429
commit
b51a110c54
@ -29,11 +29,12 @@
|
|||||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using System.Reflection;
|
||||||
|
|
||||||
#if WINDOWS_STOREAPP
|
#if WINDOWS_STOREAPP
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
@ -64,7 +65,14 @@ namespace Spine {
|
|||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
public Atlas (String path, TextureLoader textureLoader) {
|
public Atlas (String path, TextureLoader textureLoader) {
|
||||||
using (StreamReader reader = new StreamReader(path)) {
|
|
||||||
|
#if WINDOWS_PHONE
|
||||||
|
Stream stream = Microsoft.Xna.Framework.TitleContainer.OpenStream(path);
|
||||||
|
using (StreamReader reader = new StreamReader(stream))
|
||||||
|
{
|
||||||
|
#else
|
||||||
|
using (StreamReader reader = new StreamReader(path)) {
|
||||||
|
#endif
|
||||||
try {
|
try {
|
||||||
Load(reader, Path.GetDirectoryName(path), textureLoader);
|
Load(reader, Path.GetDirectoryName(path), textureLoader);
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
@ -270,4 +278,4 @@ namespace Spine {
|
|||||||
void Load (AtlasPage page, String path);
|
void Load (AtlasPage page, String path);
|
||||||
void Unload (Object texture);
|
void Unload (Object texture);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -80,8 +80,14 @@ namespace Spine {
|
|||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
public SkeletonData ReadSkeletonData (String path) {
|
public SkeletonData ReadSkeletonData (String path) {
|
||||||
using (StreamReader reader = new StreamReader(path)) {
|
#if WINDOWS_PHONE
|
||||||
SkeletonData skeletonData = ReadSkeletonData(reader);
|
Stream stream = Microsoft.Xna.Framework.TitleContainer.OpenStream(path);
|
||||||
|
using (StreamReader reader = new StreamReader(stream))
|
||||||
|
{
|
||||||
|
#else
|
||||||
|
using (StreamReader reader = new StreamReader(path)) {
|
||||||
|
#endif
|
||||||
|
SkeletonData skeletonData = ReadSkeletonData(reader);
|
||||||
skeletonData.name = Path.GetFileNameWithoutExtension(path);
|
skeletonData.name = Path.GetFileNameWithoutExtension(path);
|
||||||
return skeletonData;
|
return skeletonData;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -29,8 +29,8 @@
|
|||||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
@ -60,7 +60,14 @@ namespace Spine {
|
|||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
static public Texture2D LoadTexture (GraphicsDevice device, String path) {
|
static public Texture2D LoadTexture (GraphicsDevice device, String path) {
|
||||||
using (Stream input = new FileStream(path, FileMode.Open, FileAccess.Read)) {
|
|
||||||
|
#if WINDOWS_PHONE
|
||||||
|
Stream stream = Microsoft.Xna.Framework.TitleContainer.OpenStream(path);
|
||||||
|
using (Stream input = stream)
|
||||||
|
{
|
||||||
|
#else
|
||||||
|
using (Stream input = new FileStream(path, FileMode.Open, FileAccess.Read)) {
|
||||||
|
#endif
|
||||||
try {
|
try {
|
||||||
return Util.LoadTexture(device, input);
|
return Util.LoadTexture(device, input);
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
@ -74,4 +81,4 @@ namespace Spine {
|
|||||||
return Texture2D.FromStream(device, input);
|
return Texture2D.FromStream(device, input);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user