ResourceSection
This view allows you to display a series of resources (only the
list_view). Each of these resources will display the display_view if the
user taps it (unless specified otherwise), and it also offers the
possibility to remove resources by swiping them to one side of the screen.
This is particularly useful to display arrays of resources in the character
sheet.
JSON Format
{
"type": "resourceSection",
"id": ...,
"type": ...,
"margin_left": ...,
"margin_right": ...,
"margin_top": ...,
"margin_bottom": ...,
"is_visible": ...,
"validation_message": ...,
"header_view": ...,
"resource_stat": ...,
"resource_set_stat": ...,
"resource_id": ...,
"read_only": ...,
"tap_displays_resource": ...,
"content_item_min_width": ...,
"alignment": ...,
"max_items_in_preview": ...
}
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. | |
header_view | RPGView | Optional. Defaults to nothing. A view to display at the top of the section, before the list of resources. | |
resource_stat | String | ✓ | The path to the stat that contains the resource instances to display. This path can use the syntax for paths defined in the GetStat stat formula. The stat has to be an array of resources. |
resource_set_stat | String | Optional. Defaults to null. The path to the stat that should be affected when removing items from this list of resources. If not specified, the resource_stat property will be used. This is useful when you are showing a calculated stat with a combined list of resources from different substats, and deletion/edits should only remove stats from a "user" resource array (base, not computed) stat. You should always avoid setting calculated stats with this type of view, as the calculated stat will be overridden and will never calculate its value again. Also, see the read_only property. | |
resource_id | String | ✓ | The resource id for the type of resources being displayed (ie: the one defined in your resource within the system file). |
read_only | bool | Optional. Defaults to false. Whether or not this view is read-only. If so, it will not allow deletions of resources, nor edits while viewing their display_views. Again, similar to the explanation in resource_set_stat, if you are displaying a computed stat array in this list and are NOT going to make this view read_only, you should define a resource_set_stat with the base stat that contains the resources the user might be deleting or editing. | |
tap_displays_resource | bool | Optional. Defaults to true. Whether tapping on a resource should display its display_view in a bottom sheet or not. | |
content_item_min_width | double | Optional. Defaults to nothing (no constraints enforced). The minimum width for an item in this list. If the number is a fraction (ie: between 0 (exclusive) and 1 (inclusive)) it will be taken as a fraction of the screen size (e.g: 1 is the full screen width, 0.5 is half the screen width, etc). This is useful for responsive layouts. If the number is above 1, it will be treated as an absolute number for the width. | |
alignment | CompositeRPGViewAlignment | Optional. Defaults to center. The alignment to use for the elements in the list. | |
max_items_in_preview | int | Optional. Defaults to null. If set, this property allows to define a maximum number of items that should show in a preview of the full list, which will be accessible through a button at the bottom of the preview. If null (unset), the full list will be displayed directly inline instead. |