Files
MonoGame.Extended/Source/MonoGame.Extended.Tiled/Serialization/TiledMapTilesetContent.cs
T
Dylan Wilson e962cec448 A mix between Tiled and GUI stuff (#553)
* mostly restored the tiled importer unit tests

* code cleanup

* code cleanup

* almost got tiled maps serialization independent of the content pipeline

* refactored the tiled map content importer so that tiled maps can be loaded at runtime

* code cleanup

* removed nuspec files

* experimenting with an XML based GUI markup parser

* a few more markup parser features

* finally got a working open file dialog

* experimenting with markup bindings

* attached properties

* working on the gui stuff again

* working on a better textbox

* multiline textboxing

* new text box is really coming along

* removed the content explorer experiment

* restored the old gui demo back to the way it was before (for now)
2018-10-09 22:18:48 +10:00

72 lines
2.2 KiB
C#

using System.Collections.Generic;
using System.Xml.Serialization;
namespace MonoGame.Extended.Tiled.Serialization
{
[XmlRoot(ElementName = "tileset")]
public class TiledMapTilesetContent
{
public TiledMapTilesetContent()
{
TileOffset = new TiledMapTileOffsetContent();
Tiles = new List<TiledMapTilesetTileContent>();
Properties = new List<TiledMapPropertyContent>();
}
//[XmlIgnore]
//public ExternalReference<TiledMapTilesetContent> Content { get; set; }
[XmlAttribute(AttributeName = "firstgid")]
public int FirstGlobalIdentifier { get; set; }
[XmlAttribute(AttributeName = "source")]
public string Source { get; set; }
[XmlAttribute(AttributeName = "name")]
public string Name { get; set; }
[XmlAttribute(AttributeName = "tilewidth")]
public int TileWidth { get; set; }
[XmlAttribute(AttributeName = "tileheight")]
public int TileHeight { get; set; }
[XmlAttribute(AttributeName = "spacing")]
public int Spacing { get; set; }
[XmlAttribute(AttributeName = "margin")]
public int Margin { get; set; }
[XmlAttribute(AttributeName = "columns")]
public int Columns { get; set; }
[XmlAttribute(AttributeName = "tilecount")]
public int TileCount { get; set; }
[XmlElement(ElementName = "tileoffset")]
public TiledMapTileOffsetContent TileOffset { get; set; }
[XmlElement(ElementName = "grid")]
public TiledMapTilesetGridContent Grid { get; set; }
[XmlElement(ElementName = "tile")]
public List<TiledMapTilesetTileContent> Tiles { get; set; }
[XmlArray("properties")]
[XmlArrayItem("property")]
public List<TiledMapPropertyContent> Properties { get; set; }
[XmlElement(ElementName = "image")]
public TiledMapImageContent Image { get; set; }
public bool ContainsGlobalIdentifier(int globalIdentifier)
{
return (globalIdentifier >= FirstGlobalIdentifier) && (globalIdentifier < FirstGlobalIdentifier + TileCount);
}
public override string ToString()
{
return $"{Name}: {Image}";
}
}
}