aboutsummaryrefslogtreecommitdiff
path: root/client/menu/menu_manager.gd
diff options
context:
space:
mode:
authortpart <tpart120@proton.me>2024-06-29 21:28:33 +0200
committertpart <tpart120@proton.me>2024-06-29 21:28:38 +0200
commitfde874b3de5f969092a57ff2edcf57c0aff4e2e9 (patch)
tree794e425894e19f00645248be9a8d1be76a180512 /client/menu/menu_manager.gd
parentd67e6aa03f250715b8e2ec580c93acd443094f72 (diff)
downloadhurrycurry-fde874b3de5f969092a57ff2edcf57c0aff4e2e9.tar
hurrycurry-fde874b3de5f969092a57ff2edcf57c0aff4e2e9.tar.bz2
hurrycurry-fde874b3de5f969092a57ff2edcf57c0aff4e2e9.tar.zst
Add menu sound effects; Fix focus disappearing when changing preset
Diffstat (limited to 'client/menu/menu_manager.gd')
-rw-r--r--client/menu/menu_manager.gd16
1 files changed, 16 insertions, 0 deletions
diff --git a/client/menu/menu_manager.gd b/client/menu/menu_manager.gd
index 907f23e7..c15f181f 100644
--- a/client/menu/menu_manager.gd
+++ b/client/menu/menu_manager.gd
@@ -8,17 +8,25 @@ class_name MenuManager
}
@onready var transition = $SceneTransition
+@onready var hover_sound = $Hover
+@onready var click_sound = $Click
+
var menu_stack = ["main"]
+
func _ready():
Global.focus_first_button(menus[menu_stack.back()])
+ for m in menus.values():
+ connect_button_sounds(m)
+
if Global.fade_next:
Global.fade_next = false
transition.fade_in()
func _input(_event):
if Input.is_action_just_pressed("ui_cancel") && menu_stack.size() > 1:
+ play_click()
go_back()
func goto(menu_name: String):
@@ -45,3 +53,11 @@ func show_menu(menu_name: String):
menus[k].hide()
await transition.fade_in()
+func connect_button_sounds(node: Node):
+ if node is Button:
+ node.pressed.connect(play_click)
+ for c in node.get_children():
+ connect_button_sounds(c)
+
+func play_click():
+ click_sound.play()