mirror of
https://github.com/photonstorm/phaser
synced 2024-11-22 04:33:31 +00:00
Merge pull request #6542 from rui-han-crh/expose-layer-id
Expose layer id from Tiled map parser in LayerData and ObjectLayer
This commit is contained in:
commit
80515012bd
3 changed files with 22 additions and 0 deletions
|
@ -38,6 +38,17 @@ var LayerData = new Class({
|
|||
*/
|
||||
this.name = GetFastValue(config, 'name', 'layer');
|
||||
|
||||
/**
|
||||
* The id of the layer, as specified in the map data.
|
||||
*
|
||||
* Note: This is not the index of the layer in the map data, but its actual ID in Tiled.
|
||||
*
|
||||
* @name Phaser.Tilemaps.LayerData#id
|
||||
* @type {number}
|
||||
* @since 3.60.1
|
||||
*/
|
||||
this.id = GetFastValue(config, 'id', 0);
|
||||
|
||||
/**
|
||||
* The x offset of where to draw from the top left.
|
||||
*
|
||||
|
|
|
@ -40,6 +40,15 @@ var ObjectLayer = new Class({
|
|||
*/
|
||||
this.name = GetFastValue(config, 'name', 'object layer');
|
||||
|
||||
/**
|
||||
* The id of the object layer, as specified in the map data.
|
||||
*
|
||||
* @name Phaser.Tilemaps.ObjectLayer#id
|
||||
* @type {number}
|
||||
* @since 3.60.1
|
||||
*/
|
||||
this.id = GetFastValue(config, 'id', 0);
|
||||
|
||||
/**
|
||||
* The opacity of the layer, between 0 and 1.
|
||||
*
|
||||
|
|
|
@ -122,6 +122,7 @@ var ParseTileLayers = function (json, insertNull)
|
|||
|
||||
layerData = new LayerData({
|
||||
name: (curGroupState.name + curl.name),
|
||||
id: curl.id,
|
||||
x: (curGroupState.x + GetFastValue(curl, 'offsetx', 0) + layerOffsetX * json.tilewidth),
|
||||
y: (curGroupState.y + GetFastValue(curl, 'offsety', 0) + layerOffsetY * json.tileheight),
|
||||
width: curl.width,
|
||||
|
@ -202,6 +203,7 @@ var ParseTileLayers = function (json, insertNull)
|
|||
{
|
||||
layerData = new LayerData({
|
||||
name: (curGroupState.name + curl.name),
|
||||
id: curl.id,
|
||||
x: (curGroupState.x + GetFastValue(curl, 'offsetx', 0) + curl.x),
|
||||
y: (curGroupState.y + GetFastValue(curl, 'offsety', 0) + curl.y),
|
||||
width: curl.width,
|
||||
|
|
Loading…
Reference in a new issue