mirror of
https://github.com/dcronqvist/DotTiled.git
synced 2025-05-07 20:26:02 +03:00
Merge pull request #84 from dcronqvist/tiled-color
Rename Color to TiledColor
This commit is contained in:
commit
c27049780a
38 changed files with 85 additions and 86 deletions
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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 },
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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<Color>.Empty }
|
||||
new ColorProperty { Name = "unsetcolorprop", Value = Optional<TiledColor>.Empty }
|
||||
]
|
||||
};
|
||||
}
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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
|
||||
{
|
||||
|
|
|
@ -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
|
||||
{
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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 },
|
||||
|
|
|
@ -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<IProperty> 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);
|
||||
|
|
|
@ -37,7 +37,7 @@ public abstract class BaseLayer : HasPropertiesBase
|
|||
/// <summary>
|
||||
/// A tint color that is multiplied with any tiles drawn by this layer.
|
||||
/// </summary>
|
||||
public Optional<Color> TintColor { get; set; } = Optional<Color>.Empty;
|
||||
public Optional<TiledColor> TintColor { get; set; } = Optional<TiledColor>.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Horizontal offset for this layer in pixels.
|
||||
|
|
|
@ -46,7 +46,7 @@ public class ObjectLayer : BaseLayer
|
|||
/// <summary>
|
||||
/// A color that is multiplied with any tile objects drawn by this layer.
|
||||
/// </summary>
|
||||
public Optional<Color> Color { get; set; } = Optional<Color>.Empty;
|
||||
public Optional<TiledColor> Color { get; set; } = Optional<TiledColor>.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Whether the objects are drawn according to the order of appearance (<see cref="DrawOrder.Index"/>) or sorted by their Y coordinate (<see cref="DrawOrder.TopDown"/>).
|
||||
|
|
|
@ -72,7 +72,7 @@ public class TextObject : Object
|
|||
/// <summary>
|
||||
/// The color of the text.
|
||||
/// </summary>
|
||||
public Color Color { get; set; } = Color.Parse("#000000", CultureInfo.InvariantCulture);
|
||||
public TiledColor Color { get; set; } = TiledColor.Parse("#000000", CultureInfo.InvariantCulture);
|
||||
|
||||
/// <summary>
|
||||
/// Whether the text is bold.
|
||||
|
|
|
@ -171,7 +171,7 @@ public class Map : HasPropertiesBase
|
|||
/// <summary>
|
||||
/// The background color of the map.
|
||||
/// </summary>
|
||||
public Color BackgroundColor { get; set; } = Color.Parse("#00000000", CultureInfo.InvariantCulture);
|
||||
public TiledColor BackgroundColor { get; set; } = TiledColor.Parse("#00000000", CultureInfo.InvariantCulture);
|
||||
|
||||
/// <summary>
|
||||
/// Stores the next available ID for new layers. This number is used to prevent reuse of the same ID after layers have been removed.
|
||||
|
|
|
@ -3,7 +3,7 @@ namespace DotTiled;
|
|||
/// <summary>
|
||||
/// Represents a color property.
|
||||
/// </summary>
|
||||
public class ColorProperty : IProperty<Optional<Color>>
|
||||
public class ColorProperty : IProperty<Optional<TiledColor>>
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public required string Name { get; set; }
|
||||
|
@ -14,7 +14,7 @@ public class ColorProperty : IProperty<Optional<Color>>
|
|||
/// <summary>
|
||||
/// The color value of the property.
|
||||
/// </summary>
|
||||
public required Optional<Color> Value { get; set; }
|
||||
public required Optional<TiledColor> Value { get; set; }
|
||||
|
||||
/// <inheritdoc/>
|
||||
public IProperty Clone() => new ColorProperty
|
||||
|
|
|
@ -78,7 +78,7 @@ public class CustomClassDefinition : HasPropertiesBase, ICustomTypeDefinition
|
|||
/// <summary>
|
||||
/// The color of the custom class inside the Tiled editor.
|
||||
/// </summary>
|
||||
public Color Color { get; set; }
|
||||
public TiledColor Color { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 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):
|
||||
|
|
|
@ -7,7 +7,7 @@ namespace DotTiled;
|
|||
/// <summary>
|
||||
/// Represents a Tiled color.
|
||||
/// </summary>
|
||||
public class Color : IParsable<Color>, IEquatable<Color>
|
||||
public class TiledColor : IParsable<TiledColor>, IEquatable<TiledColor>
|
||||
{
|
||||
/// <summary>
|
||||
/// The red component of the color.
|
||||
|
@ -30,31 +30,31 @@ public class Color : IParsable<Color>, IEquatable<Color>
|
|||
public byte A { get; set; } = 255;
|
||||
|
||||
/// <summary>
|
||||
/// Attempts to parse the specified string into a <see cref="Color"/>. Expects strings in the format <c>#RRGGBB</c> or <c>#AARRGGBB</c>.
|
||||
/// Attempts to parse the specified string into a <see cref="TiledColor"/>. Expects strings in the format <c>#RRGGBB</c> or <c>#AARRGGBB</c>.
|
||||
/// The leading <c>#</c> is optional.
|
||||
/// </summary>
|
||||
/// <param name="s">A string value to parse into a <see cref="Color"/></param>
|
||||
/// <param name="s">A string value to parse into a <see cref="TiledColor"/></param>
|
||||
/// <param name="provider">An object that supplies culture-specific information about the format of s.</param>
|
||||
/// <returns>The parsed <see cref="Color"/></returns>
|
||||
/// <returns>The parsed <see cref="TiledColor"/></returns>
|
||||
/// <exception cref="FormatException">Thrown in case the provided string <paramref name="s"/> is not in a valid format.</exception>
|
||||
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}");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Attempts to parse the specified string into a <see cref="Color"/>. Expects strings in the format <c>#RRGGBB</c> or <c>#AARRGGBB</c>.
|
||||
/// Attempts to parse the specified string into a <see cref="TiledColor"/>. Expects strings in the format <c>#RRGGBB</c> or <c>#AARRGGBB</c>.
|
||||
/// The leading <c>#</c> is optional.
|
||||
/// </summary>
|
||||
/// <param name="s">A string value to parse into a <see cref="Color"/></param>
|
||||
/// <param name="s">A string value to parse into a <see cref="TiledColor"/></param>
|
||||
/// <param name="provider">An object that supplies culture-specific information about the format of s.</param>
|
||||
/// <param name="result">When this method returns, contains the parsed <see cref="Color"/> or <c>null</c> on failure.</param>
|
||||
/// <param name="result">When this method returns, contains the parsed <see cref="TiledColor"/> or <c>null</c> on failure.</param>
|
||||
/// <returns><c>true</c> if <paramref name="s"/> was successfully parsed; otherwise, <c>false</c>.</returns>
|
||||
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<Color>, IEquatable<Color>
|
|||
|
||||
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<Color>, IEquatable<Color>
|
|||
}
|
||||
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<Color>, IEquatable<Color>
|
|||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public bool Equals(Color other)
|
||||
public bool Equals(TiledColor other)
|
||||
{
|
||||
if (other is null)
|
||||
return false;
|
||||
|
@ -99,7 +99,7 @@ public class Color : IParsable<Color>, IEquatable<Color>
|
|||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override bool Equals(object obj) => obj is Color other && Equals(other);
|
||||
public override bool Equals(object obj) => obj is TiledColor other && Equals(other);
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override int GetHashCode() => HashCode.Combine(R, G, B, A);
|
|
@ -12,7 +12,7 @@ public abstract partial class TmjReaderBase
|
|||
var @class = element.GetOptionalProperty<string>("class").GetValueOr("");
|
||||
var opacity = element.GetOptionalProperty<float>("opacity").GetValueOr(1.0f);
|
||||
var visible = element.GetOptionalProperty<bool>("visible").GetValueOr(true);
|
||||
var tintColor = element.GetOptionalPropertyParseable<Color>("tintcolor");
|
||||
var tintColor = element.GetOptionalPropertyParseable<TiledColor>("tintcolor");
|
||||
var offsetX = element.GetOptionalProperty<float>("offsetx").GetValueOr(0.0f);
|
||||
var offsetY = element.GetOptionalProperty<float>("offsety").GetValueOr(0.0f);
|
||||
var parallaxX = element.GetOptionalProperty<float>("parallaxx").GetValueOr(1.0f);
|
||||
|
|
|
@ -11,7 +11,7 @@ public abstract partial class TmjReaderBase
|
|||
var @class = element.GetOptionalProperty<string>("class").GetValueOr("");
|
||||
var opacity = element.GetOptionalProperty<float>("opacity").GetValueOr(1.0f);
|
||||
var visible = element.GetOptionalProperty<bool>("visible").GetValueOr(true);
|
||||
var tintColor = element.GetOptionalPropertyParseable<Color>("tintcolor");
|
||||
var tintColor = element.GetOptionalPropertyParseable<TiledColor>("tintcolor");
|
||||
var offsetX = element.GetOptionalProperty<float>("offsetx").GetValueOr(0.0f);
|
||||
var offsetY = element.GetOptionalProperty<float>("offsety").GetValueOr(0.0f);
|
||||
var parallaxX = element.GetOptionalProperty<float>("parallaxx").GetValueOr(1.0f);
|
||||
|
@ -21,7 +21,7 @@ public abstract partial class TmjReaderBase
|
|||
var image = element.GetRequiredProperty<string>("image");
|
||||
var repeatX = element.GetOptionalProperty<bool>("repeatx").GetValueOr(false);
|
||||
var repeatY = element.GetOptionalProperty<bool>("repeaty").GetValueOr(false);
|
||||
var transparentColor = element.GetOptionalPropertyParseable<Color>("transparentcolor");
|
||||
var transparentColor = element.GetOptionalPropertyParseable<TiledColor>("transparentcolor");
|
||||
var x = element.GetOptionalProperty<int>("x").GetValueOr(0);
|
||||
var y = element.GetOptionalProperty<int>("y").GetValueOr(0);
|
||||
|
||||
|
|
|
@ -47,7 +47,7 @@ public abstract partial class TmjReaderBase
|
|||
});
|
||||
var parallaxOriginX = element.GetOptionalProperty<float>("parallaxoriginx").GetValueOr(0f);
|
||||
var parallaxOriginY = element.GetOptionalProperty<float>("parallaxoriginy").GetValueOr(0f);
|
||||
var backgroundColor = element.GetOptionalPropertyParseable<Color>("backgroundcolor").GetValueOr(Color.Parse("#00000000", CultureInfo.InvariantCulture));
|
||||
var backgroundColor = element.GetOptionalPropertyParseable<TiledColor>("backgroundcolor").GetValueOr(TiledColor.Parse("#00000000", CultureInfo.InvariantCulture));
|
||||
var nextLayerID = element.GetRequiredProperty<uint>("nextlayerid");
|
||||
var nextObjectID = element.GetRequiredProperty<uint>("nextobjectid");
|
||||
var infinite = element.GetOptionalProperty<bool>("infinite").GetValueOr(false);
|
||||
|
|
|
@ -15,7 +15,7 @@ public abstract partial class TmjReaderBase
|
|||
var @class = element.GetOptionalProperty<string>("class").GetValueOr("");
|
||||
var opacity = element.GetOptionalProperty<float>("opacity").GetValueOr(1.0f);
|
||||
var visible = element.GetOptionalProperty<bool>("visible").GetValueOr(true);
|
||||
var tintColor = element.GetOptionalPropertyParseable<Color>("tintcolor");
|
||||
var tintColor = element.GetOptionalPropertyParseable<TiledColor>("tintcolor");
|
||||
var offsetX = element.GetOptionalProperty<float>("offsetx").GetValueOr(0.0f);
|
||||
var offsetY = element.GetOptionalProperty<float>("offsety").GetValueOr(0.0f);
|
||||
var parallaxX = element.GetOptionalProperty<float>("parallaxx").GetValueOr(1.0f);
|
||||
|
@ -26,7 +26,7 @@ public abstract partial class TmjReaderBase
|
|||
var y = element.GetOptionalProperty<int>("y").GetValueOr(0);
|
||||
var width = element.GetOptionalProperty<int>("width").GetValueOr(0);
|
||||
var height = element.GetOptionalProperty<int>("height").GetValueOr(0);
|
||||
var color = element.GetOptionalPropertyParseable<Color>("color");
|
||||
var color = element.GetOptionalPropertyParseable<TiledColor>("color");
|
||||
var drawOrder = element.GetOptionalPropertyParseable<DrawOrder>("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<bool>("bold").GetValueOr(false);
|
||||
var color = element.GetOptionalPropertyParseable<Color>("color").GetValueOr(Color.Parse("#00000000", CultureInfo.InvariantCulture));
|
||||
var color = element.GetOptionalPropertyParseable<TiledColor>("color").GetValueOr(TiledColor.Parse("#00000000", CultureInfo.InvariantCulture));
|
||||
var fontfamily = element.GetOptionalProperty<string>("fontfamily").GetValueOr("sans-serif");
|
||||
var halign = element.GetOptionalPropertyParseable<TextHorizontalAlignment>("halign", s => s switch
|
||||
{
|
||||
|
|
|
@ -36,7 +36,7 @@ public abstract partial class TmjReaderBase
|
|||
PropertyType.Int => new IntProperty { Name = name, Value = e.GetRequiredProperty<int>("value") },
|
||||
PropertyType.Float => new FloatProperty { Name = name, Value = e.GetRequiredProperty<float>("value") },
|
||||
PropertyType.Bool => new BoolProperty { Name = name, Value = e.GetRequiredProperty<bool>("value") },
|
||||
PropertyType.Color => new ColorProperty { Name = name, Value = e.GetRequiredPropertyParseable<Color>("value", s => s == "" ? default : Color.Parse(s, CultureInfo.InvariantCulture)) },
|
||||
PropertyType.Color => new ColorProperty { Name = name, Value = e.GetRequiredPropertyParseable<TiledColor>("value", s => s == "" ? default : TiledColor.Parse(s, CultureInfo.InvariantCulture)) },
|
||||
PropertyType.File => new FileProperty { Name = name, Value = e.GetRequiredProperty<string>("value") },
|
||||
PropertyType.Object => new ObjectProperty { Name = name, Value = e.GetRequiredProperty<uint>("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<int>() },
|
||||
PropertyType.Float => new FloatProperty { Name = prop.Name, Value = propElement.GetValueAs<float>() },
|
||||
PropertyType.Bool => new BoolProperty { Name = prop.Name, Value = propElement.GetValueAs<bool>() },
|
||||
PropertyType.Color => new ColorProperty { Name = prop.Name, Value = Color.Parse(propElement.GetValueAs<string>(), CultureInfo.InvariantCulture) },
|
||||
PropertyType.Color => new ColorProperty { Name = prop.Name, Value = TiledColor.Parse(propElement.GetValueAs<string>(), CultureInfo.InvariantCulture) },
|
||||
PropertyType.File => new FileProperty { Name = prop.Name, Value = propElement.GetValueAs<string>() },
|
||||
PropertyType.Object => new ObjectProperty { Name = prop.Name, Value = propElement.GetValueAs<uint>() },
|
||||
PropertyType.Enum => ReadEnumProperty(propElement),
|
||||
|
|
|
@ -35,8 +35,8 @@ public abstract partial class TmjReaderBase
|
|||
var repeatY = element.GetOptionalProperty<bool>("repeaty").GetValueOr(false);
|
||||
var startX = element.GetOptionalProperty<int>("startx").GetValueOr(0);
|
||||
var startY = element.GetOptionalProperty<int>("starty").GetValueOr(0);
|
||||
var tintColor = element.GetOptionalPropertyParseable<Color>("tintcolor");
|
||||
var transparentColor = element.GetOptionalPropertyParseable<Color>("transparentcolor");
|
||||
var tintColor = element.GetOptionalPropertyParseable<TiledColor>("tintcolor");
|
||||
var transparentColor = element.GetOptionalPropertyParseable<TiledColor>("transparentcolor");
|
||||
var visible = element.GetOptionalProperty<bool>("visible").GetValueOr(true);
|
||||
var width = element.GetRequiredProperty<int>("width");
|
||||
var x = element.GetRequiredProperty<int>("x");
|
||||
|
|
|
@ -10,7 +10,7 @@ public abstract partial class TmjReaderBase
|
|||
Optional<string> parentVersion = null,
|
||||
Optional<string> parentTiledVersion = null)
|
||||
{
|
||||
var backgroundColor = element.GetOptionalPropertyParseable<Color>("backgroundcolor");
|
||||
var backgroundColor = element.GetOptionalPropertyParseable<TiledColor>("backgroundcolor");
|
||||
var @class = element.GetOptionalProperty<string>("class").GetValueOr("");
|
||||
var columns = element.GetOptionalProperty<int>("columns");
|
||||
var fillMode = element.GetOptionalPropertyParseable<FillMode>("fillmode", s => s switch
|
||||
|
@ -55,8 +55,7 @@ public abstract partial class TmjReaderBase
|
|||
}).GetValueOr(TileRenderSize.Tile);
|
||||
var tiles = element.GetOptionalPropertyCustom<List<Tile>>("tiles", ReadTiles).GetValueOr([]);
|
||||
var tileWidth = element.GetOptionalProperty<int>("tilewidth");
|
||||
var transparentColor = element.GetOptionalPropertyParseable<Color>("transparentcolor");
|
||||
var type = element.GetOptionalProperty<string>("type");
|
||||
var transparentColor = element.GetOptionalPropertyParseable<TiledColor>("transparentcolor");
|
||||
var version = element.GetOptionalProperty<string>("version").GetValueOrOptional(parentVersion);
|
||||
var transformations = element.GetOptionalPropertyCustom<Transformations>("transformations", ReadTransformations);
|
||||
var wangsets = element.GetOptionalPropertyCustom<List<Wangset>>("wangsets", el => el.GetValueAsList<Wangset>(e => ReadWangset(e))).GetValueOr([]);
|
||||
|
@ -229,7 +228,7 @@ public abstract partial class TmjReaderBase
|
|||
internal WangColor ReadWangColor(JsonElement element)
|
||||
{
|
||||
var @class = element.GetOptionalProperty<string>("class").GetValueOr("");
|
||||
var color = element.GetRequiredPropertyParseable<Color>("color");
|
||||
var color = element.GetRequiredPropertyParseable<TiledColor>("color");
|
||||
var name = element.GetRequiredProperty<string>("name");
|
||||
var probability = element.GetOptionalProperty<float>("probability").GetValueOr(1.0f);
|
||||
var properties = ResolveAndMergeProperties(@class, element.GetOptionalPropertyCustom("properties", ReadProperties).GetValueOr([]));
|
||||
|
|
|
@ -51,7 +51,7 @@ public abstract partial class TmxReaderBase
|
|||
});
|
||||
var parallaxOriginX = _reader.GetOptionalAttributeParseable<float>("parallaxoriginx").GetValueOr(0.0f);
|
||||
var parallaxOriginY = _reader.GetOptionalAttributeParseable<float>("parallaxoriginy").GetValueOr(0.0f);
|
||||
var backgroundColor = _reader.GetOptionalAttributeClass<Color>("backgroundcolor").GetValueOr(Color.Parse("#00000000", CultureInfo.InvariantCulture));
|
||||
var backgroundColor = _reader.GetOptionalAttributeClass<TiledColor>("backgroundcolor").GetValueOr(TiledColor.Parse("#00000000", CultureInfo.InvariantCulture));
|
||||
var nextLayerID = _reader.GetRequiredAttributeParseable<uint>("nextlayerid");
|
||||
var nextObjectID = _reader.GetRequiredAttributeParseable<uint>("nextobjectid");
|
||||
var infinite = _reader.GetOptionalAttributeParseable<uint>("infinite").GetValueOr(0) == 1;
|
||||
|
|
|
@ -20,12 +20,12 @@ public abstract partial class TmxReaderBase
|
|||
var height = _reader.GetOptionalAttributeParseable<int>("height").GetValueOr(0);
|
||||
var opacity = _reader.GetOptionalAttributeParseable<float>("opacity").GetValueOr(1.0f);
|
||||
var visible = _reader.GetOptionalAttributeParseable<uint>("visible").GetValueOr(1) == 1;
|
||||
var tintColor = _reader.GetOptionalAttributeClass<Color>("tintcolor");
|
||||
var tintColor = _reader.GetOptionalAttributeClass<TiledColor>("tintcolor");
|
||||
var offsetX = _reader.GetOptionalAttributeParseable<float>("offsetx").GetValueOr(0.0f);
|
||||
var offsetY = _reader.GetOptionalAttributeParseable<float>("offsety").GetValueOr(0.0f);
|
||||
var parallaxX = _reader.GetOptionalAttributeParseable<float>("parallaxx").GetValueOr(1.0f);
|
||||
var parallaxY = _reader.GetOptionalAttributeParseable<float>("parallaxy").GetValueOr(1.0f);
|
||||
var color = _reader.GetOptionalAttributeClass<Color>("color");
|
||||
var color = _reader.GetOptionalAttributeClass<TiledColor>("color");
|
||||
var drawOrder = _reader.GetOptionalAttributeEnum<DrawOrder>("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<int>("pixelsize") ?? 16;
|
||||
var wrap = _reader.GetOptionalAttributeParseable<bool>("wrap") ?? false;
|
||||
var color = _reader.GetOptionalAttributeClass<Color>("color") ?? Color.Parse("#000000", CultureInfo.InvariantCulture);
|
||||
var color = _reader.GetOptionalAttributeClass<TiledColor>("color") ?? TiledColor.Parse("#000000", CultureInfo.InvariantCulture);
|
||||
var bold = _reader.GetOptionalAttributeParseable<bool>("bold") ?? false;
|
||||
var italic = _reader.GetOptionalAttributeParseable<bool>("italic") ?? false;
|
||||
var underline = _reader.GetOptionalAttributeParseable<bool>("underline") ?? false;
|
||||
|
|
|
@ -45,7 +45,7 @@ public abstract partial class TmxReaderBase
|
|||
PropertyType.Int => new IntProperty { Name = name, Value = r.GetRequiredAttributeParseable<int>("value") },
|
||||
PropertyType.Float => new FloatProperty { Name = name, Value = r.GetRequiredAttributeParseable<float>("value") },
|
||||
PropertyType.Bool => new BoolProperty { Name = name, Value = r.GetRequiredAttributeParseable<bool>("value") },
|
||||
PropertyType.Color => new ColorProperty { Name = name, Value = r.GetRequiredAttributeParseable<Color>("value", s => s == "" ? default : Color.Parse(s, CultureInfo.InvariantCulture)) },
|
||||
PropertyType.Color => new ColorProperty { Name = name, Value = r.GetRequiredAttributeParseable<TiledColor>("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<uint>("value") },
|
||||
PropertyType.Class => throw new XmlException("Class property must have a property type"),
|
||||
|
|
|
@ -16,7 +16,7 @@ public abstract partial class TmxReaderBase
|
|||
var height = _reader.GetRequiredAttributeParseable<int>("height");
|
||||
var opacity = _reader.GetOptionalAttributeParseable<float>("opacity").GetValueOr(1.0f);
|
||||
var visible = _reader.GetOptionalAttributeParseable<uint>("visible").GetValueOr(1) == 1;
|
||||
var tintColor = _reader.GetOptionalAttributeClass<Color>("tintcolor");
|
||||
var tintColor = _reader.GetOptionalAttributeClass<TiledColor>("tintcolor");
|
||||
var offsetX = _reader.GetOptionalAttributeParseable<float>("offsetx").GetValueOr(0.0f);
|
||||
var offsetY = _reader.GetOptionalAttributeParseable<float>("offsety").GetValueOr(0.0f);
|
||||
var parallaxX = _reader.GetOptionalAttributeParseable<float>("parallaxx").GetValueOr(1.0f);
|
||||
|
@ -63,7 +63,7 @@ public abstract partial class TmxReaderBase
|
|||
var y = _reader.GetOptionalAttributeParseable<int>("y").GetValueOr(0);
|
||||
var opacity = _reader.GetOptionalAttributeParseable<float>("opacity").GetValueOr(1f);
|
||||
var visible = _reader.GetOptionalAttributeParseable<bool>("visible").GetValueOr(true);
|
||||
var tintColor = _reader.GetOptionalAttributeClass<Color>("tintcolor");
|
||||
var tintColor = _reader.GetOptionalAttributeClass<TiledColor>("tintcolor");
|
||||
var offsetX = _reader.GetOptionalAttributeParseable<float>("offsetx").GetValueOr(0.0f);
|
||||
var offsetY = _reader.GetOptionalAttributeParseable<float>("offsety").GetValueOr(0.0f);
|
||||
var parallaxX = _reader.GetOptionalAttributeParseable<float>("parallaxx").GetValueOr(1.0f);
|
||||
|
@ -110,7 +110,7 @@ public abstract partial class TmxReaderBase
|
|||
var @class = _reader.GetOptionalAttribute("class").GetValueOr("");
|
||||
var opacity = _reader.GetOptionalAttributeParseable<float>("opacity").GetValueOr(1.0f);
|
||||
var visible = _reader.GetOptionalAttributeParseable<uint>("visible").GetValueOr(1) == 1;
|
||||
var tintColor = _reader.GetOptionalAttributeClass<Color>("tintcolor");
|
||||
var tintColor = _reader.GetOptionalAttributeClass<TiledColor>("tintcolor");
|
||||
var offsetX = _reader.GetOptionalAttributeParseable<float>("offsetx").GetValueOr(0f);
|
||||
var offsetY = _reader.GetOptionalAttributeParseable<float>("offsety").GetValueOr(0f);
|
||||
var parallaxX = _reader.GetOptionalAttributeParseable<float>("parallaxx").GetValueOr(1f);
|
||||
|
|
|
@ -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<Color>("trans");
|
||||
var transparentColor = _reader.GetOptionalAttributeClass<TiledColor>("trans");
|
||||
var width = _reader.GetOptionalAttributeParseable<int>("width");
|
||||
var height = _reader.GetOptionalAttributeParseable<int>("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>("color");
|
||||
var color = _reader.GetRequiredAttributeParseable<TiledColor>("color");
|
||||
var tile = _reader.GetRequiredAttributeParseable<int>("tile");
|
||||
var probability = _reader.GetOptionalAttributeParseable<float>("probability").GetValueOr(0f);
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@ public class Image
|
|||
/// <summary>
|
||||
/// Defines a specific color that is treated as transparent.
|
||||
/// </summary>
|
||||
public Optional<Color> TransparentColor { get; set; } = Optional<Color>.Empty;
|
||||
public Optional<TiledColor> TransparentColor { get; set; } = Optional<TiledColor>.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// The image width in pixels, used for tile index correction when the image changes.
|
||||
|
|
|
@ -20,7 +20,7 @@ public class WangColor : HasPropertiesBase
|
|||
/// <summary>
|
||||
/// The color of the Wang color.
|
||||
/// </summary>
|
||||
public required Color Color { get; set; }
|
||||
public required TiledColor Color { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The tile ID of the tile representing this color.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue