Skip to content

PopochiuDialog

Carenalga edited this page Feb 11, 2023 · 9 revisions

icon_dialog-x4

Description

Inherits Resource.

Branching dialogs that show options for players to select and trigger actions.

Properties

Constants

Export

  • 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.

Methods

Virtual

🍑 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 ) void

    Called when a dialog option is clicked. The id property in opt can be used to check which was the option selected.

Public

  • get_option( String opt_id ) PopochiuDialogOption

    Returns the PopochiuDialogOption which id is equal to opt_id.

  • start() void

    Starts this dialog by calling show_dialog in IDialog passing as argument its own script_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 ) void

    Disables each PopochiuDialogOption which id property matches each of the values in the ids array.

  • turn_off_forever_options( Array ids ) void

    Disables forever each PopochiuDialogOption which id property matches each of the values in the ids array. This means that each of those options cannot be enabled by code again.

  • turn_on_options( Array ids ) void

    Enables each PopochiuDialogOption which id property matches each of the values in the ids array.

Set and get

  • set_options( Array value ) void

    Creates a PopochiuDialogOption each time an element is added to options using Godot´s Inspector.

Private

  • _on_option_selected( PopochiuDialogOption opt ) void

    This makes an option to be selected when clicked. It marks opt as used and adds 1 to its used_times property, then makes opt to be the value of the selected_option property in IDialog, and finally sends opt to option_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.

Clone this wiki locally