mirror of
https://github.com/photonstorm/phaser
synced 2024-11-16 09:48:18 +00:00
Using a dataKey
to specify a part of a JSON file when using load.pack
would fail as it wouldn't correctly assign the right part of the pack file to the Loader. You can now use this parameter properly. Fix #6001
This commit is contained in:
parent
2b4332a404
commit
5ae9cf7f09
1 changed files with 11 additions and 2 deletions
|
@ -61,6 +61,15 @@ var PackFile = new Class({
|
||||||
this.data = JSON.parse(this.xhrLoader.responseText);
|
this.data = JSON.parse(this.xhrLoader.responseText);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.data.hasOwnProperty('files') && this.config)
|
||||||
|
{
|
||||||
|
var newData = {};
|
||||||
|
|
||||||
|
newData[this.config] = this.data;
|
||||||
|
|
||||||
|
this.data = newData;
|
||||||
|
}
|
||||||
|
|
||||||
// Let's pass the pack file data over to the Loader ...
|
// Let's pass the pack file data over to the Loader ...
|
||||||
this.loader.addPack(this.data, this.config);
|
this.loader.addPack(this.data, this.config);
|
||||||
|
|
||||||
|
@ -188,7 +197,7 @@ var PackFile = new Class({
|
||||||
*
|
*
|
||||||
* @return {this} The Loader instance.
|
* @return {this} The Loader instance.
|
||||||
*/
|
*/
|
||||||
FileTypesManager.register('pack', function (key, url, packKey, xhrSettings)
|
FileTypesManager.register('pack', function (key, url, dataKey, xhrSettings)
|
||||||
{
|
{
|
||||||
// Supports an Object file definition in the key argument
|
// Supports an Object file definition in the key argument
|
||||||
// Or an array of objects in the key argument
|
// Or an array of objects in the key argument
|
||||||
|
@ -203,7 +212,7 @@ FileTypesManager.register('pack', function (key, url, packKey, xhrSettings)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
this.addFile(new PackFile(this, key, url, xhrSettings, packKey));
|
this.addFile(new PackFile(this, key, url, xhrSettings, dataKey));
|
||||||
}
|
}
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
|
|
Loading…
Reference in a new issue