How to access tile's custom parameters?

Post here your questions about the OpenSpace 2.x or notify bugs and suggestions.

Moderators: Lapo, Bax

gl0om
Posts: 54
Joined: 30 Mar 2010, 17:39

How to access tile's custom parameters?

Postby gl0om » 02 Nov 2010, 06:16

I'd like to access tile's customparams, which added using editor (such as price, category etc.).
I'm trying to make a drop validation for my customTile class, which can be plased on map without entering edit mode. So I need to get dropTarget's category custom param (if it's tile) somehow. I can use skin classname, but I dont like such approach because server'll send to much data about allowed classnames to drop on them
User avatar
Bax
Site Admin
Posts: 4612
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Postby Bax » 05 Nov 2010, 07:14

Actually a tile doesn't have custom parameters associated. Those can be set on a skin only, with the purpose to pass them to the optional setCustomParams (see the Editor documentation).
So, if I understand correctly, when you drop an item on the map, you want to be able to retrieve the custom params of the skin of the target tile.
The only way to do this is:
1) your skin must implement a setCustomParams() method, to which those params you set in the Editor are passed;
2) when the drop target tile is returned, get a reference to its skin;
3) your skin class must have a method which returns those custom params, so you can access them e validate the drop.
Paolo Bax
The SmartFoxServer Team

Return to “OpenSpace v2 discussions and help”

Who is online

Users browsing this forum: No registered users and 8 guests