Bug? [XUI2D] Different Versions of Tiles create diffrent structured JSONs

Status
Not open for further replies.

Gunther

Active Member
Licensed User
Longtime User
Hello,

since the new Version 1.2.0 of Tiles the jsons are a ittle different and throwing a crash when loaded in APP:

"tiledversion":"1.1.6": <--- working one

"properties":
{
"friction":0.5,
"restitution":"0"
},
"propertytypes":
{
"friction":"float",
"restitution":"string"
},



"tiledversion":"1.2.0": <--- not working

"properties":[
{
"name":"friction",
"type":"float",
"value":0.5
},
{
"name":"restitution",
"type":"string",
"value":"0"
}],



By manually modifying the non-working JSON to the structure of the working one, it works at once!

Any clue how I can tell Tiles that it shall create the JSON according to the necessary structure?



here the Log when crashes:

Logger connected to: HTC HTC One_M8 dual sim
--------- beginning of crash
--------- beginning of main
Copying updated assets files (2)
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
Skipping tile set: textures
Error occurred on line: 121 (X2TileMap)
java.lang.ClassCastException: java.util.ArrayList cannot be cast to anywheresoftware.b4a.objects.collections.Map$MyMap
at b4a.example.x2tilemap._parseobjectslayer(x2tilemap.java:2159)
at b4a.example.x2tilemap._initialize(x2tilemap.java:279)
at b4a.example.game._initialize(game.java:79)
at b4a.example.main._activity_create(main.java:383)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:738)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:360)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:260)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:144)
at b4a.example.main.afterFirstLayout(main.java:104)
at b4a.example.main.access$000(main.java:17)
at b4a.example.main$WaitForLayout.run(main.java:82)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:168)
at android.app.ActivityThread.main(ActivityThread.java:5845)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:797)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:687)

** Activity (main) Resume **


from Tile http://docs.mapeditor.org/en/stable/reference/json-map-format/

Changelog
Tiled 1.2
  • Added nextlayerid to the Map object.
  • Added id to the Layer object.
  • The tiles in a Tileset are now stored as an array instead of an object. Previously the tile IDs were stored as string keys of the “tiles” object, now they are stored as id property of each Tileobject.
  • Custom tile properties are now stored within each Tile instead of being included astileproperties in the Tileset object.
  • Custom properties are now stored in an array instead of an object where the property names were the keys. Each property is now an object that stores the name, type and value of the property. The separate propertytypes and tilepropertytypes attributes have been removed.
Tiled 1.1
 

DonManfred

Expert
Licensed User
Longtime User
Where is the Code which fails to load the json? I guess it just needs to get adapted to the new Structure.
But as you are hiding the code it is hard to help/answer here.
As i wrote in the other Thread from you: properties is a List of Maps now instead of a Map.

Edit to add: Ok, i now checked the XUI2D Example and i see that you can not post any code which loads the json. It is in the Lib itself.

Seems to be a Issue for @Erel :)
 
Last edited:

Gunther

Active Member
Licensed User
Longtime User
Yes, you are right. It has nothing to do with own Code The new structure shall be reflected in the x2 framework.
I have created a new json with the unchanged tmx but with tiles 1.1.6 and the app worked as planned.

There should be a check about which json structure is used (key 'propertytypes' existing or not) from the framework.

Thanks for careing and confirming, DonManfred.
 

DonManfred

Expert
Licensed User
Longtime User
There should be a check about which json structure is used (key 'propertytypes' existing or not) from the framework.
I´m sure there can be added such checks. Let´s wait for an answer...

@Erel : For Reference to the other Thread with the uploaded JSONs...
 
Status
Not open for further replies.
Top