From be6a6b528ee5bb45c66ca5fff1ce7c67adde0cd9 Mon Sep 17 00:00:00 2001 From: Nolan Darilek Date: Thu, 2 Jan 2020 11:43:56 -0600 Subject: [PATCH] Add support for reading `AcceptDialog` messages automatically. --- Accessible.gd | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Accessible.gd b/Accessible.gd index e9ae883..1c6a6a8 100644 --- a/Accessible.gd +++ b/Accessible.gd @@ -45,6 +45,10 @@ func accept_dialog_focused(): yield(node.get_tree().create_timer(5), "timeout") node.get_ok().emit_signal("pressed") +func _acceptdialog_about_to_show(): + if node.dialog_text != "": + TTS.speak(node.dialog_text) + func checkbox_focused(): var tokens = PoolStringArray([]) if node.pressed: @@ -607,7 +611,9 @@ func _init(node): node.connect("focus_exited", self, "unfocused") node.connect("mouse_exited", self, "unfocused") node.connect("gui_input", self, "gui_input") - if node is CheckBox: + if node is AcceptDialog: + node.connect("about_to_show", self, "_acceptdialog_about_to_show") + elif node is CheckBox: node.connect("toggled", self, "checkbox_toggled") elif node is ItemList: node.connect("item_selected", self, "item_list_item_selected")