TiledMapContent.cs 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. // Copyright (c) Craftwork Games. All rights reserved.
  2. // Licensed under the MIT license.
  3. // See LICENSE file in the project root for full license information.
  4. using System.Collections.Generic;
  5. using System.Xml.Serialization;
  6. namespace MonoGame.Extended.Content.Tiled;
  7. [XmlRoot(ElementName = "map")]
  8. public class TiledMapContent
  9. {
  10. public TiledMapContent()
  11. {
  12. Properties = new List<TiledMapPropertyContent>();
  13. Tilesets = new List<TiledMapTilesetContent>();
  14. Layers = new List<TiledMapLayerContent>();
  15. }
  16. [XmlIgnore]
  17. public string Name { get; set; }
  18. [XmlIgnore]
  19. public string FilePath { get; set; }
  20. // Deprecated as of Tiled 1.9.0 (replaced by "class" attribute)
  21. [XmlAttribute(DataType = "string", AttributeName = "type")]
  22. public string Type { get; set; }
  23. [XmlAttribute(DataType = "string", AttributeName = "class")]
  24. public string Class { get; set; }
  25. [XmlAttribute(AttributeName = "version")]
  26. public string Version { get; set; }
  27. [XmlAttribute(AttributeName = "orientation")]
  28. public TiledMapOrientationContent Orientation { get; set; }
  29. [XmlAttribute(AttributeName = "renderorder")]
  30. public TiledMapTileDrawOrderContent RenderOrder { get; set; }
  31. [XmlAttribute(AttributeName = "backgroundcolor")]
  32. public string BackgroundColor { get; set; }
  33. [XmlAttribute(AttributeName = "width")]
  34. public int Width { get; set; }
  35. [XmlAttribute(AttributeName = "height")]
  36. public int Height { get; set; }
  37. [XmlAttribute(AttributeName = "tilewidth")]
  38. public int TileWidth { get; set; }
  39. [XmlAttribute(AttributeName = "tileheight")]
  40. public int TileHeight { get; set; }
  41. [XmlAttribute(AttributeName = "hexsidelength")]
  42. public int HexSideLength { get; set; }
  43. [XmlAttribute(AttributeName = "staggeraxis")]
  44. public TiledMapStaggerAxisContent StaggerAxis { get; set; }
  45. [XmlAttribute(AttributeName = "staggerindex")]
  46. public TiledMapStaggerIndexContent StaggerIndex { get; set; }
  47. [XmlElement(ElementName = "tileset")]
  48. public List<TiledMapTilesetContent> Tilesets { get; set; }
  49. [XmlElement(ElementName = "layer", Type = typeof(TiledMapTileLayerContent))]
  50. [XmlElement(ElementName = "imagelayer", Type = typeof(TiledMapImageLayerContent))]
  51. [XmlElement(ElementName = "objectgroup", Type = typeof(TiledMapObjectLayerContent))]
  52. [XmlElement(ElementName = "group", Type = typeof(TiledMapGroupLayerContent))]
  53. public List<TiledMapLayerContent> Layers { get; set; }
  54. [XmlArray("properties")]
  55. [XmlArrayItem("property")]
  56. public List<TiledMapPropertyContent> Properties { get; set; }
  57. }