UserWise in-game events & messages both make use of a feature called JSON Templating. JSON Templating is a way to define custom JSON-based templates (or schemas) that can be reused when creating in-game events & messages.
Basic Field Data Types
Strings
"event_name": {
"type": "string",
"title": "Event Name",
"default": "Weekly Dragon Challenge - Green Dragons"
}
Integers
"reward_coins": {
"type": "integer",
"default": 75000,
"title": "Reward Coins"
}
Floats
"reward_multiplier": {
"type": "number",
"default": 1.0,
"title": "Reward Multiplier"
}
Boolean
"super_awesome_toggle": {
"type": "boolean",
"default": false,
"title": "Should we activate the super awesome thing?"
}
Files / Images (Media Library)
"dragon_image": {
"type": "string",
"widget": "file"
}
DateTime
"datetime": {
"type": "string",
"format": "date-time"
}
Date
"date": {
"type": "string",
"format": "date"
}
Advanced Field Data Types
Reusable Lists
"reward_items": {
"type": "string",
"list": "weaponList",
"widget": "select"
}
Array and Object Example
"dragon_list": {
"type": "array",
"items": {
"type": "object",
"title": "Dragons",
"properties": {
"dragon_name": {
"type": "string",
"required": true
},
"minimum_dragon_level": {
"type": "integer",
"required": true
}
}
}
}
Referencing Items
"item": {
"type": "string",
"title": "App Item",
"widget": "app_item"
},
Referencing Currencies
"currency": {
"type": "string",
"title": "Currency",
"widget": "app_currency"
},
Referencing Localizations
"translated_text": {
"type": "string",
"widget": "app_localization"
},
Referencing Products
"my_product": { "type": "object", "widget": "app_product", "properties": { "id": { "type": "string" }, "android_id": { "type": "string" }, "ios_id": { "type": "string" } } }
Field Validations
You can perform validations within the JSON so that when the event or message is being created by staff without SDK knowledge you can prevent data errors.
String Validations
"support_email": {
"title": "Email",
"type": "string",
"pattern": "^\\S+@\\S+$",
"maxLength": 20,
"minLength": 19,
"validationMessage": "Dont do that"
},
Integer Validations
"reward_coins": {
"type": "integer",
"default": 75000,
"title": "Reward Coins",
"minimum": 183,
"maximum": 283,
"multipleOf": 10
}
Float Validations
"reward_multiplier": {
"type": "number",
"default": 1.2,
"title": "Reward Multiplier",
"minimum": 1,
"maximum": 2.5
}
Comments
0 comments
Please sign in to leave a comment.