DFTileMap.fromJson constructor
DFTileMap.fromJson(
- Map<String, dynamic> json
)
Implementation
DFTileMap.fromJson(Map<String, dynamic> json) {
compressionLevel = json['compressionlevel'];
height = json['height'];
infinite = json['infinite'];
if (json['layers'] != null) {
layers = <DFMapLayer>[];
json['layers'].forEach((v) {
if (v['type'] == DFLayerType.tileLayer) {
layers?.add(DFTileLayer.fromJson(v));
} else if (v['type'] == DFLayerType.objectGroup) {
layers?.add(DFObjectGroup.fromJson(v));
} else if (v['type'] == DFLayerType.imageLayer) {
layers?.add(DFImageLayer.fromJson(v));
} else if (v['type'] == DFLayerType.group) {
layers?.add(DFGroupLayer.fromJson(v));
} else {
layers?.add(DFMapLayer.fromJson(v));
}
});
}
nextLayerId = json['nextlayerid'];
nextObjectId = json['nextobjectid'];
orientation = json['orientation'];
renderOrder = json['renderorder'];
tiledVersion = json['tiledversion'];
tileHeight = json['tileheight'];
if (json['tilesets'] != null) {
tileSets = <DFTileSet>[];
json['tilesets'].forEach((v) {
tileSets?.add(DFTileSet.fromJson(v));
});
}
tileWidth = json['tilewidth'];
type = json['type'];
version = double.tryParse(json['version'].toString()) ?? 0.0;
width = json['width'];
backgroundColor = json['backgroundcolor'];
hexSideLength = json['hexsidelength'];
staggerAxis = json['staggeraxis'];
staggerIndex = json['staggerindex'];
}