mirror of
https://github.com/wassname/phaser.git
synced 2026-07-18 12:30:44 +08:00
1.1.6 release. The final of the 1.1 branch.
This commit is contained in:
+23
-4
@@ -799,6 +799,22 @@ Phaser.Loader.prototype = {
|
||||
return this;
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* Add a custom JSON file to the Loader.
|
||||
*
|
||||
* @method Phaser.Loader#json
|
||||
* @param {string} key - Unique asset key of the json file.
|
||||
* @param {string} url - URL of the json file.
|
||||
* @return {Phaser.Loader} This Loader instance.
|
||||
*/
|
||||
json: function (key, url) {
|
||||
|
||||
this.addToFileList('json', key, url);
|
||||
|
||||
return this;
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* Add a binary file to the Loader. It will be loaded via xhr with a responseType of "arraybuffer". You can specify an optional callback to process the file after load.
|
||||
@@ -1257,12 +1273,12 @@ Phaser.Loader.prototype = {
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'tilemap':
|
||||
case 'json':
|
||||
this._xhr.open("GET", this.baseURL + file.url, true);
|
||||
this._xhr.responseType = "text";
|
||||
|
||||
if (file.format === Phaser.Tilemap.TILED_JSON)
|
||||
if (!file.format || file.format === Phaser.Tilemap.TILED_JSON)
|
||||
{
|
||||
this._xhr.onload = function () {
|
||||
return _this.jsonLoadComplete(_this._fileIndex);
|
||||
@@ -1284,7 +1300,6 @@ Phaser.Loader.prototype = {
|
||||
};
|
||||
this._xhr.send();
|
||||
break;
|
||||
|
||||
case 'text':
|
||||
case 'script':
|
||||
this._xhr.open("GET", this.baseURL + file.url, true);
|
||||
@@ -1543,6 +1558,10 @@ Phaser.Loader.prototype = {
|
||||
{
|
||||
this.game.cache.addTilemap(file.key, file.url, data, file.format);
|
||||
}
|
||||
else if (file.type === 'json')
|
||||
{
|
||||
this.game.cache.addText(file.key, file.url, data);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.game.cache.addTextureAtlas(file.key, file.url, file.data, data, file.format);
|
||||
@@ -1763,7 +1782,7 @@ Phaser.Loader.prototype.constructor = Phaser.Loader;
|
||||
|
||||
<span class="jsdoc-message">
|
||||
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-dev</a>
|
||||
on Wed Feb 12 2014 15:32:11 GMT-0000 (GMT) using the <a href="https://github.com/terryweiss/docstrap">DocStrap template</a>.
|
||||
on Mon Feb 24 2014 01:12:21 GMT-0000 (GMT) using the <a href="https://github.com/terryweiss/docstrap">DocStrap template</a>.
|
||||
</span>
|
||||
</footer>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user