can quit menus using B button
This commit is contained in:
@@ -9,16 +9,19 @@ extends OverlaidMenu
|
||||
var popup_open : Node
|
||||
var previous_mapping_contexts : Array
|
||||
|
||||
func on_enter_tree() -> void:
|
||||
pass
|
||||
#previous_mapping_contexts = GUIDE.get_enabled_mapping_contexts()
|
||||
#GUIDE.enable_mapping_context(menu_context)
|
||||
var is_listening_to_inputs = true
|
||||
|
||||
func _enter_tree() -> void:
|
||||
super._enter_tree()
|
||||
previous_mapping_contexts = GUIDE.get_enabled_mapping_contexts()
|
||||
for previous_context in previous_mapping_contexts:
|
||||
GUIDE.disable_mapping_context(previous_context)
|
||||
GUIDE.enable_mapping_context(menu_context)
|
||||
|
||||
func on_exit_tree() -> void:
|
||||
pass
|
||||
#GUIDE.disable_mapping_context(menu_context)
|
||||
#for previous_context in previous_mapping_contexts:
|
||||
#GUIDE.enable_mapping_context(previous_context)
|
||||
func _exit_tree() -> void:
|
||||
GUIDE.disable_mapping_context(menu_context)
|
||||
for previous_context in previous_mapping_contexts:
|
||||
GUIDE.enable_mapping_context(previous_context)
|
||||
|
||||
func close_popup() -> void:
|
||||
if popup_open != null:
|
||||
@@ -43,10 +46,15 @@ func open_options_menu() -> void:
|
||||
var options_scene := options_packed_scene.instantiate()
|
||||
add_child(options_scene)
|
||||
_disable_focus.call_deferred()
|
||||
is_listening_to_inputs = false
|
||||
await options_scene.tree_exiting
|
||||
is_listening_to_inputs = true
|
||||
_enable_focus.call_deferred()
|
||||
|
||||
func _handle_cancel_input() -> void:
|
||||
if not is_listening_to_inputs:
|
||||
return
|
||||
|
||||
if popup_open != null:
|
||||
close_popup()
|
||||
else:
|
||||
@@ -68,6 +76,8 @@ func _ready() -> void:
|
||||
_hide_exit_for_web()
|
||||
_hide_options_if_unset()
|
||||
_hide_main_menu_if_unset()
|
||||
|
||||
back_action.triggered.connect(_handle_cancel_input)
|
||||
|
||||
func _on_restart_button_pressed() -> void:
|
||||
%ConfirmRestart.popup_centered()
|
||||
|
||||
Reference in New Issue
Block a user