mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2025-12-21 09:46:02 +08:00
[Unity] Fix for Unity UWP/Windows Phone
https://github.com/EsotericSoftware/spine-runtimes/issues/495
This commit is contained in:
parent
dd28645a0b
commit
8006c7b4b9
@ -67,7 +67,9 @@ namespace Spine {
|
|||||||
Scale = 1;
|
Scale = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if !(UNITY_5 || UNITY_4 || UNITY_WSA || UNITY_WP8 || UNITY_WP8_1)
|
||||||
#if WINDOWS_STOREAPP
|
#if WINDOWS_STOREAPP
|
||||||
|
|
||||||
private async Task<SkeletonData> ReadFile(string path) {
|
private async Task<SkeletonData> ReadFile(string path) {
|
||||||
var folder = Windows.ApplicationModel.Package.Current.InstalledLocation;
|
var folder = Windows.ApplicationModel.Package.Current.InstalledLocation;
|
||||||
using (var input = new BufferedStream(await folder.GetFileAsync(path).AsTask().ConfigureAwait(false))) {
|
using (var input = new BufferedStream(await folder.GetFileAsync(path).AsTask().ConfigureAwait(false))) {
|
||||||
@ -83,23 +85,18 @@ namespace Spine {
|
|||||||
#else
|
#else
|
||||||
public SkeletonData ReadSkeletonData (String path) {
|
public SkeletonData ReadSkeletonData (String path) {
|
||||||
#if WINDOWS_PHONE
|
#if WINDOWS_PHONE
|
||||||
using (var input = new BufferedStream(Microsoft.Xna.Framework.TitleContainer.OpenStream(path)))
|
using (var input = new BufferedStream(Microsoft.Xna.Framework.TitleContainer.OpenStream(path))) {
|
||||||
{
|
|
||||||
#else
|
#else
|
||||||
#if UNITY_WP8 || UNITY_WP8_1
|
using (var input = new BufferedStream(new FileStream(path, FileMode.Open))) {
|
||||||
using (var input = new FileStream(path, FileMode.Open))
|
#endif // WINDOWS_PHONE
|
||||||
{
|
|
||||||
#else
|
|
||||||
using (var input = new BufferedStream(new FileStream(path, FileMode.Open)))
|
|
||||||
{
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
SkeletonData skeletonData = ReadSkeletonData(input);
|
SkeletonData skeletonData = ReadSkeletonData(input);
|
||||||
skeletonData.name = Path.GetFileNameWithoutExtension(path);
|
skeletonData.name = Path.GetFileNameWithoutExtension(path);
|
||||||
return skeletonData;
|
return skeletonData;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
#endif // WINDOWS_STOREAPP
|
||||||
|
#endif // !(UNITY)
|
||||||
|
|
||||||
public SkeletonData ReadSkeletonData (Stream input) {
|
public SkeletonData ReadSkeletonData (Stream input) {
|
||||||
if (input == null) throw new ArgumentNullException("input cannot be null.");
|
if (input == null) throw new ArgumentNullException("input cannot be null.");
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user