Categories
Posted: 08 Sep 2017, 12:33
Since version 337 you're able to define your own categories. Here you can see what that means:
As it's a building of type park it will be put into the park category automatically. We want to put it into an own camping category.
So let's define a new category for camping:
As icon I use this 26x26 pixel sized image:
I recommend to always use a size of 26x26 pixels for icons for consistency. In order to put our plugin into this category we have to specify the category manually:
Pay attention on that the category you're referring to has to be defined before your plugin. Otherwise it cannot be assigned. The result looks now like this:The result:
Now you may want to put your category to a more meaningful position: behind the existing park category. To do so, we can use the attribute ordinal which can be also used to order items within a category:
The number you provide for ordinal determines which position should be used, with 0 being the first place. The result:
Last but not least we may want to use another preview for our cool plank area. To do so, we can provide a preview frame like this in our plugin:
Result:
The whole code in a single file looks like this:
You can use the code:
to put a line that separates parts of a category
Have fun
Let's say we have the following plugin:
Code: Select all
[
{
"id":"$lobby_camp_dummy00",
"type":"park",
"title":"Plain area",
"text":"Just a plain area.",
"width":1,
"height":1,
"frames":[{"bmp":"dummy.png"}]
}
]
So let's define a new category for camping:
Code: Select all
{
"id":"$cat_lobby_camp00",
"type":"category",
"title":"Camping",
"frames":[{"bmp":"icon.png"}],
"ordinal":10
}
Code: Select all
{
"id":"$lobby_camp_dummy00",
"type":"park",
"category":"$cat_lobby_camp00", // This way we define the category to put this park into
"title":"Plain area",
"text":"Just a plain area.",
"width":1,
"height":1,
"frames":[{"bmp":"dummy.png"}]
}
Code: Select all
{
"id":"$cat_lobby_camp00",
"type":"category",
"title":"Camping",
"frames":[{"bmp":"icon.png"}],
"ordinal":10 // Specify own position (after park, in this case)
}
Code: Select all
{
"id":"$lobby_camp_dummy00",
"type":"park",
"category":"$cat_lobby_camp00",
"title":"Plain area",
"text":"Just a plain area.",
"width":1,
"height":1,
"frames":[{"bmp":"dummy.png"}],
"preview frames":[{"bmp":"icon.png"}] // A single frames to use for preview
}
Code: Select all
[
{
"id":"$cat_lobby_camp00",
"type":"category",
"title":"Camping",
"frames":[{"bmp":"icon.png"}],
"ordinal":10
},
{
"id":"$lobby_camp_dummy00",
"type":"park",
"category":"$cat_lobby_camp00",
"title":"Plain area",
"text":"Just a plain area.",
"width":1,
"height":1,
"frames":[{"bmp":"dummy.png"}],
"preview frames":[{"bmp":"icon.png"}]
}
]
Code: Select all
"separator": true
Have fun