6 using System.Globalization;
14 public int Width {
get;
private set;}
15 public int Height {
get;
private set;}
20 public TmxList<TmxTileset>
Tilesets {
get;
private set;}
21 public TmxList<TmxLayer>
Layers {
get;
private set;}
28 XDocument xDoc =
ReadXml(filename);
29 var xMap = xDoc.Element(
"map");
31 Version = (string)xMap.Attribute(
"version");
34 xMap.Attribute(
"orientation").Value,
36 Width = (int)xMap.Attribute(
"width");
37 Height = (int)xMap.Attribute(
"height");
38 TileWidth = (int)xMap.Attribute(
"tilewidth");
39 TileHeight = (int)xMap.Attribute(
"tileheight");
42 Tilesets =
new TmxList<TmxTileset>();
43 foreach (var e
in xMap.Elements(
"tileset"))
46 Layers =
new TmxList<TmxLayer>();
47 foreach (var e
in xMap.Elements(
"layer"))
51 foreach (var e
in xMap.Elements(
"objectgroup"))
55 foreach (var e
in xMap.Elements(
"imagelayer"))
int TileHeight
Pixel height of (smallest) tiles.
TmxColor BackgroundColor
Map background color.
int TileWidth
Pixel width of (smallest) tiles.
PropertyDict Properties
User-defined map properties.
string TmxDirectory
Parent directory of TMX file.
string Version
TMX format version.
int Height
Map height in tiles.
XDocument ReadXml(string filepath)
Parse XML content of TMX file.
TmxList< TmxObjectGroup > ObjectGroups
List of map object layers.
TmxList< TmxLayer > Layers
List of map layers.
TmxMap(string filename)
Map constructor.
int Width
Map width in tiles.
OrientationType Orientation
Map orientation.
TmxList< TmxTileset > Tilesets
List of map tilesets.
User-defined property list.
Container class for TMX map file.
OrientationType
Map orientation type.
TmxList< TmxImageLayer > ImageLayers
List of background image layers.