Closed EFLFE closed 8 years ago
Use [ ]
to access the properties in the Dictionary. If m
is your map:
var v = m.Properties["term:00"];
Sorry, I didn't realise that your tmx format was different. This is how they used to look:
<properties>
<property name="term:00" value="vallavllalvalvla"/>
</properties>
Has this changed in newer versions of Tiled? I will check it out now.
Tiled 0.17 seems to be producing the format shown in my last comment. Did you edit this manually? If not, could you tell me how you created the property in Tiled?
It looks like Tiled does understand the format that you wrote, even though it doesn't produce it in that format, so yes, this is definitely a bug. Thanks very much for finding this, I will try to put in a patch today.
I've put in a patch that should resolve this issue.
I'm using the last version of Tield (0.17). What i have described above, occurs when the value is have multiple lines.
<property name="text" value="some text"/>
then
i get
<property name="text">some text
new line</property>
Interesting, wonder if libtiled is reacting to the \n
... anyway, very good to know, thanks!
Interesting, wonder if libtiled is reacting to the \n...
libtiled is checking for newlines and will use the other format in that case, to make the property value more readable. It did that since years, but only since Tiled 0.17 is it possible to create multi-line property values from the UI.
I would prefer to always use the same format, but I kept the old format for non-multiline values to keep compatibility. Eventually I'd like to drop the value
attribute.
Thanks very much for the explanation, Bjørn. The only issue I can think is if the default behaviour changes at some point, but otherwise things are hopefully working now.
This is still an issue as of 0.15. PropertyDict.cs checks the "value" property and NREs if that doesn't exist, which it doesn't for multiline strings (it should use the actual property element body instead, in that case).
@xSke Yes, if you take an old release you're of course going to run into old issues. The fastest way to get the fix is probably to take the source from master
, but of course we could ask @marshallward for pushing a new release.
I hadn't noticed the build on NuGet was so old :) Yeah, pushing a new build would probably be a good idea.
Sorry guys. As you can probably guess, I am not following the Tiled scene as closely as I used to.
I'll try to update NuGet soon. I'm also happy to start stepping back from things if others want to continue using/working on this.
Hi. I get a bug where the map has properties.
Sample:
In Tiled:
In *.tmx file:
In visual studio:
Result:
'System.NullReferenceException' in TiledSharp.dll in TiledSharp.PropertyDict..ctor(XContainer xmlProp) in \TiledSharp\src\TiledCore.cs:line 109
Problem solved following the replacement lines of next code:
var pval = p.Attribute("value").Value;
tovar pval = p.Value;
But, if property have type Attribute, so then pval = "".
I want to know - only i have a mistake? The error occurs when string property have line wrapping.
Tiled v 0.17.0 and TiledSharp v 0.15