online multiplayer chess game (note server currently down)
Diffstat (limited to 'ui/confirm/confirm.gd')
| -rw-r--r-- | ui/confirm/confirm.gd | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/ui/confirm/confirm.gd b/ui/confirm/confirm.gd new file mode 100644 index 0000000..1156159 --- /dev/null +++ b/ui/confirm/confirm.gd @@ -0,0 +1,23 @@ +extends WindowDialog +class_name Confirm + +signal confirmed(what) + +var timer := Timer.new() + + +func _ready() -> void: + add_child(timer) + timer.connect("timeout", self, "_pressed", [false]) + + +func confirm(who, what: String, timeout := 5, called := "_confirmed"): + connect("confirmed", who, called) + popup_centered() + window_title = what + timer.start(timeout) + + +func _pressed(what: bool): + emit_signal("confirmed", what) + queue_free() |