Removed loadArray and fixed addPack return

This commit is contained in:
Richard Davey 2018-05-04 14:33:44 +01:00
parent ebf77e2bbc
commit acf6b94b2f

View file

@ -501,6 +501,8 @@ var LoaderPlugin = new Class({
* @since 3.7.0 * @since 3.7.0
* *
* @param {any} data - The Pack File data, or an array of Pack File data, to be added to the load queue. * @param {any} data - The Pack File data, or an array of Pack File data, to be added to the load queue.
*
* @return {boolean} `true` if any files were added to the queue, otherwise `false`.
*/ */
addPack: function (pack, packKey) addPack: function (pack, packKey)
{ {
@ -510,6 +512,8 @@ var LoaderPlugin = new Class({
pack = { packKey: pack[packKey] }; pack = { packKey: pack[packKey] };
} }
var total = 0;
// Store the loader settings in case this pack replaces them // Store the loader settings in case this pack replaces them
var currentBaseURL = this.baseURL; var currentBaseURL = this.baseURL;
var currentPath = this.path; var currentPath = this.path;
@ -541,6 +545,7 @@ var LoaderPlugin = new Class({
if (this[type]) if (this[type])
{ {
this[type](file); this[type](file);
total++;
} }
} }
} }
@ -551,7 +556,7 @@ var LoaderPlugin = new Class({
this.setPath(currentPath); this.setPath(currentPath);
this.setPrefix(currentPrefix); this.setPrefix(currentPrefix);
return this; return (total > 0);
}, },
/** /**
@ -864,37 +869,6 @@ var LoaderPlugin = new Class({
this.state = CONST.LOADER_IDLE; this.state = CONST.LOADER_IDLE;
}, },
/**
* !!! TO BE REPLACED BY THE PACK LOADER METHOD !!!
* !!! TO BE REPLACED BY THE PACK LOADER METHOD !!!
* !!! TO BE REPLACED BY THE PACK LOADER METHOD !!!
*
* Called by the Scene Manager if you specify a files payload for a pre-Scene Boot.
* Takes an array of file objects.
*
* @method Phaser.Loader.LoaderPlugin#loadArray
* @since 3.0.0
*
* @param {LoaderFileObject[]} files - An array of files to load.
*
* @return {boolean} `true` if any files were successfully added to the list, otherwise `false`.
*/
loadArray: function (files)
{
if (Array.isArray(files))
{
for (var i = 0; i < files.length; i++)
{
var file = files[i];
// Calls file-type methods like `atlas` or `image`
this[file.type](file);
}
}
return (this.list.size > 0);
},
/** /**
* The Scene that owns this plugin is shutting down. * The Scene that owns this plugin is shutting down.
* We need to kill and reset all internal properties as well as stop listening to Scene events. * We need to kill and reset all internal properties as well as stop listening to Scene events.