mirror of
https://github.com/vcmi/vcmi.git
synced 2026-06-19 22:57:37 +02:00
Always use json5 for syntax highlighting.
This commit is contained in:
@@ -33,7 +33,7 @@ extendedLobby/
|
||||
|
||||
File `mod.json` is generic and could look like this:
|
||||
|
||||
```json
|
||||
```json5
|
||||
{
|
||||
"name" : "Configurable UI tutorial mod",
|
||||
"description" : "See tutorial here https://github.com/vcmi/vcmi/wiki/Configurable-UI-widgets",
|
||||
@@ -67,7 +67,7 @@ Open `optionsTab.json` and scroll it until you see comment `timer`. Three elemen
|
||||
|
||||
Let's find first element, which is label
|
||||
|
||||
```json
|
||||
```json5
|
||||
{
|
||||
"items"
|
||||
[
|
||||
@@ -89,7 +89,7 @@ Let's find first element, which is label
|
||||
|
||||
And modify it a bit
|
||||
|
||||
```json
|
||||
```json5
|
||||
{
|
||||
"name": "labelTimer", //add name, only for convenience
|
||||
"type": "label",
|
||||
@@ -103,7 +103,7 @@ And modify it a bit
|
||||
|
||||
But we also need proper background image for this label. Add image widget BEFORE labelTimer widget:
|
||||
|
||||
```json
|
||||
```json5
|
||||
{
|
||||
"type": "picture",
|
||||
"image": "RmgTTBk",
|
||||
@@ -127,7 +127,7 @@ Copy image `DrDoCoBk.bmp` to `content/sprites/`. Button objects use animated ima
|
||||
For normal, pressed, blocked and highlighted. Our combo box inherits this behavior, so let's convert image to animation.
|
||||
In order to do it, we need to create file `DrDoCoBk.json` in same folder `content/sprites/` with following content:
|
||||
|
||||
```json
|
||||
```json5
|
||||
{
|
||||
"sequences" :
|
||||
[
|
||||
@@ -146,7 +146,7 @@ Thus we created file with animation, containing single frame which can be used f
|
||||
|
||||
Let's add one more element after `//timer` comment:
|
||||
|
||||
```json
|
||||
```json5
|
||||
...
|
||||
//timer
|
||||
{
|
||||
@@ -163,7 +163,7 @@ Let's add one more element after `//timer` comment:
|
||||
|
||||
We also want to have label on the top of this combo box showing which element is selected. You need to add `items` array, where additional elements can be specified, label in our case:
|
||||
|
||||
```json
|
||||
```json5
|
||||
...
|
||||
//timer
|
||||
{
|
||||
@@ -195,7 +195,7 @@ First of all, add images to `content/sprites/` folder: `List2Bk.bmp` for drop-do
|
||||
|
||||
Now specify items inside `dropDown` field
|
||||
|
||||
```json
|
||||
```json5
|
||||
"dropDown":
|
||||
{
|
||||
"items":
|
||||
@@ -279,7 +279,7 @@ Let's hide elements, related to classic timer when chess timer is selected and s
|
||||
|
||||
To do that, find `"variables"` part inside `optionsTab.json` and add there `"timers"` array, containing 2 elements:
|
||||
|
||||
```json
|
||||
```json5
|
||||
"variables":
|
||||
{
|
||||
"timers":
|
||||
@@ -310,7 +310,7 @@ Now we show and hide elements, but visually you still can some "artifacts":
|
||||
It's because options tab background image we use has those elements drawn. Let's hide them with overlay image `timchebk.bmp`.
|
||||
It should be drawn before all other timer elements:
|
||||
|
||||
```json
|
||||
```json5
|
||||
...
|
||||
// timer
|
||||
{
|
||||
@@ -338,7 +338,7 @@ We should add text input fields, to specify different timers. We will use backgr
|
||||
There are 4 different timers: base, turn, battle and creature. Read about them here: <https://github.com/vcmi/vcmi/issues/1364>
|
||||
We can add editors for them into items list, their format will be following:
|
||||
|
||||
```json
|
||||
```json5
|
||||
{
|
||||
"name": "chessFieldBase",
|
||||
"type": "textInput",
|
||||
@@ -440,7 +440,7 @@ One of predefined values:
|
||||
|
||||
Configurable object has following structure:
|
||||
|
||||
```json
|
||||
```json5
|
||||
{
|
||||
"items": [],
|
||||
"variables": {}, //optional
|
||||
@@ -837,7 +837,7 @@ std::shared_ptr<MyYesNoDialog::Item> MyYesNoDialog::buildMyItem(const JsonNode &
|
||||
|
||||
After that, if your JSON file has items with type "MyItem", the new Item element will be constructed.
|
||||
|
||||
```json
|
||||
```json5
|
||||
{
|
||||
"items":
|
||||
[
|
||||
|
||||
Reference in New Issue
Block a user