* Export tilemap to data format * 导出瓦片地图为数据格式 * @returns Tilemap data object | 瓦片地图数据对象
()
| 1171 | * @returns Tilemap data object | 瓦片地图数据对象 |
| 1172 | */ |
| 1173 | exportToData(): ITilemapData { |
| 1174 | return { |
| 1175 | name: 'Tilemap', |
| 1176 | version: 2, |
| 1177 | width: this._width, |
| 1178 | height: this._height, |
| 1179 | tileWidth: this.tileWidth, |
| 1180 | tileHeight: this.tileHeight, |
| 1181 | tilesets: this._tilesets.map((ts) => ({ ...ts })), |
| 1182 | layers: this._layers.map((layer) => ({ |
| 1183 | ...layer, |
| 1184 | data: [...layer.data] |
| 1185 | })), |
| 1186 | collisionData: this._collisionData.length > 0 ? Array.from(this._collisionData) : undefined |
| 1187 | }; |
| 1188 | } |
| 1189 | |
| 1190 | // ===== IResourceComponent 实现 ===== |
| 1191 |
no test coverage detected