diff --git a/src/DotTiled.Tests/TestData/Maps/map-override-object-bug/map-override-object-bug.cs b/src/DotTiled.Tests/TestData/Maps/map-override-object-bug/map-override-object-bug.cs index 82dfd29..be7c7c5 100644 --- a/src/DotTiled.Tests/TestData/Maps/map-override-object-bug/map-override-object-bug.cs +++ b/src/DotTiled.Tests/TestData/Maps/map-override-object-bug/map-override-object-bug.cs @@ -181,8 +181,8 @@ public partial class TestData { Format = ImageFormat.Png, Source = "tileset.png", - Width = fileExt == "tmx" ? 256u : 0, // Currently, json format does not - Height = fileExt == "tmx" ? 96u : 0 // include image dimensions in image layer https://github.com/mapeditor/tiled/issues/4028 + Width = fileExt == "tmx" ? 256 : 0, // Currently, json format does not + Height = fileExt == "tmx" ? 96 : 0 // include image dimensions in image layer https://github.com/mapeditor/tiled/issues/4028 }, RepeatX = true }, diff --git a/src/DotTiled.Tests/TestData/Maps/map-with-many-layers/map-with-many-layers.cs b/src/DotTiled.Tests/TestData/Maps/map-with-many-layers/map-with-many-layers.cs index 1b06285..807ef7e 100644 --- a/src/DotTiled.Tests/TestData/Maps/map-with-many-layers/map-with-many-layers.cs +++ b/src/DotTiled.Tests/TestData/Maps/map-with-many-layers/map-with-many-layers.cs @@ -172,8 +172,8 @@ public partial class TestData { Format = ImageFormat.Png, Source = "tileset.png", - Width = fileExt == "tmx" ? 256u : 0, // Currently, json format does not - Height = fileExt == "tmx" ? 96u : 0 // include image dimensions in image layer https://github.com/mapeditor/tiled/issues/4028 + Width = fileExt == "tmx" ? 256 : 0, // Currently, json format does not + Height = fileExt == "tmx" ? 96 : 0 // include image dimensions in image layer https://github.com/mapeditor/tiled/issues/4028 }, RepeatX = true }, diff --git a/src/DotTiled/Layers/Data.cs b/src/DotTiled/Layers/Data.cs index 16bf34e..958c2b3 100644 --- a/src/DotTiled/Layers/Data.cs +++ b/src/DotTiled/Layers/Data.cs @@ -90,12 +90,12 @@ public class Chunk /// /// The width of the chunk in tiles. /// - public required uint Width { get; set; } + public required int Width { get; set; } /// /// The height of the chunk in tiles. /// - public required uint Height { get; set; } + public required int Height { get; set; } /// /// The parsed chunk data, as a list of tile GIDs. diff --git a/src/DotTiled/Layers/ImageLayer.cs b/src/DotTiled/Layers/ImageLayer.cs index 5d8de82..6bd8ead 100644 --- a/src/DotTiled/Layers/ImageLayer.cs +++ b/src/DotTiled/Layers/ImageLayer.cs @@ -8,12 +8,12 @@ public class ImageLayer : BaseLayer /// /// The X position of the image layer in pixels. /// - public uint X { get; set; } = 0; + public int X { get; set; } = 0; /// /// The Y position of the image layer in pixels. /// - public Optional Y { get; set; } = 0; + public int Y { get; set; } = 0; /// /// Whether the image drawn by this layer is repeated along the X axis. diff --git a/src/DotTiled/Layers/ObjectLayer.cs b/src/DotTiled/Layers/ObjectLayer.cs index 77ecc02..b32a137 100644 --- a/src/DotTiled/Layers/ObjectLayer.cs +++ b/src/DotTiled/Layers/ObjectLayer.cs @@ -26,22 +26,22 @@ public class ObjectLayer : BaseLayer /// /// The X coordinate of the object layer in tiles. /// - public uint X { get; set; } = 0; + public int X { get; set; } = 0; /// /// The Y coordinate of the object layer in tiles. /// - public uint Y { get; set; } = 0; + public int Y { get; set; } = 0; /// /// The width of the object layer in tiles. Meaningless. /// - public uint Width { get; set; } = 0; + public int Width { get; set; } = 0; /// /// The height of the object layer in tiles. Meaningless. /// - public uint Height { get; set; } = 0; + public int Height { get; set; } = 0; /// /// A color that is multiplied with any tile objects drawn by this layer. diff --git a/src/DotTiled/Layers/TileLayer.cs b/src/DotTiled/Layers/TileLayer.cs index 631d205..8d63180 100644 --- a/src/DotTiled/Layers/TileLayer.cs +++ b/src/DotTiled/Layers/TileLayer.cs @@ -8,22 +8,22 @@ public class TileLayer : BaseLayer /// /// The X coordinate of the layer in tiles. /// - public uint X { get; set; } = 0; + public int X { get; set; } = 0; /// /// The Y coordinate of the layer in tiles. /// - public uint Y { get; set; } = 0; + public int Y { get; set; } = 0; /// /// The width of the layer in tiles. Always the same as the map width for fixed-size maps. /// - public required uint Width { get; set; } + public required int Width { get; set; } /// /// The height of the layer in tiles. Always the same as the map height for fixed-size maps. /// - public required uint Height { get; set; } + public required int Height { get; set; } /// /// The tile layer data. diff --git a/src/DotTiled/Map.cs b/src/DotTiled/Map.cs index eb3f92e..c9a8890 100644 --- a/src/DotTiled/Map.cs +++ b/src/DotTiled/Map.cs @@ -126,27 +126,27 @@ public class Map : HasPropertiesBase /// /// The width of the map in tiles. /// - public required uint Width { get; set; } + public required int Width { get; set; } /// /// The height of the map in tiles. /// - public required uint Height { get; set; } + public required int Height { get; set; } /// /// The width of a tile. /// - public required uint TileWidth { get; set; } + public required int TileWidth { get; set; } /// /// The height of a tile. /// - public required uint TileHeight { get; set; } + public required int TileHeight { get; set; } /// /// Only for hexagonal maps. Determines the width or height (depending on the staggered axis) of the tile's edge, in pixels. /// - public Optional HexSideLength { get; set; } = Optional.Empty; + public Optional HexSideLength { get; set; } = Optional.Empty; /// /// For staggered and hexagonal maps, determines which axis (X or Y) is staggered. diff --git a/src/DotTiled/Serialization/Tmj/TmjReaderBase.Data.cs b/src/DotTiled/Serialization/Tmj/TmjReaderBase.Data.cs index 47b9b75..afd6734 100644 --- a/src/DotTiled/Serialization/Tmj/TmjReaderBase.Data.cs +++ b/src/DotTiled/Serialization/Tmj/TmjReaderBase.Data.cs @@ -23,8 +23,8 @@ public abstract partial class TmjReaderBase var x = element.GetRequiredProperty("x"); var y = element.GetRequiredProperty("y"); - var width = element.GetRequiredProperty("width"); - var height = element.GetRequiredProperty("height"); + var width = element.GetRequiredProperty("width"); + var height = element.GetRequiredProperty("height"); return new Chunk { diff --git a/src/DotTiled/Serialization/Tmj/TmjReaderBase.ImageLayer.cs b/src/DotTiled/Serialization/Tmj/TmjReaderBase.ImageLayer.cs index 3d59779..32b5614 100644 --- a/src/DotTiled/Serialization/Tmj/TmjReaderBase.ImageLayer.cs +++ b/src/DotTiled/Serialization/Tmj/TmjReaderBase.ImageLayer.cs @@ -22,8 +22,8 @@ public abstract partial class TmjReaderBase var repeatX = element.GetOptionalProperty("repeatx").GetValueOr(false); var repeatY = element.GetOptionalProperty("repeaty").GetValueOr(false); var transparentColor = element.GetOptionalPropertyParseable("transparentcolor"); - var x = element.GetOptionalProperty("x").GetValueOr(0); - var y = element.GetOptionalProperty("y").GetValueOr(0); + var x = element.GetOptionalProperty("x").GetValueOr(0); + var y = element.GetOptionalProperty("y").GetValueOr(0); var imgModel = new Image { diff --git a/src/DotTiled/Serialization/Tmj/TmjReaderBase.Map.cs b/src/DotTiled/Serialization/Tmj/TmjReaderBase.Map.cs index caecb7e..f6924f4 100644 --- a/src/DotTiled/Serialization/Tmj/TmjReaderBase.Map.cs +++ b/src/DotTiled/Serialization/Tmj/TmjReaderBase.Map.cs @@ -28,11 +28,11 @@ public abstract partial class TmjReaderBase _ => throw new JsonException($"Unknown render order '{s}'") }).GetValueOr(RenderOrder.RightDown); var compressionLevel = element.GetOptionalProperty("compressionlevel").GetValueOr(-1); - var width = element.GetRequiredProperty("width"); - var height = element.GetRequiredProperty("height"); - var tileWidth = element.GetRequiredProperty("tilewidth"); - var tileHeight = element.GetRequiredProperty("tileheight"); - var hexSideLength = element.GetOptionalProperty("hexsidelength"); + var width = element.GetRequiredProperty("width"); + var height = element.GetRequiredProperty("height"); + var tileWidth = element.GetRequiredProperty("tilewidth"); + var tileHeight = element.GetRequiredProperty("tileheight"); + var hexSideLength = element.GetOptionalProperty("hexsidelength"); var staggerAxis = element.GetOptionalPropertyParseable("staggeraxis", s => s switch { "x" => StaggerAxis.X, diff --git a/src/DotTiled/Serialization/Tmj/TmjReaderBase.ObjectLayer.cs b/src/DotTiled/Serialization/Tmj/TmjReaderBase.ObjectLayer.cs index ced3f64..c43e40a 100644 --- a/src/DotTiled/Serialization/Tmj/TmjReaderBase.ObjectLayer.cs +++ b/src/DotTiled/Serialization/Tmj/TmjReaderBase.ObjectLayer.cs @@ -22,10 +22,10 @@ public abstract partial class TmjReaderBase var parallaxY = element.GetOptionalProperty("parallaxy").GetValueOr(1.0f); var properties = ResolveAndMergeProperties(@class, element.GetOptionalPropertyCustom("properties", ReadProperties).GetValueOr([])); - var x = element.GetOptionalProperty("x").GetValueOr(0); - var y = element.GetOptionalProperty("y").GetValueOr(0); - var width = element.GetOptionalProperty("width").GetValueOr(0); - var height = element.GetOptionalProperty("height").GetValueOr(0); + var x = element.GetOptionalProperty("x").GetValueOr(0); + var y = element.GetOptionalProperty("y").GetValueOr(0); + var width = element.GetOptionalProperty("width").GetValueOr(0); + var height = element.GetOptionalProperty("height").GetValueOr(0); var color = element.GetOptionalPropertyParseable("color"); var drawOrder = element.GetOptionalPropertyParseable("draworder", s => s switch { diff --git a/src/DotTiled/Serialization/Tmj/TmjReaderBase.TileLayer.cs b/src/DotTiled/Serialization/Tmj/TmjReaderBase.TileLayer.cs index f33840d..6482cf9 100644 --- a/src/DotTiled/Serialization/Tmj/TmjReaderBase.TileLayer.cs +++ b/src/DotTiled/Serialization/Tmj/TmjReaderBase.TileLayer.cs @@ -22,7 +22,7 @@ public abstract partial class TmjReaderBase var chunks = element.GetOptionalPropertyCustom("chunks", e => ReadDataAsChunks(e, compression, encoding)); var @class = element.GetOptionalProperty("class").GetValueOr(""); var data = element.GetOptionalPropertyCustom("data", e => ReadDataWithoutChunks(e, compression, encoding)); - var height = element.GetRequiredProperty("height"); + var height = element.GetRequiredProperty("height"); var id = element.GetRequiredProperty("id"); var name = element.GetRequiredProperty("name"); var offsetX = element.GetOptionalProperty("offsetx").GetValueOr(0.0f); @@ -38,9 +38,9 @@ public abstract partial class TmjReaderBase var tintColor = element.GetOptionalPropertyParseable("tintcolor"); var transparentColor = element.GetOptionalPropertyParseable("transparentcolor"); var visible = element.GetOptionalProperty("visible").GetValueOr(true); - var width = element.GetRequiredProperty("width"); - var x = element.GetRequiredProperty("x"); - var y = element.GetRequiredProperty("y"); + var width = element.GetRequiredProperty("width"); + var x = element.GetRequiredProperty("x"); + var y = element.GetRequiredProperty("y"); if (!data.HasValue && !chunks.HasValue) throw new JsonException("Tile layer does not contain data."); diff --git a/src/DotTiled/Serialization/Tmj/TmjReaderBase.Tileset.cs b/src/DotTiled/Serialization/Tmj/TmjReaderBase.Tileset.cs index 9263fa9..5190121 100644 --- a/src/DotTiled/Serialization/Tmj/TmjReaderBase.Tileset.cs +++ b/src/DotTiled/Serialization/Tmj/TmjReaderBase.Tileset.cs @@ -12,7 +12,7 @@ public abstract partial class TmjReaderBase { var backgroundColor = element.GetOptionalPropertyParseable("backgroundcolor"); var @class = element.GetOptionalProperty("class").GetValueOr(""); - var columns = element.GetOptionalProperty("columns"); + var columns = element.GetOptionalProperty("columns"); var fillMode = element.GetOptionalPropertyParseable("fillmode", s => s switch { "stretch" => FillMode.Stretch, @@ -22,9 +22,9 @@ public abstract partial class TmjReaderBase var firstGID = element.GetOptionalProperty("firstgid"); var grid = element.GetOptionalPropertyCustom("grid", ReadGrid); var image = element.GetOptionalProperty("image"); - var imageHeight = element.GetOptionalProperty("imageheight"); - var imageWidth = element.GetOptionalProperty("imagewidth"); - var margin = element.GetOptionalProperty("margin"); + var imageHeight = element.GetOptionalProperty("imageheight"); + var imageWidth = element.GetOptionalProperty("imagewidth"); + var margin = element.GetOptionalProperty("margin"); var name = element.GetOptionalProperty("name"); var objectAlignment = element.GetOptionalPropertyParseable("objectalignment", s => s switch { @@ -42,10 +42,10 @@ public abstract partial class TmjReaderBase }).GetValueOr(ObjectAlignment.Unspecified); var properties = ResolveAndMergeProperties(@class, element.GetOptionalPropertyCustom("properties", ReadProperties).GetValueOr([])); var source = element.GetOptionalProperty("source"); - var spacing = element.GetOptionalProperty("spacing"); - var tileCount = element.GetOptionalProperty("tilecount"); + var spacing = element.GetOptionalProperty("spacing"); + var tileCount = element.GetOptionalProperty("tilecount"); var tiledVersion = element.GetOptionalProperty("tiledversion").GetValueOrOptional(parentTiledVersion); - var tileHeight = element.GetOptionalProperty("tileheight"); + var tileHeight = element.GetOptionalProperty("tileheight"); var tileOffset = element.GetOptionalPropertyCustom("tileoffset", ReadTileOffset); var tileRenderSize = element.GetOptionalPropertyParseable("tilerendersize", s => s switch { @@ -54,7 +54,7 @@ public abstract partial class TmjReaderBase _ => throw new JsonException($"Unknown tile render size '{s}'") }).GetValueOr(TileRenderSize.Tile); var tiles = element.GetOptionalPropertyCustom>("tiles", ReadTiles).GetValueOr([]); - var tileWidth = element.GetOptionalProperty("tilewidth"); + var tileWidth = element.GetOptionalProperty("tilewidth"); var transparentColor = element.GetOptionalPropertyParseable("transparentcolor"); var type = element.GetOptionalProperty("type"); var version = element.GetOptionalProperty("version").GetValueOrOptional(parentVersion); @@ -129,8 +129,8 @@ public abstract partial class TmjReaderBase "isometric" => GridOrientation.Isometric, _ => throw new JsonException($"Unknown grid orientation '{s}'") }).GetValueOr(GridOrientation.Orthogonal); - var height = element.GetRequiredProperty("height"); - var width = element.GetRequiredProperty("width"); + var height = element.GetRequiredProperty("height"); + var width = element.GetRequiredProperty("width"); return new Grid { @@ -158,12 +158,12 @@ public abstract partial class TmjReaderBase var animation = e.GetOptionalPropertyCustom>("animation", e => e.GetValueAsList(ReadFrame)).GetValueOr([]); var id = e.GetRequiredProperty("id"); var image = e.GetOptionalProperty("image"); - var imageHeight = e.GetOptionalProperty("imageheight"); - var imageWidth = e.GetOptionalProperty("imagewidth"); - var x = e.GetOptionalProperty("x").GetValueOr(0); - var y = e.GetOptionalProperty("y").GetValueOr(0); - var width = e.GetOptionalProperty("width").GetValueOr(imageWidth.GetValueOr(0)); - var height = e.GetOptionalProperty("height").GetValueOr(imageHeight.GetValueOr(0)); + var imageHeight = e.GetOptionalProperty("imageheight"); + var imageWidth = e.GetOptionalProperty("imagewidth"); + var x = e.GetOptionalProperty("x").GetValueOr(0); + var y = e.GetOptionalProperty("y").GetValueOr(0); + var width = e.GetOptionalProperty("width").GetValueOr(imageWidth.GetValueOr(0)); + var height = e.GetOptionalProperty("height").GetValueOr(imageHeight.GetValueOr(0)); var objectGroup = e.GetOptionalPropertyCustom("objectgroup", e => ReadObjectLayer(e)); var probability = e.GetOptionalProperty("probability").GetValueOr(0.0f); var type = e.GetOptionalProperty("type").GetValueOr(""); @@ -195,7 +195,7 @@ public abstract partial class TmjReaderBase internal static Frame ReadFrame(JsonElement element) { - var duration = element.GetRequiredProperty("duration"); + var duration = element.GetRequiredProperty("duration"); var tileID = element.GetRequiredProperty("tileid"); return new Frame diff --git a/src/DotTiled/Serialization/Tmx/TmxReaderBase.Chunk.cs b/src/DotTiled/Serialization/Tmx/TmxReaderBase.Chunk.cs index be10819..31a21f6 100644 --- a/src/DotTiled/Serialization/Tmx/TmxReaderBase.Chunk.cs +++ b/src/DotTiled/Serialization/Tmx/TmxReaderBase.Chunk.cs @@ -6,8 +6,8 @@ public abstract partial class TmxReaderBase { var x = _reader.GetRequiredAttributeParseable("x"); var y = _reader.GetRequiredAttributeParseable("y"); - var width = _reader.GetRequiredAttributeParseable("width"); - var height = _reader.GetRequiredAttributeParseable("height"); + var width = _reader.GetRequiredAttributeParseable("width"); + var height = _reader.GetRequiredAttributeParseable("height"); var usesTileChildrenInsteadOfRawData = !encoding.HasValue; if (usesTileChildrenInsteadOfRawData) diff --git a/src/DotTiled/Serialization/Tmx/TmxReaderBase.Map.cs b/src/DotTiled/Serialization/Tmx/TmxReaderBase.Map.cs index ed3a492..ee9fe09 100644 --- a/src/DotTiled/Serialization/Tmx/TmxReaderBase.Map.cs +++ b/src/DotTiled/Serialization/Tmx/TmxReaderBase.Map.cs @@ -32,11 +32,11 @@ public abstract partial class TmxReaderBase _ => throw new InvalidOperationException($"Unknown render order '{s}'") }).GetValueOr(RenderOrder.RightDown); var compressionLevel = _reader.GetOptionalAttributeParseable("compressionlevel").GetValueOr(-1); - var width = _reader.GetRequiredAttributeParseable("width"); - var height = _reader.GetRequiredAttributeParseable("height"); - var tileWidth = _reader.GetRequiredAttributeParseable("tilewidth"); - var tileHeight = _reader.GetRequiredAttributeParseable("tileheight"); - var hexSideLength = _reader.GetOptionalAttributeParseable("hexsidelength"); + var width = _reader.GetRequiredAttributeParseable("width"); + var height = _reader.GetRequiredAttributeParseable("height"); + var tileWidth = _reader.GetRequiredAttributeParseable("tilewidth"); + var tileHeight = _reader.GetRequiredAttributeParseable("tileheight"); + var hexSideLength = _reader.GetOptionalAttributeParseable("hexsidelength"); var staggerAxis = _reader.GetOptionalAttributeEnum("staggeraxis", s => s switch { "x" => StaggerAxis.X, diff --git a/src/DotTiled/Serialization/Tmx/TmxReaderBase.ObjectLayer.cs b/src/DotTiled/Serialization/Tmx/TmxReaderBase.ObjectLayer.cs index b2e0c56..3799f9f 100644 --- a/src/DotTiled/Serialization/Tmx/TmxReaderBase.ObjectLayer.cs +++ b/src/DotTiled/Serialization/Tmx/TmxReaderBase.ObjectLayer.cs @@ -14,10 +14,10 @@ public abstract partial class TmxReaderBase var id = _reader.GetRequiredAttributeParseable("id"); var name = _reader.GetOptionalAttribute("name").GetValueOr(""); var @class = _reader.GetOptionalAttribute("class").GetValueOr(""); - var x = _reader.GetOptionalAttributeParseable("x").GetValueOr(0); - var y = _reader.GetOptionalAttributeParseable("y").GetValueOr(0); - var width = _reader.GetOptionalAttributeParseable("width").GetValueOr(0); - var height = _reader.GetOptionalAttributeParseable("height").GetValueOr(0); + var x = _reader.GetOptionalAttributeParseable("x").GetValueOr(0); + var y = _reader.GetOptionalAttributeParseable("y").GetValueOr(0); + var width = _reader.GetOptionalAttributeParseable("width").GetValueOr(0); + var height = _reader.GetOptionalAttributeParseable("height").GetValueOr(0); var opacity = _reader.GetOptionalAttributeParseable("opacity").GetValueOr(1.0f); var visible = _reader.GetOptionalAttributeParseable("visible").GetValueOr(1) == 1; var tintColor = _reader.GetOptionalAttributeClass("tintcolor"); diff --git a/src/DotTiled/Serialization/Tmx/TmxReaderBase.TileLayer.cs b/src/DotTiled/Serialization/Tmx/TmxReaderBase.TileLayer.cs index 974215b..bc0042b 100644 --- a/src/DotTiled/Serialization/Tmx/TmxReaderBase.TileLayer.cs +++ b/src/DotTiled/Serialization/Tmx/TmxReaderBase.TileLayer.cs @@ -10,10 +10,10 @@ public abstract partial class TmxReaderBase var id = _reader.GetRequiredAttributeParseable("id"); var name = _reader.GetOptionalAttribute("name").GetValueOr(""); var @class = _reader.GetOptionalAttribute("class").GetValueOr(""); - var x = _reader.GetOptionalAttributeParseable("x").GetValueOr(0); - var y = _reader.GetOptionalAttributeParseable("y").GetValueOr(0); - var width = _reader.GetRequiredAttributeParseable("width"); - var height = _reader.GetRequiredAttributeParseable("height"); + var x = _reader.GetOptionalAttributeParseable("x").GetValueOr(0); + var y = _reader.GetOptionalAttributeParseable("y").GetValueOr(0); + var width = _reader.GetRequiredAttributeParseable("width"); + var height = _reader.GetRequiredAttributeParseable("height"); var opacity = _reader.GetOptionalAttributeParseable("opacity").GetValueOr(1.0f); var visible = _reader.GetOptionalAttributeParseable("visible").GetValueOr(1) == 1; var tintColor = _reader.GetOptionalAttributeClass("tintcolor"); @@ -59,8 +59,8 @@ public abstract partial class TmxReaderBase var id = _reader.GetRequiredAttributeParseable("id"); var name = _reader.GetOptionalAttribute("name").GetValueOr(""); var @class = _reader.GetOptionalAttribute("class").GetValueOr(""); - var x = _reader.GetOptionalAttributeParseable("x").GetValueOr(0); - var y = _reader.GetOptionalAttributeParseable("y").GetValueOr(0); + var x = _reader.GetOptionalAttributeParseable("x").GetValueOr(0); + var y = _reader.GetOptionalAttributeParseable("y").GetValueOr(0); var opacity = _reader.GetOptionalAttributeParseable("opacity").GetValueOr(1f); var visible = _reader.GetOptionalAttributeParseable("visible").GetValueOr(true); var tintColor = _reader.GetOptionalAttributeClass("tintcolor"); diff --git a/src/DotTiled/Serialization/Tmx/TmxReaderBase.Tileset.cs b/src/DotTiled/Serialization/Tmx/TmxReaderBase.Tileset.cs index bc7e0e8..5d3671d 100644 --- a/src/DotTiled/Serialization/Tmx/TmxReaderBase.Tileset.cs +++ b/src/DotTiled/Serialization/Tmx/TmxReaderBase.Tileset.cs @@ -31,12 +31,12 @@ public abstract partial class TmxReaderBase var tiledVersion = _reader.GetOptionalAttribute("tiledversion").GetValueOrOptional(parentTiledVersion); var name = _reader.GetRequiredAttribute("name"); var @class = _reader.GetOptionalAttribute("class").GetValueOr(""); - var tileWidth = _reader.GetRequiredAttributeParseable("tilewidth"); - var tileHeight = _reader.GetRequiredAttributeParseable("tileheight"); - var spacing = _reader.GetOptionalAttributeParseable("spacing").GetValueOr(0); - var margin = _reader.GetOptionalAttributeParseable("margin").GetValueOr(0); - var tileCount = _reader.GetRequiredAttributeParseable("tilecount"); - var columns = _reader.GetRequiredAttributeParseable("columns"); + var tileWidth = _reader.GetRequiredAttributeParseable("tilewidth"); + var tileHeight = _reader.GetRequiredAttributeParseable("tileheight"); + var spacing = _reader.GetOptionalAttributeParseable("spacing").GetValueOr(0); + var margin = _reader.GetOptionalAttributeParseable("margin").GetValueOr(0); + var tileCount = _reader.GetRequiredAttributeParseable("tilecount"); + var columns = _reader.GetRequiredAttributeParseable("columns"); var objectAlignment = _reader.GetOptionalAttributeEnum("objectalignment", s => s switch { "unspecified" => ObjectAlignment.Unspecified, @@ -126,8 +126,8 @@ public abstract partial class TmxReaderBase }); var source = _reader.GetOptionalAttribute("source"); var transparentColor = _reader.GetOptionalAttributeClass("trans"); - var width = _reader.GetOptionalAttributeParseable("width"); - var height = _reader.GetOptionalAttributeParseable("height"); + var width = _reader.GetOptionalAttributeParseable("width"); + var height = _reader.GetOptionalAttributeParseable("height"); _reader.ProcessChildren("image", (r, elementName) => elementName switch { @@ -167,8 +167,8 @@ public abstract partial class TmxReaderBase "isometric" => GridOrientation.Isometric, _ => throw new InvalidOperationException($"Unknown orientation '{s}'") }).GetValueOr(GridOrientation.Orthogonal); - var width = _reader.GetRequiredAttributeParseable("width"); - var height = _reader.GetRequiredAttributeParseable("height"); + var width = _reader.GetRequiredAttributeParseable("width"); + var height = _reader.GetRequiredAttributeParseable("height"); _reader.ReadStartElement("grid"); return new Grid { Orientation = orientation, Width = width, Height = height }; @@ -192,10 +192,10 @@ public abstract partial class TmxReaderBase var id = _reader.GetRequiredAttributeParseable("id"); var type = _reader.GetOptionalAttribute("type").GetValueOr(""); var probability = _reader.GetOptionalAttributeParseable("probability").GetValueOr(0f); - var x = _reader.GetOptionalAttributeParseable("x").GetValueOr(0); - var y = _reader.GetOptionalAttributeParseable("y").GetValueOr(0); - var width = _reader.GetOptionalAttributeParseable("width"); - var height = _reader.GetOptionalAttributeParseable("height"); + var x = _reader.GetOptionalAttributeParseable("x").GetValueOr(0); + var y = _reader.GetOptionalAttributeParseable("y").GetValueOr(0); + var width = _reader.GetOptionalAttributeParseable("width"); + var height = _reader.GetOptionalAttributeParseable("height"); // Elements var propertiesCounter = 0; @@ -212,7 +212,7 @@ public abstract partial class TmxReaderBase "animation" => () => Helpers.SetAtMostOnce(ref animation, r.ReadList("animation", "frame", (ar) => { var tileID = ar.GetRequiredAttributeParseable("tileid"); - var duration = ar.GetRequiredAttributeParseable("duration"); + var duration = ar.GetRequiredAttributeParseable("duration"); return new Frame { TileID = tileID, Duration = duration }; }), "Animation"), _ => r.Skip diff --git a/src/DotTiled/Tilesets/Frame.cs b/src/DotTiled/Tilesets/Frame.cs index ff37133..fe76b22 100644 --- a/src/DotTiled/Tilesets/Frame.cs +++ b/src/DotTiled/Tilesets/Frame.cs @@ -13,5 +13,5 @@ public class Frame /// /// How long (in milliseconds) this frame should be displayed before advancing to the next frame. /// - public required uint Duration { get; set; } + public required int Duration { get; set; } } diff --git a/src/DotTiled/Tilesets/Grid.cs b/src/DotTiled/Tilesets/Grid.cs index c063dd1..a50ed54 100644 --- a/src/DotTiled/Tilesets/Grid.cs +++ b/src/DotTiled/Tilesets/Grid.cs @@ -29,10 +29,10 @@ public class Grid /// /// Width of a grid cell. /// - public required uint Width { get; set; } + public required int Width { get; set; } /// /// Height of a grid cell. /// - public required uint Height { get; set; } + public required int Height { get; set; } } diff --git a/src/DotTiled/Tilesets/Image.cs b/src/DotTiled/Tilesets/Image.cs index 5a2e49c..4be1aac 100644 --- a/src/DotTiled/Tilesets/Image.cs +++ b/src/DotTiled/Tilesets/Image.cs @@ -49,10 +49,10 @@ public class Image /// /// The image width in pixels, used for tile index correction when the image changes. /// - public Optional Width { get; set; } = Optional.Empty; + public Optional Width { get; set; } = Optional.Empty; /// /// The image height in pixels, used for tile index correction when the image changes. /// - public Optional Height { get; set; } = Optional.Empty; + public Optional Height { get; set; } = Optional.Empty; } diff --git a/src/DotTiled/Tilesets/Tile.cs b/src/DotTiled/Tilesets/Tile.cs index 6b679e1..0f8addb 100644 --- a/src/DotTiled/Tilesets/Tile.cs +++ b/src/DotTiled/Tilesets/Tile.cs @@ -26,22 +26,22 @@ public class Tile : HasPropertiesBase /// /// The X position of the sub-rectangle representing this tile within the tileset image. /// - public uint X { get; set; } = 0; + public int X { get; set; } = 0; /// /// The Y position of the sub-rectangle representing this tile within the tileset image. /// - public uint Y { get; set; } = 0; + public int Y { get; set; } = 0; /// /// The width of the sub-rectangle representing this tile within the tileset image. /// - public required uint Width { get; set; } + public required int Width { get; set; } /// /// The height of the sub-rectangle representing this tile within the tileset image. /// - public required uint Height { get; set; } + public required int Height { get; set; } /// /// Tile properties. diff --git a/src/DotTiled/Tilesets/Tileset.cs b/src/DotTiled/Tilesets/Tileset.cs index 65d66f6..b258705 100644 --- a/src/DotTiled/Tilesets/Tileset.cs +++ b/src/DotTiled/Tilesets/Tileset.cs @@ -128,32 +128,32 @@ public class Tileset : HasPropertiesBase /// /// The width of the tiles in this tileset, which should be at least 1 (non-zero) except in the case of image collection tilesets (in which case it stores the maximum tile width). /// - public required uint TileWidth { get; set; } + public required int TileWidth { get; set; } /// /// The height of the tiles in this tileset, which should be at least 1 (non-zero) except in the case of image collection tilesets (in which case it stores the maximum tile height). /// - public required uint TileHeight { get; set; } + public required int TileHeight { get; set; } /// /// The spacing in pixels between the tiles in this tileset (applies to the tileset image). Irrelevant for image collection tilesets. /// - public uint Spacing { get; set; } = 0; + public int Spacing { get; set; } = 0; /// /// The margin around the tiles in this tileset (applies to the tileset image). Irrelevant for image collection tilesets. /// - public uint Margin { get; set; } = 0; + public int Margin { get; set; } = 0; /// /// The number of tiles in this tileset. /// - public required uint TileCount { get; set; } + public required int TileCount { get; set; } /// /// The number of tile columns in the tileset. /// - public required uint Columns { get; set; } + public required int Columns { get; set; } /// /// Controls the aligntment for tile objects.