mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-03-05 10:16:54 +08:00
Merged #103.
This commit is contained in:
parent
7f73966738
commit
cc6b4a3e7f
@ -46,33 +46,27 @@ namespace Spine {
|
|||||||
private AttachmentLoader attachmentLoader;
|
private AttachmentLoader attachmentLoader;
|
||||||
public float Scale { get; set; }
|
public float Scale { get; set; }
|
||||||
|
|
||||||
public SkeletonJson (Atlas atlas) {
|
public SkeletonJson (Atlas atlas) : this(new AtlasAttachmentLoader(atlas)) {
|
||||||
this.attachmentLoader = new AtlasAttachmentLoader(atlas);
|
|
||||||
Scale = 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public SkeletonJson (AttachmentLoader attachmentLoader) {
|
public SkeletonJson (AttachmentLoader attachmentLoader) {
|
||||||
if (attachmentLoader == null) throw new ArgumentNullException("attachmentLoader cannot be null.");
|
if (attachmentLoader == null) throw new ArgumentNullException("attachmentLoader cannot be null.");
|
||||||
this.attachmentLoader = attachmentLoader;
|
this.attachmentLoader = attachmentLoader;
|
||||||
Scale = 1;
|
Scale = 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;
|
||||||
|
|
||||||
var file = await folder.GetFileAsync(path).AsTask().ConfigureAwait(false);
|
var file = await folder.GetFileAsync(path).AsTask().ConfigureAwait(false);
|
||||||
|
using (var reader = new StreamReader(await file.OpenStreamForReadAsync().ConfigureAwait(false))) {
|
||||||
using (var reader = new StreamReader(await file.OpenStreamForReadAsync().ConfigureAwait(false)))
|
|
||||||
{
|
|
||||||
SkeletonData skeletonData = ReadSkeletonData(reader);
|
SkeletonData skeletonData = ReadSkeletonData(reader);
|
||||||
skeletonData.Name = Path.GetFileNameWithoutExtension(path);
|
skeletonData.Name = Path.GetFileNameWithoutExtension(path);
|
||||||
return skeletonData;
|
return skeletonData;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public SkeletonData ReadSkeletonData (String path)
|
public SkeletonData ReadSkeletonData (String path) {
|
||||||
{
|
|
||||||
return this.ReadFile(path).Result;
|
return this.ReadFile(path).Result;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
@ -83,8 +77,8 @@ namespace Spine {
|
|||||||
return skeletonData;
|
return skeletonData;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
public SkeletonData ReadSkeletonData (TextReader reader) {
|
public SkeletonData ReadSkeletonData (TextReader reader) {
|
||||||
if (reader == null) throw new ArgumentNullException("reader cannot be null.");
|
if (reader == null) throw new ArgumentNullException("reader cannot be null.");
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user