mirror of
https://github.com/wassname/phaser.git
synced 2026-07-27 11:25:30 +08:00
Loader.replaceInFileList wouldn't over-write the previous entry correctly, which caused the Loader.image overwrite parameter to fail (thanks basoko, fixes #493)
This commit is contained in:
+32
-1
@@ -198,6 +198,31 @@ Phaser.Loader.prototype = {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* Gets the fileList index for the given key.
|
||||
*
|
||||
* @method Phaser.Loader#getAssetIndex
|
||||
* @param {string} type - The type asset you want to check.
|
||||
* @param {string} key - Key of the asset you want to check.
|
||||
* @return {number} The index of this key in the filelist, or -1 if not found.
|
||||
*/
|
||||
getAssetIndex: function (type, key) {
|
||||
|
||||
if (this._fileList.length > 0)
|
||||
{
|
||||
for (var i = 0; i < this._fileList.length; i++)
|
||||
{
|
||||
if (this._fileList[i].type === type && this._fileList[i].key === key)
|
||||
{
|
||||
return i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* Gets the asset that is queued for load.
|
||||
*
|
||||
@@ -302,10 +327,16 @@ Phaser.Loader.prototype = {
|
||||
}
|
||||
}
|
||||
|
||||
if (this.checkKeyExists(type, key) === false)
|
||||
var index = this.getAssetIndex(type, key);
|
||||
|
||||
if (index === -1)
|
||||
{
|
||||
this._fileList.push(entry);
|
||||
}
|
||||
else
|
||||
{
|
||||
this._fileList[index] = entry;
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user