Added menu sound
This commit is contained in:
+18
-2
@@ -11,6 +11,17 @@ func _ready() -> void:
|
||||
_setup_neighbors()
|
||||
|
||||
|
||||
func _on_gui_focus_changed(_node: Control) -> void:
|
||||
SoundManager.play_ui_stream(SoundManager.ui_stream_select)
|
||||
|
||||
|
||||
func _input(event: InputEvent) -> void:
|
||||
if not visible: return
|
||||
|
||||
if event.is_action_pressed("pause"):
|
||||
_on_continue_button_pressed.call_deferred()
|
||||
|
||||
|
||||
func _init_focus() -> void:
|
||||
continue_button.grab_focus()
|
||||
|
||||
@@ -21,16 +32,21 @@ func _setup_neighbors() -> void:
|
||||
|
||||
|
||||
func _on_continue_button_pressed() -> void:
|
||||
SoundManager.play_ui_stream(SoundManager.ui_stream_decline)
|
||||
get_tree().paused = false
|
||||
hide()
|
||||
|
||||
|
||||
func _on_main_menu_button_pressed() -> void:
|
||||
SoundManager.play_ui_stream(SoundManager.ui_stream_accept)
|
||||
get_tree().paused = false
|
||||
get_tree().change_scene_to_file("res://game/menu/main_menu.tscn")
|
||||
|
||||
|
||||
func _on_visibility_changed() -> void:
|
||||
if not is_node_ready(): return
|
||||
if visible:
|
||||
if continue_button != null:
|
||||
continue_button.grab_focus()
|
||||
continue_button.grab_focus()
|
||||
get_viewport().gui_focus_changed.connect(_on_gui_focus_changed)
|
||||
else:
|
||||
get_viewport().gui_focus_changed.disconnect(_on_gui_focus_changed)
|
||||
|
||||
Reference in New Issue
Block a user