Skip to main content

Avatar

This view allows you to display an avatar (frame with picture / some initials). It is often used in pair with the AvatarSection view, and to display a character's image. This view is the only way the player can choose a photo for a resource or character stat.

JSON Format

{
"type": "avatar",
"id": ...,
"type": ...,
"margin_left": ...,
"margin_right": ...,
"margin_top": ...,
"margin_bottom": ...,
"is_visible": ...,
"validation_message": ...,
"photo_stat": ...,
"name_stat": ...,
"interactable": ...,
"preview_enabled": ...,
"size": ...
}

Fields

FieldTypeRequiredDescription
idStringA 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)
typeRPGViewTypeThe type of this view. Note that these are all in camelCase.
margin_leftdoubleOptional. How much margin to add to the left of this view.
margin_rightdoubleOptional. How much margin to add to the right of this view.
margin_topdoubleOptional. How much margin to add to the top of this view.
margin_bottomdoubleOptional. How much margin to add to the bottom of this view.
is_visibleStatFormulaComponentOptional. A formula to specify if the view should be visible or not. Must return a bool.
validation_messageStatFormulaComponentOptional. 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.
photo_statStringOptional. A path to a stat in this resource/character that is of the Photo type and that should be displayed (if set).
name_statStringThe path to a name stat in this resource/character. Will be used to determine initials that will display in the avatar view whenever the photo stat is omitted or isn't set (ie: is null).
interactableboolOptional. Defaults to false. Whether this view should be interactable (ie: if tapping or long-pressing it should display a bottom sheet for the user to be able to edit the photo or not). Requires the photo_stat property to be set to work.
preview_enabledboolOptional. Defaults to false. Whether this view should display a full-screen version of the picture when tapping it. Requires the photo_stat property to be set to work.
sizeAvatarRPGViewSizeThe size of this view.