summaryrefslogtreecommitdiff
path: root/addons/escoria-dialog-simple
diff options
context:
space:
mode:
authorradiohotline <radoihotline@disroot.rg>2026-08-25 16:33:56 +0300
committerradiohotline <radoihotline@disroot.rg>2026-08-25 16:33:56 +0300
commita89e744ed0e8c759caf041a580112365bbfe4303 (patch)
treedd61e320904176995727e86a857d00c90d4933ba /addons/escoria-dialog-simple
parent6d53d8cac78250dc888aa49d5f9d4175c6652feb (diff)
escoria updateHEADmain
Diffstat (limited to 'addons/escoria-dialog-simple')
-rw-r--r--addons/escoria-dialog-simple/chooser/simple.gd30
-rw-r--r--addons/escoria-dialog-simple/esc_dialog_simple_state_machine.gd4
2 files changed, 18 insertions, 16 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)
diff --git a/addons/escoria-dialog-simple/esc_dialog_simple_state_machine.gd b/addons/escoria-dialog-simple/esc_dialog_simple_state_machine.gd
index 4c48f60..bf26c26 100644
--- a/addons/escoria-dialog-simple/esc_dialog_simple_state_machine.gd
+++ b/addons/escoria-dialog-simple/esc_dialog_simple_state_machine.gd
@@ -10,8 +10,8 @@ func _init():
# dialogs state machine. Since Escoria can't guess which state is the default one
# it has to be assigned here. If it happens to be null on initialize() call,
# an error is triggered.
- START_STATE = states_map[current_state_name]
- initialize(START_STATE)
+ start_state = states_map[current_state_name]
+ initialize(start_state)
# Creates the states for this state machine.