aboutsummaryrefslogtreecommitdiff
path: root/client/menu/menu_manager.gd
diff options
context:
space:
mode:
authormetamuffin <metamuffin@disroot.org>2024-06-29 21:42:17 +0200
committermetamuffin <metamuffin@disroot.org>2024-06-29 21:42:17 +0200
commitc0f9942cd4562b169a4dddfdc083e505dc465830 (patch)
treeabfaaf02350a5fbb4f4e90787f1c45055e024812 /client/menu/menu_manager.gd
parent95e008d419053a53e5e32c36751fae40eeec3725 (diff)
parent4e04980ea7d4548a305586ebf3fe9607c0840bd5 (diff)
downloadhurrycurry-c0f9942cd4562b169a4dddfdc083e505dc465830.tar
hurrycurry-c0f9942cd4562b169a4dddfdc083e505dc465830.tar.bz2
hurrycurry-c0f9942cd4562b169a4dddfdc083e505dc465830.tar.zst
Merge branch 'master' of https://codeberg.org/metamuffin/undercooked
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()