MenuButton
This view allows you to display a button that, upon user tapping, will display a pop-up list of options. Once an option is selected, an event with that option's id as the event name will be fired. This is usually paired with a mechanic that does something for the player (e.g: long rest).
JSON Format
{
"type": "menuButton",
"id": ...,
"type": ...,
"margin_left": ...,
"margin_right": ...,
"margin_top": ...,
"margin_bottom": ...,
"is_visible": ...,
"validation_message": ...,
"icon_size": ...,
"icon_name": ...,
"color": ...,
"options": ...,
"allowed_options": ...
}
Fields
| Field | Type | Required | Description |
|---|---|---|---|
id | String | ✓ | A unique identifier for the view. You can use it to reference view values in stat formulas by doing $view.view_id (where view_id is the id that was assigned to this view by you in the system definition) |
type | RPGViewType | ✓ | The type of this view. Note that these are all in camelCase. |
margin_left | double | Optional. How much margin to add to the left of this view. | |
margin_right | double | Optional. How much margin to add to the right of this view. | |
margin_top | double | Optional. How much margin to add to the top of this view. | |
margin_bottom | double | Optional. How much margin to add to the bottom of this view. | |
is_visible | StatFormulaComponent | Optional. A formula to specify if the view should be visible or not. Must return a bool. | |
validation_message | StatFormulaComponent | Optional. If this view is an input, you can define this formula to return a message when the input value is invalid. If the input is valid, you should return null. Otherwise, make the formula return the string that should be shown to the user. | |
icon_size | IconSizeTypes | ✓ | The size for the icon. |
icon_name | String | ✓ | The name for the icon that should be displayed in this button. See the Icon view for details on what icons are available. Only icons that support custom coloring are compatible with this view type. |
color | String | Optional. The color for the icon. Should compute be a string for an RPGColors or a hex code for a color. | |
options | String | ✓ | The id for an enumerated type containing the options for this button. Upon choosing an option, that option's id will be fired as the event name. |
allowed_options | StatFormulaComponent | Optional. Defaults to all options. A stat formula for a list of string id's, corresponding to the options from the given enumerated type that you want to be displayed for the user as eligible options. |