From 26089afdbb406b934f7216bbe0932f54879e20dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mario=20Mart=C3=ADnez=20Palacio?= Date: Wed, 9 Oct 2024 12:37:17 +0200 Subject: [PATCH] Prevent dialogue from prompting closes after a dialogue is completed --- Scripts/UI/textbox.gd | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Scripts/UI/textbox.gd b/Scripts/UI/textbox.gd index 22aeda2..3886d45 100644 --- a/Scripts/UI/textbox.gd +++ b/Scripts/UI/textbox.gd @@ -57,15 +57,15 @@ func _process(delta): indicator.visible = i == _direction && !_displaying && !animation_player.is_playing() func _input(event): - if event.is_action_pressed("ui_accept"): + if event.is_action_pressed("ui_accept") and _dialogue.size() > 0: if _displaying: _display_text = _text _displaying = false get_viewport().set_input_as_handled() elif _display_text == _text: - dialogue_continued.emit() _dialogue_continue() get_viewport().set_input_as_handled() + dialogue_continued.emit() func _dialogue_start(_who: Util.CastCharacter, dialogue: Array[String], direction: TextboxDirection): _next = 0 @@ -89,6 +89,7 @@ func _end_dialogue(): _text = "" _display_text = "" _displaying = false # just in case + _dialogue = [] animation_player.play("hide_" + _directions[_direction]) func _on_animation_finished(anim_name: StringName):