You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/tilemaps/staticlayer/StaticTilemapLayer.js
+45-3Lines changed: 45 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -45,7 +45,7 @@ var Utils = require('../../renderer/webgl/Utils');
45
45
* @param {Phaser.Scene} scene - The Scene to which this Game Object belongs.
46
46
* @param {Phaser.Tilemaps.Tilemap} tilemap - The Tilemap this layer is a part of.
47
47
* @param {integer} layerIndex - The index of the LayerData associated with this layer.
48
-
* @param {(Phaser.Tilemaps.Tileset|Phaser.Tilemaps.Tileset[])} tileset - The tileset, or an array of tilesets, used to render this layer.
48
+
* @param {(string|string[]|Phaser.Tilemaps.Tileset|Phaser.Tilemaps.Tileset[])} tileset - The tileset, or an array of tilesets, used to render this layer. Can be a string or a Tileset object.
49
49
* @param {number} [x=0] - The world x position where the top left of this layer will be placed.
50
50
* @param {number} [y=0] - The world y position where the top left of this layer will be placed.
51
51
*/
@@ -122,10 +122,10 @@ var StaticTilemapLayer = new Class({
122
122
* As of Phaser 3.14 this property is now an array of Tileset objects, previously it was a single reference.
* @param {(string|string[]|Phaser.Tilemaps.Tileset|Phaser.Tilemaps.Tileset[])} tileset - The tileset, or an array of tilesets, used to render this layer. Can be a string or a Tileset object.
382
+
*/
383
+
setTilesets: function(tilesets)
384
+
{
385
+
varsetList=[];
386
+
varmap=this.tilemap;
387
+
388
+
if(!Array.isArray(tilesets))
389
+
{
390
+
tilesets=[tilesets];
391
+
}
392
+
393
+
for(vari=0;i<tilesets.length;i++)
394
+
{
395
+
varkey=tilesets[i];
396
+
397
+
if(typeofkey==='string')
398
+
{
399
+
vartileset=map.getTileset(key);
400
+
401
+
if(tileset)
402
+
{
403
+
setList.push(tileset);
404
+
}
405
+
}
406
+
else
407
+
{
408
+
setList.push(key);
409
+
}
410
+
}
411
+
412
+
this.tileset=setList;
413
+
},
414
+
373
415
/**
374
416
* Parses the tilesets that this Layer uses and constructs the
0 commit comments