diff --git a/src/DotTiled.Tests/IntegrationTests/CustomTypes/FromTypeUsedInLoaderTests.cs b/src/DotTiled.Tests/IntegrationTests/CustomTypes/FromTypeUsedInLoaderTests.cs index c0d580f..4b4c226 100644 --- a/src/DotTiled.Tests/IntegrationTests/CustomTypes/FromTypeUsedInLoaderTests.cs +++ b/src/DotTiled.Tests/IntegrationTests/CustomTypes/FromTypeUsedInLoaderTests.cs @@ -48,7 +48,7 @@ public class FromTypeUsedInLoaderTests ParallaxOriginY = 0, RenderOrder = RenderOrder.RightDown, CompressionLevel = -1, - BackgroundColor = new Color { R = 0, G = 0, B = 0, A = 0 }, + BackgroundColor = new TiledColor { R = 0, G = 0, B = 0, A = 0 }, Version = "1.10", TiledVersion = "1.11.0", NextLayerID = 2, @@ -133,7 +133,7 @@ public class FromTypeUsedInLoaderTests ParallaxOriginY = 0, RenderOrder = RenderOrder.RightDown, CompressionLevel = -1, - BackgroundColor = new Color { R = 0, G = 0, B = 0, A = 0 }, + BackgroundColor = new TiledColor { R = 0, G = 0, B = 0, A = 0 }, Version = "1.10", TiledVersion = "1.11.0", NextLayerID = 2, @@ -226,7 +226,7 @@ public class FromTypeUsedInLoaderTests ParallaxOriginY = 0, RenderOrder = RenderOrder.RightDown, CompressionLevel = -1, - BackgroundColor = new Color { R = 0, G = 0, B = 0, A = 0 }, + BackgroundColor = new TiledColor { R = 0, G = 0, B = 0, A = 0 }, Version = "1.10", TiledVersion = "1.11.0", NextLayerID = 2, diff --git a/src/DotTiled.Tests/TestData/Maps/default-map/default-map.cs b/src/DotTiled.Tests/TestData/Maps/default-map/default-map.cs index 8aeae0d..cee4c6b 100644 --- a/src/DotTiled.Tests/TestData/Maps/default-map/default-map.cs +++ b/src/DotTiled.Tests/TestData/Maps/default-map/default-map.cs @@ -15,7 +15,7 @@ public partial class TestData ParallaxOriginY = 0, RenderOrder = RenderOrder.RightDown, CompressionLevel = -1, - BackgroundColor = new Color { R = 0, G = 0, B = 0, A = 0 }, + BackgroundColor = new TiledColor { R = 0, G = 0, B = 0, A = 0 }, Version = "1.10", TiledVersion = "1.11.0", NextLayerID = 2, diff --git a/src/DotTiled.Tests/TestData/Maps/map-external-tileset-multi/map-external-tileset-multi.cs b/src/DotTiled.Tests/TestData/Maps/map-external-tileset-multi/map-external-tileset-multi.cs index 2500a4d..93c4c31 100644 --- a/src/DotTiled.Tests/TestData/Maps/map-external-tileset-multi/map-external-tileset-multi.cs +++ b/src/DotTiled.Tests/TestData/Maps/map-external-tileset-multi/map-external-tileset-multi.cs @@ -17,7 +17,7 @@ public partial class TestData ParallaxOriginY = 0, RenderOrder = RenderOrder.RightDown, CompressionLevel = -1, - BackgroundColor = Color.Parse("#00000000", CultureInfo.InvariantCulture), + BackgroundColor = TiledColor.Parse("#00000000", CultureInfo.InvariantCulture), Version = "1.10", TiledVersion = "1.11.0", NextLayerID = 2, @@ -47,7 +47,7 @@ public partial class TestData }, Properties = [ new BoolProperty { Name = "tilesetbool", Value = true }, - new ColorProperty { Name = "tilesetcolor", Value = Color.Parse("#ffff0000", CultureInfo.InvariantCulture) }, + new ColorProperty { Name = "tilesetcolor", Value = TiledColor.Parse("#ffff0000", CultureInfo.InvariantCulture) }, new FileProperty { Name = "tilesetfile", Value = "" }, new FloatProperty { Name = "tilesetfloat", Value = 5.2f }, new IntProperty { Name = "tilesetint", Value = 9 }, diff --git a/src/DotTiled.Tests/TestData/Maps/map-external-tileset-wangset/map-external-tileset-wangset.cs b/src/DotTiled.Tests/TestData/Maps/map-external-tileset-wangset/map-external-tileset-wangset.cs index 756c59f..164aa0e 100644 --- a/src/DotTiled.Tests/TestData/Maps/map-external-tileset-wangset/map-external-tileset-wangset.cs +++ b/src/DotTiled.Tests/TestData/Maps/map-external-tileset-wangset/map-external-tileset-wangset.cs @@ -17,7 +17,7 @@ public partial class TestData ParallaxOriginY = 0, RenderOrder = RenderOrder.RightDown, CompressionLevel = -1, - BackgroundColor = Color.Parse("#00000000", CultureInfo.InvariantCulture), + BackgroundColor = TiledColor.Parse("#00000000", CultureInfo.InvariantCulture), Version = "1.10", TiledVersion = "1.11.0", NextLayerID = 2, @@ -63,21 +63,21 @@ public partial class TestData new WangColor { Name = "Water", - Color = Color.Parse("#ff0000", CultureInfo.InvariantCulture), + Color = TiledColor.Parse("#ff0000", CultureInfo.InvariantCulture), Tile = 0, Probability = 1 }, new WangColor { Name = "Grass", - Color = Color.Parse("#00ff00", CultureInfo.InvariantCulture), + Color = TiledColor.Parse("#00ff00", CultureInfo.InvariantCulture), Tile = -1, Probability = 1 }, new WangColor { Name = "Stone", - Color = Color.Parse("#0000ff", CultureInfo.InvariantCulture), + Color = TiledColor.Parse("#0000ff", CultureInfo.InvariantCulture), Tile = 29, Probability = 1 } 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 be7c7c5..32755ca 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 @@ -17,7 +17,7 @@ public partial class TestData ParallaxOriginY = 0, RenderOrder = RenderOrder.RightDown, CompressionLevel = -1, - BackgroundColor = new Color { R = 0, G = 0, B = 0, A = 0 }, + BackgroundColor = new TiledColor { R = 0, G = 0, B = 0, A = 0 }, Version = "1.10", TiledVersion = "1.11.0", NextLayerID = 8, diff --git a/src/DotTiled.Tests/TestData/Maps/map-with-class-and-props/map-with-class-and-props.cs b/src/DotTiled.Tests/TestData/Maps/map-with-class-and-props/map-with-class-and-props.cs index 8cbd6bd..0511454 100644 --- a/src/DotTiled.Tests/TestData/Maps/map-with-class-and-props/map-with-class-and-props.cs +++ b/src/DotTiled.Tests/TestData/Maps/map-with-class-and-props/map-with-class-and-props.cs @@ -15,7 +15,7 @@ public partial class TestData ParallaxOriginY = 0, RenderOrder = RenderOrder.RightDown, CompressionLevel = -1, - BackgroundColor = new Color { R = 0, G = 0, B = 0, A = 0 }, + BackgroundColor = new TiledColor { R = 0, G = 0, B = 0, A = 0 }, Version = "1.10", TiledVersion = "1.11.0", NextLayerID = 2, diff --git a/src/DotTiled.Tests/TestData/Maps/map-with-class/map-with-class.cs b/src/DotTiled.Tests/TestData/Maps/map-with-class/map-with-class.cs index ef98d02..d1e7d7b 100644 --- a/src/DotTiled.Tests/TestData/Maps/map-with-class/map-with-class.cs +++ b/src/DotTiled.Tests/TestData/Maps/map-with-class/map-with-class.cs @@ -15,7 +15,7 @@ public partial class TestData ParallaxOriginY = 0, RenderOrder = RenderOrder.RightDown, CompressionLevel = -1, - BackgroundColor = new Color { R = 0, G = 0, B = 0, A = 0 }, + BackgroundColor = new TiledColor { R = 0, G = 0, B = 0, A = 0 }, Version = "1.10", TiledVersion = "1.11.0", NextLayerID = 2, diff --git a/src/DotTiled.Tests/TestData/Maps/map-with-common-props/map-with-common-props.cs b/src/DotTiled.Tests/TestData/Maps/map-with-common-props/map-with-common-props.cs index 2437d0b..ff184ff 100644 --- a/src/DotTiled.Tests/TestData/Maps/map-with-common-props/map-with-common-props.cs +++ b/src/DotTiled.Tests/TestData/Maps/map-with-common-props/map-with-common-props.cs @@ -17,7 +17,7 @@ public partial class TestData ParallaxOriginY = 0, RenderOrder = RenderOrder.RightDown, CompressionLevel = -1, - BackgroundColor = Color.Parse("#00ff00", CultureInfo.InvariantCulture), + BackgroundColor = TiledColor.Parse("#00ff00", CultureInfo.InvariantCulture), Version = "1.10", TiledVersion = "1.11.0", NextLayerID = 2, @@ -52,13 +52,13 @@ public partial class TestData Properties = [ new BoolProperty { Name = "boolprop", Value = true }, - new ColorProperty { Name = "colorprop", Value = Color.Parse("#ff55ffff", CultureInfo.InvariantCulture) }, + new ColorProperty { Name = "colorprop", Value = TiledColor.Parse("#ff55ffff", CultureInfo.InvariantCulture) }, new FileProperty { Name = "fileprop", Value = "file.txt" }, new FloatProperty { Name = "floatprop", Value = 4.2f }, new IntProperty { Name = "intprop", Value = 8 }, new ObjectProperty { Name = "objectprop", Value = 5 }, new StringProperty { Name = "stringprop", Value = "This is a string, hello world!" }, - new ColorProperty { Name = "unsetcolorprop", Value = Optional.Empty } + new ColorProperty { Name = "unsetcolorprop", Value = Optional.Empty } ] }; } diff --git a/src/DotTiled.Tests/TestData/Maps/map-with-custom-type-props-without-defs/map-with-custom-type-props-without-defs.cs b/src/DotTiled.Tests/TestData/Maps/map-with-custom-type-props-without-defs/map-with-custom-type-props-without-defs.cs index 4134dac..91d4e07 100644 --- a/src/DotTiled.Tests/TestData/Maps/map-with-custom-type-props-without-defs/map-with-custom-type-props-without-defs.cs +++ b/src/DotTiled.Tests/TestData/Maps/map-with-custom-type-props-without-defs/map-with-custom-type-props-without-defs.cs @@ -17,7 +17,7 @@ public partial class TestData ParallaxOriginY = 0, RenderOrder = RenderOrder.RightDown, CompressionLevel = -1, - BackgroundColor = Color.Parse("#00000000", CultureInfo.InvariantCulture), + BackgroundColor = TiledColor.Parse("#00000000", CultureInfo.InvariantCulture), Version = "1.10", TiledVersion = "1.11.0", NextLayerID = 2, diff --git a/src/DotTiled.Tests/TestData/Maps/map-with-custom-type-props/map-with-custom-type-props.cs b/src/DotTiled.Tests/TestData/Maps/map-with-custom-type-props/map-with-custom-type-props.cs index f77638b..6a2b6bf 100644 --- a/src/DotTiled.Tests/TestData/Maps/map-with-custom-type-props/map-with-custom-type-props.cs +++ b/src/DotTiled.Tests/TestData/Maps/map-with-custom-type-props/map-with-custom-type-props.cs @@ -17,7 +17,7 @@ public partial class TestData ParallaxOriginY = 0, RenderOrder = RenderOrder.RightDown, CompressionLevel = -1, - BackgroundColor = Color.Parse("#00000000", CultureInfo.InvariantCulture), + BackgroundColor = TiledColor.Parse("#00000000", CultureInfo.InvariantCulture), Version = "1.10", TiledVersion = "1.11.0", NextLayerID = 2, @@ -56,7 +56,7 @@ public partial class TestData PropertyType = "CustomClass", Value = [ new BoolProperty { Name = "boolinclass", Value = true }, - new ColorProperty { Name = "colorinclass", Value = Color.Parse("#000000ff", CultureInfo.InvariantCulture) }, + new ColorProperty { Name = "colorinclass", Value = TiledColor.Parse("#000000ff", CultureInfo.InvariantCulture) }, new FileProperty { Name = "fileinclass", Value = "" }, new FloatProperty { Name = "floatinclass", Value = 13.37f }, new IntProperty { Name = "intinclass", Value = 0 }, @@ -106,7 +106,7 @@ public partial class TestData new ColorProperty { Name = "colorinclass", - Value = Color.Parse("#000000ff", CultureInfo.InvariantCulture) + Value = TiledColor.Parse("#000000ff", CultureInfo.InvariantCulture) }, new FileProperty { diff --git a/src/DotTiled.Tests/TestData/Maps/map-with-deep-props/map-with-deep-props.cs b/src/DotTiled.Tests/TestData/Maps/map-with-deep-props/map-with-deep-props.cs index b67548a..76e34fb 100644 --- a/src/DotTiled.Tests/TestData/Maps/map-with-deep-props/map-with-deep-props.cs +++ b/src/DotTiled.Tests/TestData/Maps/map-with-deep-props/map-with-deep-props.cs @@ -17,7 +17,7 @@ public partial class TestData ParallaxOriginY = 0, RenderOrder = RenderOrder.RightDown, CompressionLevel = -1, - BackgroundColor = Color.Parse("#00000000", CultureInfo.InvariantCulture), + BackgroundColor = TiledColor.Parse("#00000000", CultureInfo.InvariantCulture), Version = "1.10", TiledVersion = "1.11.0", NextLayerID = 2, @@ -61,7 +61,7 @@ public partial class TestData PropertyType = "CustomClass", Value = [ new BoolProperty { Name = "boolinclass", Value = false }, - new ColorProperty { Name = "colorinclass", Value = Color.Parse("#000000ff", CultureInfo.InvariantCulture) }, + new ColorProperty { Name = "colorinclass", Value = TiledColor.Parse("#000000ff", CultureInfo.InvariantCulture) }, new FileProperty { Name = "fileinclass", Value = "" }, new FloatProperty { Name = "floatinclass", Value = 0f }, new IntProperty { Name = "intinclass", Value = 0 }, @@ -82,7 +82,7 @@ public partial class TestData PropertyType = "CustomClass", Value = [ new BoolProperty { Name = "boolinclass", Value = true }, - new ColorProperty { Name = "colorinclass", Value = Color.Parse("#000000ff", CultureInfo.InvariantCulture) }, + new ColorProperty { Name = "colorinclass", Value = TiledColor.Parse("#000000ff", CultureInfo.InvariantCulture) }, new FileProperty { Name = "fileinclass", Value = "" }, new FloatProperty { Name = "floatinclass", Value = 13.37f }, new IntProperty { Name = "intinclass", Value = 0 }, @@ -109,7 +109,7 @@ public partial class TestData new ColorProperty { Name = "colorinclass", - Value = Color.Parse("#000000ff", CultureInfo.InvariantCulture) + Value = TiledColor.Parse("#000000ff", CultureInfo.InvariantCulture) }, new FileProperty { diff --git a/src/DotTiled.Tests/TestData/Maps/map-with-embedded-tileset/map-with-embedded-tileset.cs b/src/DotTiled.Tests/TestData/Maps/map-with-embedded-tileset/map-with-embedded-tileset.cs index 0056fd1..8bb3724 100644 --- a/src/DotTiled.Tests/TestData/Maps/map-with-embedded-tileset/map-with-embedded-tileset.cs +++ b/src/DotTiled.Tests/TestData/Maps/map-with-embedded-tileset/map-with-embedded-tileset.cs @@ -17,7 +17,7 @@ public partial class TestData ParallaxOriginY = 0, RenderOrder = RenderOrder.RightDown, CompressionLevel = -1, - BackgroundColor = Color.Parse("#00000000", CultureInfo.InvariantCulture), + BackgroundColor = TiledColor.Parse("#00000000", CultureInfo.InvariantCulture), Version = "1.10", TiledVersion = "1.11.0", NextLayerID = 2, diff --git a/src/DotTiled.Tests/TestData/Maps/map-with-external-tileset/map-with-external-tileset.cs b/src/DotTiled.Tests/TestData/Maps/map-with-external-tileset/map-with-external-tileset.cs index 15b9873..34bd69f 100644 --- a/src/DotTiled.Tests/TestData/Maps/map-with-external-tileset/map-with-external-tileset.cs +++ b/src/DotTiled.Tests/TestData/Maps/map-with-external-tileset/map-with-external-tileset.cs @@ -17,7 +17,7 @@ public partial class TestData ParallaxOriginY = 0, RenderOrder = RenderOrder.RightDown, CompressionLevel = -1, - BackgroundColor = Color.Parse("#00000000", CultureInfo.InvariantCulture), + BackgroundColor = TiledColor.Parse("#00000000", CultureInfo.InvariantCulture), Version = "1.10", TiledVersion = "1.11.0", NextLayerID = 2, diff --git a/src/DotTiled.Tests/TestData/Maps/map-with-flippingflags/map-with-flippingflags.cs b/src/DotTiled.Tests/TestData/Maps/map-with-flippingflags/map-with-flippingflags.cs index aef25d3..8dde14b 100644 --- a/src/DotTiled.Tests/TestData/Maps/map-with-flippingflags/map-with-flippingflags.cs +++ b/src/DotTiled.Tests/TestData/Maps/map-with-flippingflags/map-with-flippingflags.cs @@ -17,7 +17,7 @@ public partial class TestData ParallaxOriginY = 0, RenderOrder = RenderOrder.RightDown, CompressionLevel = -1, - BackgroundColor = Color.Parse("#00000000", CultureInfo.InvariantCulture), + BackgroundColor = TiledColor.Parse("#00000000", CultureInfo.InvariantCulture), Version = "1.10", TiledVersion = "1.11.0", NextLayerID = 3, 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 807ef7e..35c4cbd 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 @@ -17,7 +17,7 @@ public partial class TestData ParallaxOriginY = 0, RenderOrder = RenderOrder.RightDown, CompressionLevel = -1, - BackgroundColor = new Color { R = 0, G = 0, B = 0, A = 0 }, + BackgroundColor = new TiledColor { R = 0, G = 0, B = 0, A = 0 }, Version = "1.10", TiledVersion = "1.11.0", NextLayerID = 8, diff --git a/src/DotTiled.Tests/TestData/Maps/map-with-multiline-string-prop/map-with-multiline-string-prop.cs b/src/DotTiled.Tests/TestData/Maps/map-with-multiline-string-prop/map-with-multiline-string-prop.cs index 06fc07f..68b196c 100644 --- a/src/DotTiled.Tests/TestData/Maps/map-with-multiline-string-prop/map-with-multiline-string-prop.cs +++ b/src/DotTiled.Tests/TestData/Maps/map-with-multiline-string-prop/map-with-multiline-string-prop.cs @@ -17,7 +17,7 @@ public partial class TestData ParallaxOriginY = 0, RenderOrder = RenderOrder.RightDown, CompressionLevel = -1, - BackgroundColor = Color.Parse("#00ff00", CultureInfo.InvariantCulture), + BackgroundColor = TiledColor.Parse("#00ff00", CultureInfo.InvariantCulture), Version = "1.10", TiledVersion = "1.11.0", NextLayerID = 2, @@ -52,7 +52,7 @@ public partial class TestData Properties = [ new BoolProperty { Name = "boolprop", Value = true }, - new ColorProperty { Name = "colorprop", Value = Color.Parse("#ff55ffff", CultureInfo.InvariantCulture) }, + new ColorProperty { Name = "colorprop", Value = TiledColor.Parse("#ff55ffff", CultureInfo.InvariantCulture) }, new FileProperty { Name = "fileprop", Value = "file.txt" }, new FloatProperty { Name = "floatprop", Value = 4.2f }, new IntProperty { Name = "intprop", Value = 8 }, diff --git a/src/DotTiled.Tests/UnitTests/Properties/HasPropertiesBaseTests.cs b/src/DotTiled.Tests/UnitTests/Properties/HasPropertiesBaseTests.cs index 4f9ab0f..cbf84c2 100644 --- a/src/DotTiled.Tests/UnitTests/Properties/HasPropertiesBaseTests.cs +++ b/src/DotTiled.Tests/UnitTests/Properties/HasPropertiesBaseTests.cs @@ -80,7 +80,7 @@ public class HasPropertiesBaseTests private sealed class MapTo { public bool MapToBool { get; set; } = false; - public Color MapToColor { get; set; } = Color.Parse("#00000000", CultureInfo.InvariantCulture); + public TiledColor MapToColor { get; set; } = TiledColor.Parse("#00000000", CultureInfo.InvariantCulture); public float MapToFloat { get; set; } = 0.0f; public string MapToFile { get; set; } = ""; public int MapToInt { get; set; } = 0; @@ -130,7 +130,7 @@ public class HasPropertiesBaseTests PropertyType = "MapTo", Value = [ new BoolProperty { Name = "MapToBool", Value = true }, - new ColorProperty { Name = "MapToColor", Value = Color.Parse("#FF0000FF", CultureInfo.InvariantCulture) }, + new ColorProperty { Name = "MapToColor", Value = TiledColor.Parse("#FF0000FF", CultureInfo.InvariantCulture) }, new FloatProperty { Name = "MapToFloat", Value = 1.0f }, new StringProperty { Name = "MapToFile", Value = "Test" }, new IntProperty { Name = "MapToInt", Value = 1 }, @@ -146,7 +146,7 @@ public class HasPropertiesBaseTests // Assert Assert.True(mappedProperty.MapToBool); - Assert.Equal(Color.Parse("#FF0000FF", CultureInfo.InvariantCulture), mappedProperty.MapToColor); + Assert.Equal(TiledColor.Parse("#FF0000FF", CultureInfo.InvariantCulture), mappedProperty.MapToColor); Assert.Equal(1.0f, mappedProperty.MapToFloat); Assert.Equal("Test", mappedProperty.MapToFile); Assert.Equal(1, mappedProperty.MapToInt); @@ -175,7 +175,7 @@ public class HasPropertiesBaseTests PropertyType = "MapTo", Value = [ new BoolProperty { Name = "MapToBool", Value = true }, - new ColorProperty { Name = "MapToColor", Value = Color.Parse("#FF0000FF", CultureInfo.InvariantCulture) }, + new ColorProperty { Name = "MapToColor", Value = TiledColor.Parse("#FF0000FF", CultureInfo.InvariantCulture) }, new FloatProperty { Name = "MapToFloat", Value = 1.0f }, new StringProperty { Name = "MapToFile", Value = "Test" }, new IntProperty { Name = "MapToInt", Value = 1 }, @@ -194,7 +194,7 @@ public class HasPropertiesBaseTests // Assert Assert.Equal("Test", mappedProperty.NestedMapToString); Assert.True(mappedProperty.MapToInNested.MapToBool); - Assert.Equal(Color.Parse("#FF0000FF", CultureInfo.InvariantCulture), mappedProperty.MapToInNested.MapToColor); + Assert.Equal(TiledColor.Parse("#FF0000FF", CultureInfo.InvariantCulture), mappedProperty.MapToInNested.MapToColor); Assert.Equal(1.0f, mappedProperty.MapToInNested.MapToFloat); Assert.Equal("Test", mappedProperty.MapToInNested.MapToFile); Assert.Equal(1, mappedProperty.MapToInNested.MapToInt); @@ -276,7 +276,7 @@ public class HasPropertiesBaseTests // Arrange List props = [ new BoolProperty { Name = "MapToBool", Value = true }, - new ColorProperty { Name = "MapToColor", Value = Color.Parse("#FF0000FF", CultureInfo.InvariantCulture) }, + new ColorProperty { Name = "MapToColor", Value = TiledColor.Parse("#FF0000FF", CultureInfo.InvariantCulture) }, new FloatProperty { Name = "MapToFloat", Value = 1.0f }, new StringProperty { Name = "MapToFile", Value = "Test" }, new IntProperty { Name = "MapToInt", Value = 1 }, @@ -290,7 +290,7 @@ public class HasPropertiesBaseTests // Assert Assert.True(mappedProperty.MapToBool); - Assert.Equal(Color.Parse("#FF0000FF", CultureInfo.InvariantCulture), mappedProperty.MapToColor); + Assert.Equal(TiledColor.Parse("#FF0000FF", CultureInfo.InvariantCulture), mappedProperty.MapToColor); Assert.Equal(1.0f, mappedProperty.MapToFloat); Assert.Equal("Test", mappedProperty.MapToFile); Assert.Equal(1, mappedProperty.MapToInt); diff --git a/src/DotTiled/Layers/BaseLayer.cs b/src/DotTiled/Layers/BaseLayer.cs index 26a6416..4da3443 100644 --- a/src/DotTiled/Layers/BaseLayer.cs +++ b/src/DotTiled/Layers/BaseLayer.cs @@ -37,7 +37,7 @@ public abstract class BaseLayer : HasPropertiesBase /// /// A tint color that is multiplied with any tiles drawn by this layer. /// - public Optional TintColor { get; set; } = Optional.Empty; + public Optional TintColor { get; set; } = Optional.Empty; /// /// Horizontal offset for this layer in pixels. diff --git a/src/DotTiled/Layers/ObjectLayer.cs b/src/DotTiled/Layers/ObjectLayer.cs index b32a137..1e825e1 100644 --- a/src/DotTiled/Layers/ObjectLayer.cs +++ b/src/DotTiled/Layers/ObjectLayer.cs @@ -46,7 +46,7 @@ public class ObjectLayer : BaseLayer /// /// A color that is multiplied with any tile objects drawn by this layer. /// - public Optional Color { get; set; } = Optional.Empty; + public Optional Color { get; set; } = Optional.Empty; /// /// Whether the objects are drawn according to the order of appearance () or sorted by their Y coordinate (). diff --git a/src/DotTiled/Layers/Objects/TextObject.cs b/src/DotTiled/Layers/Objects/TextObject.cs index 48a095c..42b07d0 100644 --- a/src/DotTiled/Layers/Objects/TextObject.cs +++ b/src/DotTiled/Layers/Objects/TextObject.cs @@ -72,7 +72,7 @@ public class TextObject : Object /// /// The color of the text. /// - public Color Color { get; set; } = Color.Parse("#000000", CultureInfo.InvariantCulture); + public TiledColor Color { get; set; } = TiledColor.Parse("#000000", CultureInfo.InvariantCulture); /// /// Whether the text is bold. diff --git a/src/DotTiled/Map.cs b/src/DotTiled/Map.cs index c9a8890..92965f5 100644 --- a/src/DotTiled/Map.cs +++ b/src/DotTiled/Map.cs @@ -171,7 +171,7 @@ public class Map : HasPropertiesBase /// /// The background color of the map. /// - public Color BackgroundColor { get; set; } = Color.Parse("#00000000", CultureInfo.InvariantCulture); + public TiledColor BackgroundColor { get; set; } = TiledColor.Parse("#00000000", CultureInfo.InvariantCulture); /// /// Stores the next available ID for new layers. This number is used to prevent reuse of the same ID after layers have been removed. diff --git a/src/DotTiled/Properties/ColorProperty.cs b/src/DotTiled/Properties/ColorProperty.cs index 295096e..9e5cc0d 100644 --- a/src/DotTiled/Properties/ColorProperty.cs +++ b/src/DotTiled/Properties/ColorProperty.cs @@ -3,7 +3,7 @@ namespace DotTiled; /// /// Represents a color property. /// -public class ColorProperty : IProperty> +public class ColorProperty : IProperty> { /// public required string Name { get; set; } @@ -14,7 +14,7 @@ public class ColorProperty : IProperty> /// /// The color value of the property. /// - public required Optional Value { get; set; } + public required Optional Value { get; set; } /// public IProperty Clone() => new ColorProperty diff --git a/src/DotTiled/Properties/CustomTypes/CustomClassDefinition.cs b/src/DotTiled/Properties/CustomTypes/CustomClassDefinition.cs index 37b8c6e..7d799ca 100644 --- a/src/DotTiled/Properties/CustomTypes/CustomClassDefinition.cs +++ b/src/DotTiled/Properties/CustomTypes/CustomClassDefinition.cs @@ -78,7 +78,7 @@ public class CustomClassDefinition : HasPropertiesBase, ICustomTypeDefinition /// /// The color of the custom class inside the Tiled editor. /// - public Color Color { get; set; } + public TiledColor Color { get; set; } /// /// Whether the custom class should be drawn with a fill color. @@ -155,8 +155,8 @@ public class CustomClassDefinition : HasPropertiesBase, ICustomTypeDefinition { case Type t when t == typeof(bool): return new BoolProperty { Name = propertyInfo.Name, Value = (bool)propertyInfo.GetValue(instance) }; - case Type t when t == typeof(Color): - return new ColorProperty { Name = propertyInfo.Name, Value = (Color)propertyInfo.GetValue(instance) }; + case Type t when t == typeof(TiledColor): + return new ColorProperty { Name = propertyInfo.Name, Value = (TiledColor)propertyInfo.GetValue(instance) }; case Type t when t == typeof(float): return new FloatProperty { Name = propertyInfo.Name, Value = (float)propertyInfo.GetValue(instance) }; case Type t when t == typeof(string): diff --git a/src/DotTiled/Color.cs b/src/DotTiled/Properties/TiledColor.cs similarity index 77% rename from src/DotTiled/Color.cs rename to src/DotTiled/Properties/TiledColor.cs index 78d0b80..cebc1f6 100644 --- a/src/DotTiled/Color.cs +++ b/src/DotTiled/Properties/TiledColor.cs @@ -7,7 +7,7 @@ namespace DotTiled; /// /// Represents a Tiled color. /// -public class Color : IParsable, IEquatable +public class TiledColor : IParsable, IEquatable { /// /// The red component of the color. @@ -30,31 +30,31 @@ public class Color : IParsable, IEquatable public byte A { get; set; } = 255; /// - /// Attempts to parse the specified string into a . Expects strings in the format #RRGGBB or #AARRGGBB. + /// Attempts to parse the specified string into a . Expects strings in the format #RRGGBB or #AARRGGBB. /// The leading # is optional. /// - /// A string value to parse into a + /// A string value to parse into a /// An object that supplies culture-specific information about the format of s. - /// The parsed + /// The parsed /// Thrown in case the provided string is not in a valid format. - public static Color Parse(string s, IFormatProvider provider) + public static TiledColor Parse(string s, IFormatProvider provider) { _ = TryParse(s, provider, out var result); return result ?? throw new FormatException($"Invalid format for TiledColor: {s}"); } /// - /// Attempts to parse the specified string into a . Expects strings in the format #RRGGBB or #AARRGGBB. + /// Attempts to parse the specified string into a . Expects strings in the format #RRGGBB or #AARRGGBB. /// The leading # is optional. /// - /// A string value to parse into a + /// A string value to parse into a /// An object that supplies culture-specific information about the format of s. - /// When this method returns, contains the parsed or null on failure. + /// When this method returns, contains the parsed or null on failure. /// true if was successfully parsed; otherwise, false. public static bool TryParse( [NotNullWhen(true)] string s, IFormatProvider provider, - [MaybeNullWhen(false)] out Color result) + [MaybeNullWhen(false)] out TiledColor result) { if (s is not null && !s.StartsWith('#')) return TryParse($"#{s}", provider, out result); @@ -68,7 +68,7 @@ public class Color : IParsable, IEquatable if (s.Length == 7) { - result = new Color + result = new TiledColor { R = byte.Parse(s[1..3], NumberStyles.HexNumber, provider), G = byte.Parse(s[3..5], NumberStyles.HexNumber, provider), @@ -77,7 +77,7 @@ public class Color : IParsable, IEquatable } else { - result = new Color + result = new TiledColor { A = byte.Parse(s[1..3], NumberStyles.HexNumber, provider), R = byte.Parse(s[3..5], NumberStyles.HexNumber, provider), @@ -90,7 +90,7 @@ public class Color : IParsable, IEquatable } /// - public bool Equals(Color other) + public bool Equals(TiledColor other) { if (other is null) return false; @@ -99,7 +99,7 @@ public class Color : IParsable, IEquatable } /// - public override bool Equals(object obj) => obj is Color other && Equals(other); + public override bool Equals(object obj) => obj is TiledColor other && Equals(other); /// public override int GetHashCode() => HashCode.Combine(R, G, B, A); diff --git a/src/DotTiled/Serialization/Tmj/TmjReaderBase.Group.cs b/src/DotTiled/Serialization/Tmj/TmjReaderBase.Group.cs index 0df3c10..4c6ac38 100644 --- a/src/DotTiled/Serialization/Tmj/TmjReaderBase.Group.cs +++ b/src/DotTiled/Serialization/Tmj/TmjReaderBase.Group.cs @@ -12,7 +12,7 @@ public abstract partial class TmjReaderBase var @class = element.GetOptionalProperty("class").GetValueOr(""); var opacity = element.GetOptionalProperty("opacity").GetValueOr(1.0f); var visible = element.GetOptionalProperty("visible").GetValueOr(true); - var tintColor = element.GetOptionalPropertyParseable("tintcolor"); + var tintColor = element.GetOptionalPropertyParseable("tintcolor"); var offsetX = element.GetOptionalProperty("offsetx").GetValueOr(0.0f); var offsetY = element.GetOptionalProperty("offsety").GetValueOr(0.0f); var parallaxX = element.GetOptionalProperty("parallaxx").GetValueOr(1.0f); diff --git a/src/DotTiled/Serialization/Tmj/TmjReaderBase.ImageLayer.cs b/src/DotTiled/Serialization/Tmj/TmjReaderBase.ImageLayer.cs index 32b5614..0da963d 100644 --- a/src/DotTiled/Serialization/Tmj/TmjReaderBase.ImageLayer.cs +++ b/src/DotTiled/Serialization/Tmj/TmjReaderBase.ImageLayer.cs @@ -11,7 +11,7 @@ public abstract partial class TmjReaderBase var @class = element.GetOptionalProperty("class").GetValueOr(""); var opacity = element.GetOptionalProperty("opacity").GetValueOr(1.0f); var visible = element.GetOptionalProperty("visible").GetValueOr(true); - var tintColor = element.GetOptionalPropertyParseable("tintcolor"); + var tintColor = element.GetOptionalPropertyParseable("tintcolor"); var offsetX = element.GetOptionalProperty("offsetx").GetValueOr(0.0f); var offsetY = element.GetOptionalProperty("offsety").GetValueOr(0.0f); var parallaxX = element.GetOptionalProperty("parallaxx").GetValueOr(1.0f); @@ -21,7 +21,7 @@ public abstract partial class TmjReaderBase var image = element.GetRequiredProperty("image"); var repeatX = element.GetOptionalProperty("repeatx").GetValueOr(false); var repeatY = element.GetOptionalProperty("repeaty").GetValueOr(false); - var transparentColor = element.GetOptionalPropertyParseable("transparentcolor"); + var transparentColor = element.GetOptionalPropertyParseable("transparentcolor"); var x = element.GetOptionalProperty("x").GetValueOr(0); var y = element.GetOptionalProperty("y").GetValueOr(0); diff --git a/src/DotTiled/Serialization/Tmj/TmjReaderBase.Map.cs b/src/DotTiled/Serialization/Tmj/TmjReaderBase.Map.cs index f6924f4..dfe7eee 100644 --- a/src/DotTiled/Serialization/Tmj/TmjReaderBase.Map.cs +++ b/src/DotTiled/Serialization/Tmj/TmjReaderBase.Map.cs @@ -47,7 +47,7 @@ public abstract partial class TmjReaderBase }); var parallaxOriginX = element.GetOptionalProperty("parallaxoriginx").GetValueOr(0f); var parallaxOriginY = element.GetOptionalProperty("parallaxoriginy").GetValueOr(0f); - var backgroundColor = element.GetOptionalPropertyParseable("backgroundcolor").GetValueOr(Color.Parse("#00000000", CultureInfo.InvariantCulture)); + var backgroundColor = element.GetOptionalPropertyParseable("backgroundcolor").GetValueOr(TiledColor.Parse("#00000000", CultureInfo.InvariantCulture)); var nextLayerID = element.GetRequiredProperty("nextlayerid"); var nextObjectID = element.GetRequiredProperty("nextobjectid"); var infinite = element.GetOptionalProperty("infinite").GetValueOr(false); diff --git a/src/DotTiled/Serialization/Tmj/TmjReaderBase.ObjectLayer.cs b/src/DotTiled/Serialization/Tmj/TmjReaderBase.ObjectLayer.cs index c43e40a..132ceba 100644 --- a/src/DotTiled/Serialization/Tmj/TmjReaderBase.ObjectLayer.cs +++ b/src/DotTiled/Serialization/Tmj/TmjReaderBase.ObjectLayer.cs @@ -15,7 +15,7 @@ public abstract partial class TmjReaderBase var @class = element.GetOptionalProperty("class").GetValueOr(""); var opacity = element.GetOptionalProperty("opacity").GetValueOr(1.0f); var visible = element.GetOptionalProperty("visible").GetValueOr(true); - var tintColor = element.GetOptionalPropertyParseable("tintcolor"); + var tintColor = element.GetOptionalPropertyParseable("tintcolor"); var offsetX = element.GetOptionalProperty("offsetx").GetValueOr(0.0f); var offsetY = element.GetOptionalProperty("offsety").GetValueOr(0.0f); var parallaxX = element.GetOptionalProperty("parallaxx").GetValueOr(1.0f); @@ -26,7 +26,7 @@ public abstract partial class TmjReaderBase 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 color = element.GetOptionalPropertyParseable("color"); var drawOrder = element.GetOptionalPropertyParseable("draworder", s => s switch { "topdown" => DrawOrder.TopDown, @@ -255,7 +255,7 @@ public abstract partial class TmjReaderBase internal static TextObject ReadText(JsonElement element) { var bold = element.GetOptionalProperty("bold").GetValueOr(false); - var color = element.GetOptionalPropertyParseable("color").GetValueOr(Color.Parse("#00000000", CultureInfo.InvariantCulture)); + var color = element.GetOptionalPropertyParseable("color").GetValueOr(TiledColor.Parse("#00000000", CultureInfo.InvariantCulture)); var fontfamily = element.GetOptionalProperty("fontfamily").GetValueOr("sans-serif"); var halign = element.GetOptionalPropertyParseable("halign", s => s switch { diff --git a/src/DotTiled/Serialization/Tmj/TmjReaderBase.Properties.cs b/src/DotTiled/Serialization/Tmj/TmjReaderBase.Properties.cs index ae7ea1c..1ad6e53 100644 --- a/src/DotTiled/Serialization/Tmj/TmjReaderBase.Properties.cs +++ b/src/DotTiled/Serialization/Tmj/TmjReaderBase.Properties.cs @@ -36,7 +36,7 @@ public abstract partial class TmjReaderBase PropertyType.Int => new IntProperty { Name = name, Value = e.GetRequiredProperty("value") }, PropertyType.Float => new FloatProperty { Name = name, Value = e.GetRequiredProperty("value") }, PropertyType.Bool => new BoolProperty { Name = name, Value = e.GetRequiredProperty("value") }, - PropertyType.Color => new ColorProperty { Name = name, Value = e.GetRequiredPropertyParseable("value", s => s == "" ? default : Color.Parse(s, CultureInfo.InvariantCulture)) }, + PropertyType.Color => new ColorProperty { Name = name, Value = e.GetRequiredPropertyParseable("value", s => s == "" ? default : TiledColor.Parse(s, CultureInfo.InvariantCulture)) }, PropertyType.File => new FileProperty { Name = name, Value = e.GetRequiredProperty("value") }, PropertyType.Object => new ObjectProperty { Name = name, Value = e.GetRequiredProperty("value") }, PropertyType.Class => throw new JsonException("Class property must have a property type"), @@ -163,7 +163,7 @@ public abstract partial class TmjReaderBase PropertyType.Int => new IntProperty { Name = prop.Name, Value = propElement.GetValueAs() }, PropertyType.Float => new FloatProperty { Name = prop.Name, Value = propElement.GetValueAs() }, PropertyType.Bool => new BoolProperty { Name = prop.Name, Value = propElement.GetValueAs() }, - PropertyType.Color => new ColorProperty { Name = prop.Name, Value = Color.Parse(propElement.GetValueAs(), CultureInfo.InvariantCulture) }, + PropertyType.Color => new ColorProperty { Name = prop.Name, Value = TiledColor.Parse(propElement.GetValueAs(), CultureInfo.InvariantCulture) }, PropertyType.File => new FileProperty { Name = prop.Name, Value = propElement.GetValueAs() }, PropertyType.Object => new ObjectProperty { Name = prop.Name, Value = propElement.GetValueAs() }, PropertyType.Enum => ReadEnumProperty(propElement), diff --git a/src/DotTiled/Serialization/Tmj/TmjReaderBase.TileLayer.cs b/src/DotTiled/Serialization/Tmj/TmjReaderBase.TileLayer.cs index 6482cf9..287ef18 100644 --- a/src/DotTiled/Serialization/Tmj/TmjReaderBase.TileLayer.cs +++ b/src/DotTiled/Serialization/Tmj/TmjReaderBase.TileLayer.cs @@ -35,8 +35,8 @@ public abstract partial class TmjReaderBase var repeatY = element.GetOptionalProperty("repeaty").GetValueOr(false); var startX = element.GetOptionalProperty("startx").GetValueOr(0); var startY = element.GetOptionalProperty("starty").GetValueOr(0); - var tintColor = element.GetOptionalPropertyParseable("tintcolor"); - var transparentColor = element.GetOptionalPropertyParseable("transparentcolor"); + 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"); diff --git a/src/DotTiled/Serialization/Tmj/TmjReaderBase.Tileset.cs b/src/DotTiled/Serialization/Tmj/TmjReaderBase.Tileset.cs index 5190121..fae87fe 100644 --- a/src/DotTiled/Serialization/Tmj/TmjReaderBase.Tileset.cs +++ b/src/DotTiled/Serialization/Tmj/TmjReaderBase.Tileset.cs @@ -10,7 +10,7 @@ public abstract partial class TmjReaderBase Optional parentVersion = null, Optional parentTiledVersion = null) { - var backgroundColor = element.GetOptionalPropertyParseable("backgroundcolor"); + var backgroundColor = element.GetOptionalPropertyParseable("backgroundcolor"); var @class = element.GetOptionalProperty("class").GetValueOr(""); var columns = element.GetOptionalProperty("columns"); var fillMode = element.GetOptionalPropertyParseable("fillmode", s => s switch @@ -55,8 +55,7 @@ public abstract partial class TmjReaderBase }).GetValueOr(TileRenderSize.Tile); var tiles = element.GetOptionalPropertyCustom>("tiles", ReadTiles).GetValueOr([]); var tileWidth = element.GetOptionalProperty("tilewidth"); - var transparentColor = element.GetOptionalPropertyParseable("transparentcolor"); - var type = element.GetOptionalProperty("type"); + var transparentColor = element.GetOptionalPropertyParseable("transparentcolor"); var version = element.GetOptionalProperty("version").GetValueOrOptional(parentVersion); var transformations = element.GetOptionalPropertyCustom("transformations", ReadTransformations); var wangsets = element.GetOptionalPropertyCustom>("wangsets", el => el.GetValueAsList(e => ReadWangset(e))).GetValueOr([]); @@ -229,7 +228,7 @@ public abstract partial class TmjReaderBase internal WangColor ReadWangColor(JsonElement element) { var @class = element.GetOptionalProperty("class").GetValueOr(""); - var color = element.GetRequiredPropertyParseable("color"); + var color = element.GetRequiredPropertyParseable("color"); var name = element.GetRequiredProperty("name"); var probability = element.GetOptionalProperty("probability").GetValueOr(1.0f); var properties = ResolveAndMergeProperties(@class, element.GetOptionalPropertyCustom("properties", ReadProperties).GetValueOr([])); diff --git a/src/DotTiled/Serialization/Tmx/TmxReaderBase.Map.cs b/src/DotTiled/Serialization/Tmx/TmxReaderBase.Map.cs index ee9fe09..9f48633 100644 --- a/src/DotTiled/Serialization/Tmx/TmxReaderBase.Map.cs +++ b/src/DotTiled/Serialization/Tmx/TmxReaderBase.Map.cs @@ -51,7 +51,7 @@ public abstract partial class TmxReaderBase }); var parallaxOriginX = _reader.GetOptionalAttributeParseable("parallaxoriginx").GetValueOr(0.0f); var parallaxOriginY = _reader.GetOptionalAttributeParseable("parallaxoriginy").GetValueOr(0.0f); - var backgroundColor = _reader.GetOptionalAttributeClass("backgroundcolor").GetValueOr(Color.Parse("#00000000", CultureInfo.InvariantCulture)); + var backgroundColor = _reader.GetOptionalAttributeClass("backgroundcolor").GetValueOr(TiledColor.Parse("#00000000", CultureInfo.InvariantCulture)); var nextLayerID = _reader.GetRequiredAttributeParseable("nextlayerid"); var nextObjectID = _reader.GetRequiredAttributeParseable("nextobjectid"); var infinite = _reader.GetOptionalAttributeParseable("infinite").GetValueOr(0) == 1; diff --git a/src/DotTiled/Serialization/Tmx/TmxReaderBase.ObjectLayer.cs b/src/DotTiled/Serialization/Tmx/TmxReaderBase.ObjectLayer.cs index 3799f9f..5e70f5e 100644 --- a/src/DotTiled/Serialization/Tmx/TmxReaderBase.ObjectLayer.cs +++ b/src/DotTiled/Serialization/Tmx/TmxReaderBase.ObjectLayer.cs @@ -20,12 +20,12 @@ public abstract partial class TmxReaderBase 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"); + var tintColor = _reader.GetOptionalAttributeClass("tintcolor"); var offsetX = _reader.GetOptionalAttributeParseable("offsetx").GetValueOr(0.0f); var offsetY = _reader.GetOptionalAttributeParseable("offsety").GetValueOr(0.0f); var parallaxX = _reader.GetOptionalAttributeParseable("parallaxx").GetValueOr(1.0f); var parallaxY = _reader.GetOptionalAttributeParseable("parallaxy").GetValueOr(1.0f); - var color = _reader.GetOptionalAttributeClass("color"); + var color = _reader.GetOptionalAttributeClass("color"); var drawOrder = _reader.GetOptionalAttributeEnum("draworder", s => s switch { "topdown" => DrawOrder.TopDown, @@ -245,7 +245,7 @@ public abstract partial class TmxReaderBase var fontFamily = _reader.GetOptionalAttribute("fontfamily") ?? "sans-serif"; var pixelSize = _reader.GetOptionalAttributeParseable("pixelsize") ?? 16; var wrap = _reader.GetOptionalAttributeParseable("wrap") ?? false; - var color = _reader.GetOptionalAttributeClass("color") ?? Color.Parse("#000000", CultureInfo.InvariantCulture); + var color = _reader.GetOptionalAttributeClass("color") ?? TiledColor.Parse("#000000", CultureInfo.InvariantCulture); var bold = _reader.GetOptionalAttributeParseable("bold") ?? false; var italic = _reader.GetOptionalAttributeParseable("italic") ?? false; var underline = _reader.GetOptionalAttributeParseable("underline") ?? false; diff --git a/src/DotTiled/Serialization/Tmx/TmxReaderBase.Properties.cs b/src/DotTiled/Serialization/Tmx/TmxReaderBase.Properties.cs index 5770056..94b730b 100644 --- a/src/DotTiled/Serialization/Tmx/TmxReaderBase.Properties.cs +++ b/src/DotTiled/Serialization/Tmx/TmxReaderBase.Properties.cs @@ -45,7 +45,7 @@ public abstract partial class TmxReaderBase PropertyType.Int => new IntProperty { Name = name, Value = r.GetRequiredAttributeParseable("value") }, PropertyType.Float => new FloatProperty { Name = name, Value = r.GetRequiredAttributeParseable("value") }, PropertyType.Bool => new BoolProperty { Name = name, Value = r.GetRequiredAttributeParseable("value") }, - PropertyType.Color => new ColorProperty { Name = name, Value = r.GetRequiredAttributeParseable("value", s => s == "" ? default : Color.Parse(s, CultureInfo.InvariantCulture)) }, + PropertyType.Color => new ColorProperty { Name = name, Value = r.GetRequiredAttributeParseable("value", s => s == "" ? default : TiledColor.Parse(s, CultureInfo.InvariantCulture)) }, PropertyType.File => new FileProperty { Name = name, Value = r.GetRequiredAttribute("value") }, PropertyType.Object => new ObjectProperty { Name = name, Value = r.GetRequiredAttributeParseable("value") }, PropertyType.Class => throw new XmlException("Class property must have a property type"), diff --git a/src/DotTiled/Serialization/Tmx/TmxReaderBase.TileLayer.cs b/src/DotTiled/Serialization/Tmx/TmxReaderBase.TileLayer.cs index bc0042b..2df44b4 100644 --- a/src/DotTiled/Serialization/Tmx/TmxReaderBase.TileLayer.cs +++ b/src/DotTiled/Serialization/Tmx/TmxReaderBase.TileLayer.cs @@ -16,7 +16,7 @@ public abstract partial class TmxReaderBase 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"); + var tintColor = _reader.GetOptionalAttributeClass("tintcolor"); var offsetX = _reader.GetOptionalAttributeParseable("offsetx").GetValueOr(0.0f); var offsetY = _reader.GetOptionalAttributeParseable("offsety").GetValueOr(0.0f); var parallaxX = _reader.GetOptionalAttributeParseable("parallaxx").GetValueOr(1.0f); @@ -63,7 +63,7 @@ public abstract partial class TmxReaderBase 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"); + var tintColor = _reader.GetOptionalAttributeClass("tintcolor"); var offsetX = _reader.GetOptionalAttributeParseable("offsetx").GetValueOr(0.0f); var offsetY = _reader.GetOptionalAttributeParseable("offsety").GetValueOr(0.0f); var parallaxX = _reader.GetOptionalAttributeParseable("parallaxx").GetValueOr(1.0f); @@ -110,7 +110,7 @@ public abstract partial class TmxReaderBase var @class = _reader.GetOptionalAttribute("class").GetValueOr(""); var opacity = _reader.GetOptionalAttributeParseable("opacity").GetValueOr(1.0f); var visible = _reader.GetOptionalAttributeParseable("visible").GetValueOr(1) == 1; - var tintColor = _reader.GetOptionalAttributeClass("tintcolor"); + var tintColor = _reader.GetOptionalAttributeClass("tintcolor"); var offsetX = _reader.GetOptionalAttributeParseable("offsetx").GetValueOr(0f); var offsetY = _reader.GetOptionalAttributeParseable("offsety").GetValueOr(0f); var parallaxX = _reader.GetOptionalAttributeParseable("parallaxx").GetValueOr(1f); diff --git a/src/DotTiled/Serialization/Tmx/TmxReaderBase.Tileset.cs b/src/DotTiled/Serialization/Tmx/TmxReaderBase.Tileset.cs index 5d3671d..4180bfe 100644 --- a/src/DotTiled/Serialization/Tmx/TmxReaderBase.Tileset.cs +++ b/src/DotTiled/Serialization/Tmx/TmxReaderBase.Tileset.cs @@ -125,7 +125,7 @@ public abstract partial class TmxReaderBase _ => throw new InvalidOperationException($"Unknown image format '{s}'") }); var source = _reader.GetOptionalAttribute("source"); - var transparentColor = _reader.GetOptionalAttributeClass("trans"); + var transparentColor = _reader.GetOptionalAttributeClass("trans"); var width = _reader.GetOptionalAttributeParseable("width"); var height = _reader.GetOptionalAttributeParseable("height"); @@ -277,7 +277,7 @@ public abstract partial class TmxReaderBase // Attributes var name = _reader.GetRequiredAttribute("name"); var @class = _reader.GetOptionalAttribute("class").GetValueOr(""); - var color = _reader.GetRequiredAttributeParseable("color"); + var color = _reader.GetRequiredAttributeParseable("color"); var tile = _reader.GetRequiredAttributeParseable("tile"); var probability = _reader.GetOptionalAttributeParseable("probability").GetValueOr(0f); diff --git a/src/DotTiled/Tilesets/Image.cs b/src/DotTiled/Tilesets/Image.cs index 4be1aac..8685617 100644 --- a/src/DotTiled/Tilesets/Image.cs +++ b/src/DotTiled/Tilesets/Image.cs @@ -44,7 +44,7 @@ public class Image /// /// Defines a specific color that is treated as transparent. /// - public Optional TransparentColor { get; set; } = Optional.Empty; + public Optional TransparentColor { get; set; } = Optional.Empty; /// /// The image width in pixels, used for tile index correction when the image changes. diff --git a/src/DotTiled/Tilesets/WangColor.cs b/src/DotTiled/Tilesets/WangColor.cs index b5ef482..58131bd 100644 --- a/src/DotTiled/Tilesets/WangColor.cs +++ b/src/DotTiled/Tilesets/WangColor.cs @@ -20,7 +20,7 @@ public class WangColor : HasPropertiesBase /// /// The color of the Wang color. /// - public required Color Color { get; set; } + public required TiledColor Color { get; set; } /// /// The tile ID of the tile representing this color.