Skip to content

Commit 066ab63

Browse files
committed
Loader.tilemap has renamed the mapURL parameter to url and mapData to data to keep it consistent with the other Loader methods.
Loader.physics has renamed the `dataURL` parameter to `url` and `jsonData` to `data` to keep it consistent with the other Loader methods.
1 parent af1508d commit 066ab63

2 files changed

Lines changed: 26 additions & 24 deletions

File tree

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ Version 2.0.6 - "Jornhill" - -in development-
5858
* Group.destroy now removes any set filters (thanks @Jmaharman fix #844)
5959
* RetroFont charsPerRow paramters is now optional. If not given it will take the image width and divide it by the characterWidth value.
6060
* RetroFont now uses Phaser.scaleModes.NEAREST by default for its RenderTexture to preserve scaling.
61+
* Loader.tilemap has renamed the `mapURL` parameter to `url` and `mapData` to `data` to keep it consistent with the other Loader methods.
62+
* Loader.physics has renamed the `dataURL` parameter to `url` and `jsonData` to `data` to keep it consistent with the other Loader methods.
6163

6264
### New Features
6365

src/loader/Loader.js

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -532,26 +532,26 @@ Phaser.Loader.prototype = {
532532
*
533533
* @method Phaser.Loader#tilemap
534534
* @param {string} key - Unique asset key of the tilemap data.
535-
* @param {string} [mapDataURL] - The url of the map data file (csv/json)
536-
* @param {object} [mapData] - An optional JSON data object. If given then the mapDataURL is ignored and this JSON object is used for map data instead.
535+
* @param {string} [url] - The url of the map data file (csv/json)
536+
* @param {object} [data] - An optional JSON data object. If given then the url is ignored and this JSON object is used for map data instead.
537537
* @param {number} [format=Phaser.Tilemap.CSV] - The format of the map data. Either Phaser.Tilemap.CSV or Phaser.Tilemap.TILED_JSON.
538538
* @return {Phaser.Loader} This Loader instance.
539539
*/
540-
tilemap: function (key, mapDataURL, mapData, format) {
540+
tilemap: function (key, url, data, format) {
541541

542-
if (typeof mapDataURL === "undefined") { mapDataURL = null; }
543-
if (typeof mapData === "undefined") { mapData = null; }
542+
if (typeof url === "undefined") { url = null; }
543+
if (typeof data === "undefined") { data = null; }
544544
if (typeof format === "undefined") { format = Phaser.Tilemap.CSV; }
545545

546-
if (mapDataURL == null && mapData == null)
546+
if (url == null && data == null)
547547
{
548-
console.warn('Phaser.Loader.tilemap - Both mapDataURL and mapData are null. One must be set.');
548+
console.warn('Phaser.Loader.tilemap - Both url and data are null. One must be set.');
549549

550550
return this;
551551
}
552552

553553
// A map data object has been given
554-
if (mapData)
554+
if (data)
555555
{
556556
switch (format)
557557
{
@@ -562,18 +562,18 @@ Phaser.Loader.prototype = {
562562
// An xml string or object has been given
563563
case Phaser.Tilemap.TILED_JSON:
564564

565-
if (typeof mapData === 'string')
565+
if (typeof data === 'string')
566566
{
567-
mapData = JSON.parse(mapData);
567+
data = JSON.parse(data);
568568
}
569569
break;
570570
}
571571

572-
this.game.cache.addTilemap(key, null, mapData, format);
572+
this.game.cache.addTilemap(key, null, data, format);
573573
}
574574
else
575575
{
576-
this.addToFileList('tilemap', key, mapDataURL, { format: format });
576+
this.addToFileList('tilemap', key, url, { format: format });
577577
}
578578

579579
return this;
@@ -586,37 +586,37 @@ Phaser.Loader.prototype = {
586586
*
587587
* @method Phaser.Loader#physics
588588
* @param {string} key - Unique asset key of the physics json data.
589-
* @param {string} [dataURL] - The url of the map data file (csv/json)
590-
* @param {object} [jsonData] - An optional JSON data object. If given then the dataURL is ignored and this JSON object is used for physics data instead.
589+
* @param {string} [url] - The url of the map data file (csv/json)
590+
* @param {object} [data] - An optional JSON data object. If given then the url is ignored and this JSON object is used for physics data instead.
591591
* @param {string} [format=Phaser.Physics.LIME_CORONA_JSON] - The format of the physics data.
592592
* @return {Phaser.Loader} This Loader instance.
593593
*/
594-
physics: function (key, dataURL, jsonData, format) {
594+
physics: function (key, url, data, format) {
595595

596-
if (typeof dataURL === "undefined") { dataURL = null; }
597-
if (typeof jsonData === "undefined") { jsonData = null; }
596+
if (typeof url === "undefined") { url = null; }
597+
if (typeof data === "undefined") { data = null; }
598598
if (typeof format === "undefined") { format = Phaser.Physics.LIME_CORONA_JSON; }
599599

600-
if (dataURL == null && jsonData == null)
600+
if (url == null && data == null)
601601
{
602-
console.warn('Phaser.Loader.physics - Both dataURL and jsonData are null. One must be set.');
602+
console.warn('Phaser.Loader.physics - Both url and data are null. One must be set.');
603603

604604
return this;
605605
}
606606

607607
// A map data object has been given
608-
if (jsonData)
608+
if (data)
609609
{
610-
if (typeof jsonData === 'string')
610+
if (typeof data === 'string')
611611
{
612-
jsonData = JSON.parse(jsonData);
612+
data = JSON.parse(data);
613613
}
614614

615-
this.game.cache.addPhysicsData(key, null, jsonData, format);
615+
this.game.cache.addPhysicsData(key, null, data, format);
616616
}
617617
else
618618
{
619-
this.addToFileList('physics', key, dataURL, { format: format });
619+
this.addToFileList('physics', key, url, { format: format });
620620
}
621621

622622
return this;

0 commit comments

Comments
 (0)