diff --git a/src/DotTiled/Properties/BoolProperty.cs b/src/DotTiled/Properties/BoolProperty.cs index e401d38..0597e60 100644 --- a/src/DotTiled/Properties/BoolProperty.cs +++ b/src/DotTiled/Properties/BoolProperty.cs @@ -16,6 +16,9 @@ public class BoolProperty : IProperty /// public required bool Value { get; set; } + /// + public string ValueString => Value.ToString(); + /// public IProperty Clone() => new BoolProperty { diff --git a/src/DotTiled/Properties/ClassProperty.cs b/src/DotTiled/Properties/ClassProperty.cs index 7244aa5..bc30fdb 100644 --- a/src/DotTiled/Properties/ClassProperty.cs +++ b/src/DotTiled/Properties/ClassProperty.cs @@ -25,6 +25,9 @@ public class ClassProperty : HasPropertiesBase, IProperty> /// public required IList Value { get; set; } + /// + public string ValueString => PropertyType; + /// public IProperty Clone() => new ClassProperty { diff --git a/src/DotTiled/Properties/ColorProperty.cs b/src/DotTiled/Properties/ColorProperty.cs index 0fff029..345fedc 100644 --- a/src/DotTiled/Properties/ColorProperty.cs +++ b/src/DotTiled/Properties/ColorProperty.cs @@ -16,6 +16,10 @@ public class ColorProperty : IProperty /// public required Color Value { get; set; } + + /// + public string ValueString => Value != null ? Value.ToString() : string.Empty; + /// public IProperty Clone() => new ColorProperty { diff --git a/src/DotTiled/Properties/EnumProperty.cs b/src/DotTiled/Properties/EnumProperty.cs index a123f9a..7104307 100644 --- a/src/DotTiled/Properties/EnumProperty.cs +++ b/src/DotTiled/Properties/EnumProperty.cs @@ -25,12 +25,16 @@ public class EnumProperty : IProperty> /// public required ISet Value { get; set; } + /// + public required string ValueString { get; set; } + /// public IProperty Clone() => new EnumProperty { Name = Name, PropertyType = PropertyType, - Value = Value.ToHashSet() + Value = Value.ToHashSet(), + ValueString = ValueString }; /// diff --git a/src/DotTiled/Properties/FileProperty.cs b/src/DotTiled/Properties/FileProperty.cs index 01d4a08..1da07e3 100644 --- a/src/DotTiled/Properties/FileProperty.cs +++ b/src/DotTiled/Properties/FileProperty.cs @@ -16,6 +16,9 @@ public class FileProperty : IProperty /// public required string Value { get; set; } + /// + public string ValueString => Value; + /// public IProperty Clone() => new FileProperty { diff --git a/src/DotTiled/Properties/FloatProperty.cs b/src/DotTiled/Properties/FloatProperty.cs index 1652e20..f7a3500 100644 --- a/src/DotTiled/Properties/FloatProperty.cs +++ b/src/DotTiled/Properties/FloatProperty.cs @@ -16,6 +16,9 @@ public class FloatProperty : IProperty /// public required float Value { get; set; } + /// + public string ValueString => Value.ToString(); + /// public IProperty Clone() => new FloatProperty { diff --git a/src/DotTiled/Properties/IProperty.cs b/src/DotTiled/Properties/IProperty.cs index de9eebf..e316896 100644 --- a/src/DotTiled/Properties/IProperty.cs +++ b/src/DotTiled/Properties/IProperty.cs @@ -10,6 +10,11 @@ public interface IProperty /// public string Name { get; set; } + /// + /// The value of the property as it is in the .tmx / .tmj + /// + public string ValueString { get; } + /// /// The type of the property. /// diff --git a/src/DotTiled/Properties/IntProperty.cs b/src/DotTiled/Properties/IntProperty.cs index 2765038..7ead01d 100644 --- a/src/DotTiled/Properties/IntProperty.cs +++ b/src/DotTiled/Properties/IntProperty.cs @@ -16,6 +16,9 @@ public class IntProperty : IProperty /// public required int Value { get; set; } + /// + public string ValueString => Value.ToString(); + /// public IProperty Clone() => new IntProperty { diff --git a/src/DotTiled/Properties/ObjectProperty.cs b/src/DotTiled/Properties/ObjectProperty.cs index a33e401..c7b9388 100644 --- a/src/DotTiled/Properties/ObjectProperty.cs +++ b/src/DotTiled/Properties/ObjectProperty.cs @@ -16,6 +16,9 @@ public class ObjectProperty : IProperty /// public required uint Value { get; set; } + /// + public string ValueString => Value.ToString(); + /// public IProperty Clone() => new ObjectProperty { diff --git a/src/DotTiled/Properties/StringProperty.cs b/src/DotTiled/Properties/StringProperty.cs index c0c8722..e14b9bb 100644 --- a/src/DotTiled/Properties/StringProperty.cs +++ b/src/DotTiled/Properties/StringProperty.cs @@ -16,6 +16,9 @@ public class StringProperty : IProperty /// public required string Value { get; set; } + /// + public string ValueString => Value; + /// public IProperty Clone() => new StringProperty { diff --git a/src/DotTiled/Serialization/Tmj/TmjReaderBase.Properties.cs b/src/DotTiled/Serialization/Tmj/TmjReaderBase.Properties.cs index b877382..24e88c9 100644 --- a/src/DotTiled/Serialization/Tmj/TmjReaderBase.Properties.cs +++ b/src/DotTiled/Serialization/Tmj/TmjReaderBase.Properties.cs @@ -135,16 +135,17 @@ public abstract partial class TmjReaderBase if (ced.ValueAsFlags) { var values = value.Split(',').Select(v => v.Trim()).ToHashSet(); - return new EnumProperty { Name = name, PropertyType = propertyType, Value = values }; + return new EnumProperty { Name = name, PropertyType = propertyType, Value = values, ValueString = value}; } else { - return new EnumProperty { Name = name, PropertyType = propertyType, Value = new HashSet { value } }; + return new EnumProperty { Name = name, PropertyType = propertyType, Value = new HashSet { value }, ValueString = value }; } } else if (ced.StorageType == CustomEnumStorageType.Int) { var value = element.GetRequiredProperty("value"); + var valueString = element.GetRequiredProperty("value"); if (ced.ValueAsFlags) { var allValues = ced.Values; @@ -158,13 +159,13 @@ public abstract partial class TmjReaderBase _ = enumValues.Add(enumValue); } } - return new EnumProperty { Name = name, PropertyType = propertyType, Value = enumValues }; + return new EnumProperty { Name = name, PropertyType = propertyType, Value = enumValues, ValueString = valueString }; } else { var allValues = ced.Values; var enumValue = allValues[value]; - return new EnumProperty { Name = name, PropertyType = propertyType, Value = new HashSet { enumValue } }; + return new EnumProperty { Name = name, PropertyType = propertyType, Value = new HashSet { enumValue }, ValueString = valueString }; } } diff --git a/src/DotTiled/Serialization/Tmx/TmxReaderBase.ObjectLayer.cs b/src/DotTiled/Serialization/Tmx/TmxReaderBase.ObjectLayer.cs index 46626e6..059adcd 100644 --- a/src/DotTiled/Serialization/Tmx/TmxReaderBase.ObjectLayer.cs +++ b/src/DotTiled/Serialization/Tmx/TmxReaderBase.ObjectLayer.cs @@ -159,7 +159,8 @@ public abstract partial class TmxReaderBase return obj; } - return OverrideObject((dynamic)obj, (dynamic)foundObject); + //return OverrideObject((dynamic)obj, (dynamic)foundObject); + return foundObject; } internal EllipseObject ReadEllipseObject() diff --git a/src/DotTiled/Serialization/Tmx/TmxReaderBase.Properties.cs b/src/DotTiled/Serialization/Tmx/TmxReaderBase.Properties.cs index bfdb93d..8f5bad9 100644 --- a/src/DotTiled/Serialization/Tmx/TmxReaderBase.Properties.cs +++ b/src/DotTiled/Serialization/Tmx/TmxReaderBase.Properties.cs @@ -111,16 +111,17 @@ public abstract partial class TmxReaderBase if (ced.ValueAsFlags) { var values = value.Split(',').Select(v => v.Trim()).ToHashSet(); - return new EnumProperty { Name = name, PropertyType = propertyType, Value = values }; + return new EnumProperty { Name = name, PropertyType = propertyType, Value = values, ValueString = value }; } else { - return new EnumProperty { Name = name, PropertyType = propertyType, Value = new HashSet { value } }; + return new EnumProperty { Name = name, PropertyType = propertyType, Value = new HashSet { value }, ValueString = value }; } } else if (ced.StorageType == CustomEnumStorageType.Int) { var value = _reader.GetRequiredAttributeParseable("value"); + var valueString = _reader.GetRequiredAttribute("value"); if (ced.ValueAsFlags) { var allValues = ced.Values; @@ -134,13 +135,13 @@ public abstract partial class TmxReaderBase _ = enumValues.Add(enumValue); } } - return new EnumProperty { Name = name, PropertyType = propertyType, Value = enumValues }; + return new EnumProperty { Name = name, PropertyType = propertyType, Value = enumValues, ValueString = valueString }; } else { var allValues = ced.Values; var enumValue = allValues[value]; - return new EnumProperty { Name = name, PropertyType = propertyType, Value = new HashSet { enumValue } }; + return new EnumProperty { Name = name, PropertyType = propertyType, Value = new HashSet { enumValue }, ValueString = valueString }; } }