Skip to content

Commit 35e8377

Browse files
committed
Support for loading spine files via manifest
Adds loader prefix to textures removes 'SP' prefix Removes atlas extension via regex rather than string trim
1 parent 4f8dd24 commit 35e8377

2 files changed

Lines changed: 117 additions & 117 deletions

File tree

plugins/spine/src/SpineFile.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ var TextFile = require('../../../src/loader/filetypes/TextFile.js');
3030
* A Spine File suitable for loading by the Loader.
3131
*
3232
* These are created when you use the Phaser.Loader.LoaderPlugin#spine method and are not typically created directly.
33-
*
33+
*
3434
* For documentation about what all the arguments and configuration options mean please see Phaser.Loader.LoaderPlugin#spine.
3535
*
3636
* @class SpineFile
@@ -178,7 +178,7 @@ var SpineFile = new Class({
178178
{
179179
var textureURL = textures[i];
180180

181-
var key = 'SP' + this.multiKeyIndex + '_' + textureURL;
181+
var key = this.prefix + textureURL;
182182

183183
var image = new ImageFile(loader, key, textureURL, textureXhrSettings);
184184

@@ -220,7 +220,7 @@ var SpineFile = new Class({
220220

221221
if (file.type === 'text')
222222
{
223-
atlasKey = file.key.substr(0, file.key.length - 2);
223+
atlasKey = file.key.replace(/_[\d]$/, "");
224224

225225
atlasCache = file.cache;
226226

@@ -231,14 +231,14 @@ var SpineFile = new Class({
231231
var src = file.key.trim();
232232
var pos = src.indexOf('_');
233233
var key = src.substr(pos + 1);
234-
234+
235235
this.loader.textureManager.addImage(key, file.data);
236236
}
237237

238238
file.pendingDestroy();
239239
}
240240

241-
atlasCache.add(atlasKey, { preMultipliedAlpha: preMultipliedAlpha, data: combinedAtlasData });
241+
atlasCache.add(atlasKey, { preMultipliedAlpha: preMultipliedAlpha, data: combinedAtlasData, prefix: this.prefix });
242242

243243
this.complete = true;
244244
}

0 commit comments

Comments
 (0)