diff options
| author | radiohotline <radoihotline@disroot.rg> | 2026-08-25 16:33:56 +0300 |
|---|---|---|
| committer | radiohotline <radoihotline@disroot.rg> | 2026-08-25 16:33:56 +0300 |
| commit | a89e744ed0e8c759caf041a580112365bbfe4303 (patch) | |
| tree | dd61e320904176995727e86a857d00c90d4933ba /addons/escoria-dialog-simple/chooser/simple.gd | |
| parent | 6d53d8cac78250dc888aa49d5f9d4175c6652feb (diff) | |
Diffstat (limited to 'addons/escoria-dialog-simple/chooser/simple.gd')
| -rw-r--r-- | addons/escoria-dialog-simple/chooser/simple.gd | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/addons/escoria-dialog-simple/chooser/simple.gd b/addons/escoria-dialog-simple/chooser/simple.gd index d7c0297..6fc5ad5 100644 --- a/addons/escoria-dialog-simple/chooser/simple.gd +++ b/addons/escoria-dialog-simple/chooser/simple.gd @@ -17,7 +17,7 @@ func _ready() -> void: # Process the timeout display -func _process(delta: float) -> void: +func _process(_delta: float) -> void: if $MarginContainer.visible and self.dialog and self.dialog.timeout > 0: $TimerProgress.value = ( self.dialog.timeout - $Timer.time_left @@ -26,28 +26,28 @@ func _process(delta: float) -> void: # Show the chooser func show_chooser(): - var _vbox = $MarginContainer/ScrollContainer/VBoxContainer - for option_node in _vbox.get_children(): - _vbox.remove_child(option_node) + var vbox = $MarginContainer/ScrollContainer/VBoxContainer + for option_node in vbox.get_children(): + vbox.remove_child(option_node) _remove_avatar() for option in self.dialog.options: if option.is_valid(): - var _option_node = Button.new() - _option_node.text = (option as ESCDialogOption).option - _option_node.flat = true - _option_node.add_theme_color_override("font_color", color_normal) - _option_node.add_theme_color_override("font_color_hover", color_hover) - _vbox.add_child(_option_node) + var option_node = Button.new() + option_node.text = (option as ESCDialogOption).option + option_node.flat = true + option_node.add_theme_color_override("font_color", color_normal) + option_node.add_theme_color_override("font_color_hover", color_hover) + vbox.add_child(option_node) - _option_node.pressed.connect(_on_answer_selected.bind(option)) + option_node.pressed.connect(_on_answer_selected.bind(option)) # If we've no options left, signify as much and start the timer with a # very short interval so the appropriate signal can be fired. Note that # we have to fire the signal AFTER this method returns as the caller # is almost certainly yielding after this method returns. - if _vbox.get_child_count() == 0: + if vbox.get_child_count() == 0: _no_more_options = true $Timer.start(0.05) return @@ -59,8 +59,10 @@ func show_chooser(): $MarginContainer.show() - if self.dialog.timeout > 0: + if self.dialog.timeout > 0 and self.dialog.get_timeout_option(): $Timer.start(self.dialog.timeout) + else: + $TimerProgress.value = 0 # Hide the chooser @@ -88,7 +90,7 @@ func _on_answer_selected(option: ESCDialogOption): # The timeout came and a option was selected func _on_Timer_timeout() -> void: - var option_chosen = null if _no_more_options else self.dialog.options[self.dialog.timeout_option - 1] + var option_chosen = null if _no_more_options else self.dialog.get_timeout_option() _no_more_options = false _option_chosen(option_chosen) |
