TiledMap property multi-line bug fix (#641)

This commit is contained in:
JanFokke
2019-12-24 12:29:21 +10:00
committed by Dylan Wilson
parent e4538dedd1
commit dfa3bce162
2 changed files with 22 additions and 11 deletions
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<map version="1.0" tiledversion="1.1.6" orientation="orthogonal" renderorder="right-down" width="40" height="10" tilewidth="128" tileheight="128" infinite="0" backgroundcolor="#7d7d7d" nextobjectid="23">
<map version="1.2" tiledversion="1.2.4" orientation="orthogonal" renderorder="right-down" width="40" height="10" tilewidth="128" tileheight="128" infinite="0" backgroundcolor="#7d7d7d" nextlayerid="10" nextobjectid="23">
<properties>
<property name="awesome" value="42"/>
</properties>
@@ -31,16 +31,16 @@
</properties>
</tile>
</tileset>
<imagelayer name="Background 1">
<imagelayer id="1" name="Background 1">
<image source="hills.png" trans="000000" width="2048" height="1536"/>
</imagelayer>
<group name="Ground Group">
<layer name="Water" width="40" height="10">
<group id="2" name="Ground Group">
<layer id="3" name="Water" width="40" height="10">
<data encoding="base64" compression="gzip">
H4sIAAAAAAAACmNgGAWjYBSMgoEBgljwYAJCWPBgAgPtPgAzvv49QAYAAA==
</data>
</layer>
<layer name="Ground" width="40" height="10">
<layer id="4" name="Ground" width="40" height="10">
<properties>
<property name="customlayerprop" value="1"/>
<property name="customlayerprop2" value="2"/>
@@ -50,17 +50,17 @@
</data>
</layer>
</group>
<layer name="Platforms" width="40" height="10">
<layer id="5" name="Platforms" width="40" height="10">
<data encoding="base64" compression="gzip">
H4sIAAAAAAAACmNgGAWDDfACMR8Q82MRw4f5GcgDyGbz4xEj11xy9Y+CUTAKBjcAAB+IdqlABgAA
</data>
</layer>
<layer name="Details" width="40" height="10">
<layer id="6" name="Details" width="40" height="10">
<data encoding="base64" compression="gzip">
H4sIAAAAAAAACmNgGLlAGIuYBJQWRROXpNAuKSxmSkPNlaXQbHKBzADZSwiAwgkUD9IE1MkhsUUYEHGHDsSp4Sg6A3S/44orUagcKB3J4VCDDtDTGy8DwwJ+BoYDfEAMZB8AshOIdyntAdBdC3ghNAM/hE4YWBehAqCbFiDzeQeZ+2gJAHOitUlABgAA
</data>
</layer>
<objectgroup color="#befdf9" draworder="index" name="Objects Layer 1">
<objectgroup color="#befdf9" draworder="index" id="7" name="Objects Layer 1">
<properties>
<property name="objLayerProp" value="true"/>
</properties>
@@ -78,10 +78,16 @@
<object id="20" name="Crate2" gid="23" x="60" y="345" width="226" height="226"/>
<object id="21" name="Crate3" gid="23" x="170" y="246" width="171" height="171"/>
</objectgroup>
<objectgroup name="TransparentObjects" opacity="0.5">
<objectgroup id="8" name="TransparentObjects" opacity="0.5">
<object id="18" name="TP1" gid="21" x="133" y="432" width="280" height="280"/>
</objectgroup>
<layer name="Tile Layer 5" width="40" height="10">
<layer id="9" name="Tile Layer 5" width="40" height="10">
<properties>
<property name="InlineString" value="This is an inline string"/>
<property name="MultilineString">You can press the three dots in the property editor to open a bigger text edit window.
Pressing enter in it causes the string to contain a newline character, as well as the xml entry to be structured differently.
The Tiled Map Importer is unable to read this property. Deleting it fixes the import error.</property>
</properties>
<data encoding="base64" compression="gzip">
H4sIAAAAAAAACmNgGAWjYBSMglEwCkgHADV9EcVABgAA
</data>
@@ -8,7 +8,12 @@ namespace MonoGame.Extended.Tiled.Serialization
public string Name { get; set; }
[XmlAttribute(AttributeName = "value")]
public string Value { get; set; }
public string ValueAttribute { get; set; }
[XmlText]
public string ValueBody { get; set; }
public string Value => ValueAttribute ?? ValueBody;
public override string ToString()
{