mirror of
https://github.com/photonstorm/phaser
synced 2024-11-24 05:33:35 +00:00
Added support for passing in json object instead of url to json file directly to audioSprite loader method
This commit is contained in:
parent
6145ff5869
commit
c1010bd446
1 changed files with 18 additions and 2 deletions
|
@ -1,6 +1,7 @@
|
|||
var BaseLoader = require('../../loader/BaseLoader');
|
||||
var Class = require('../../utils/Class');
|
||||
var NumberArray = require('../../utils/array/NumberArray');
|
||||
var CONST = require('../../loader/const');
|
||||
|
||||
var AnimationJSONFile = require('../../loader/filetypes/AnimationJSONFile');
|
||||
var AtlasJSONFile = require('../../loader/filetypes/AtlasJSONFile');
|
||||
|
@ -124,7 +125,23 @@ var Loader = new Class({
|
|||
|
||||
if(audioFile)
|
||||
{
|
||||
var jsonFile = new JSONFile(key, json, this.path, jsonXhrSettings);
|
||||
var jsonFile;
|
||||
|
||||
if (typeof json === 'string')
|
||||
{
|
||||
jsonFile = new JSONFile(key, json, this.path, jsonXhrSettings);
|
||||
|
||||
this.addFile(jsonFile);
|
||||
}
|
||||
else
|
||||
{
|
||||
jsonFile = {
|
||||
type: 'json',
|
||||
key: key,
|
||||
data: json,
|
||||
state: CONST.FILE_WAITING_LINKFILE
|
||||
};
|
||||
}
|
||||
|
||||
// Link them together
|
||||
audioFile.linkFile = jsonFile;
|
||||
|
@ -135,7 +152,6 @@ var Loader = new Class({
|
|||
jsonFile.linkType = 'audioSprite';
|
||||
|
||||
this.addFile(audioFile);
|
||||
this.addFile(jsonFile);
|
||||
}
|
||||
|
||||
return this;
|
||||
|
|
Loading…
Reference in a new issue