Lots of little tweaks and fixes
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
class_name ConfirmDialog extends ClosableMenu
|
||||
|
||||
signal confirmed
|
||||
|
||||
@export var btnYes:Button
|
||||
@export var btnNo:Button
|
||||
|
||||
func _ready() -> void:
|
||||
close()
|
||||
btnYes.pressed.connect(_onYes)
|
||||
btnNo.pressed.connect(close)
|
||||
btnYes.focus_neighbor_top = btnNo.get_path()
|
||||
btnYes.focus_neighbor_bottom = btnNo.get_path()
|
||||
btnNo.focus_neighbor_top = btnYes.get_path()
|
||||
btnNo.focus_neighbor_bottom = btnYes.get_path()
|
||||
|
||||
func _onYes() -> void:
|
||||
close()
|
||||
confirmed.emit()
|
||||
|
||||
func open() -> void:
|
||||
super.open()
|
||||
btnNo.grab_focus()
|
||||
|
||||
func _unhandled_input(event:InputEvent) -> void:
|
||||
if !isOpen:
|
||||
return
|
||||
if event.is_action_pressed("ui_cancel"):
|
||||
close()
|
||||
get_viewport().set_input_as_handled()
|
||||
Reference in New Issue
Block a user