[ts] If the spine-player jsonUrl has an anchor, use it to find the skeleton in the JSON.

This enables multiple skeletons in the same JSON file.
This commit is contained in:
Nathan Sweet 2021-06-17 01:07:42 -04:00
parent d3f9885fbc
commit 87886adcfe

View File

@ -864,8 +864,11 @@ module spine {
let atlas = this.assetManager.get(this.config.atlasUrl);
let skeletonData: SkeletonData;
if (this.config.jsonUrl) {
let jsonText = this.assetManager.get(this.config.jsonUrl);
let jsonUrl = this.config.jsonUrl;
if (jsonUrl) {
let jsonText = this.assetManager.get(jsonUrl);
let hash = jsonUrl.indexOf("#");
if (hash != -1) jsonText = JSON.parse(jsonText)[jsonUrl.substr(hash + 1)];
let json = new SkeletonJson(new AtlasAttachmentLoader(atlas));
try {
skeletonData = json.readSkeletonData(jsonText);