-
-
Notifications
You must be signed in to change notification settings - Fork 20
PopochiuDialog
Inherits Resource.
Branching dialogs that show options for players to select and trigger actions.
-
PopochiuDialogOption Resource. Default
preload('PopochiuDialogOption.gd')
. Used to cast variables as PopochiuDialogOption.
-
options Array. Default
[]
. Array of PopochiuDialogOption. This are the options that are shown on screen when the dialog is running. -
script_name String. Default
''
. The identifier of the dialog used in scripts.
🍑 For a detailed and exemplified description of all the virtual methods of this class, go to the Your scripts > Dialog page.
-
on_start() void
Use it to define custom behaviors before the dialog starts.
⚠️ You have to use a yield in this method in order to make the dialog to work properly. -
option_selected( PopochiuDialogOption
opt
) voidCalled when a dialog option is clicked. The
id
property inopt
can be used to check which was the option selected.
-
get_option( String
opt_id
) PopochiuDialogOptionReturns the PopochiuDialogOption which
id
is equal toopt_id
. -
start() void
Starts this dialog by calling
show_dialog
in IDialog passing as argument its ownscript_name
. -
stop() void
Finishes the dialog (which makes the menu with the options to disappear) by triggering the
dialog_finished
signal from IDialog. -
turn_off_options( Array
ids
) voidDisables each PopochiuDialogOption which
id
property matches each of the values in theids
array. -
turn_off_forever_options( Array
ids
) voidDisables forever each PopochiuDialogOption which
id
property matches each of the values in theids
array. This means that each of those options cannot be enabled by code again. -
turn_on_options( Array
ids
) voidEnables each PopochiuDialogOption which
id
property matches each of the values in theids
array.
-
set_options( Array
value
) voidCreates a PopochiuDialogOption each time an element is added to
options
using Godot´s Inspector.
-
_on_option_selected( PopochiuDialogOption
opt
) voidThis makes an option to be selected when clicked. It marks
opt
asused
and adds 1 to itsused_times
property, then makesopt
to be the value of theselected_option
property in IDialog, and finally sendsopt
tooption_selected()
. -
_show_options() void
Emits the signal that will make this dialog options to appear on screen and connects to the
option_selected
signal on each of those PopochiuDialogOption. -
_start() void
Starts the dialog by showing the list of options in a menu that is rendered on the bottom of the screen. Then it yields until the
dialog_finished
signal from IDialog is triggered.