mirror of
https://github.com/jcreek/CosmicClash.git
synced 2026-09-10 16:04:04 +00:00
feat(audio): wire menu click feedback
This commit is contained in:
@@ -9,6 +9,21 @@ const MAX_INTENSITY := 1.0
|
||||
var enabled := true
|
||||
|
||||
|
||||
func bind_tree_buttons(root: Node) -> void:
|
||||
if root == null:
|
||||
return
|
||||
for node in root.find_children("*", "BaseButton", true, false):
|
||||
bind_button(node as BaseButton)
|
||||
|
||||
|
||||
func bind_button(button: BaseButton) -> void:
|
||||
if button == null:
|
||||
return
|
||||
var callback := Callable(self, "play_ui_click")
|
||||
if not button.pressed.is_connected(callback):
|
||||
button.pressed.connect(callback)
|
||||
|
||||
|
||||
func play_ui_click() -> void:
|
||||
_play_tone(880.0, 0.045, 0.10)
|
||||
|
||||
|
||||
@@ -37,6 +37,7 @@ const DIFFICULTIES := [
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
AudioManager.bind_tree_buttons(self)
|
||||
# An idle menu has no reason to render past the display's own refresh
|
||||
# rate; gameplay scenes are uncapped again by _leave_to_gameplay below.
|
||||
var refresh_rate := DisplayServer.screen_get_refresh_rate()
|
||||
|
||||
@@ -21,6 +21,7 @@ var _recovery_poll_seconds := 0.0
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
AudioManager.bind_tree_buttons(self)
|
||||
playlist_dropdown.add_item("Casual")
|
||||
playlist_dropdown.set_item_metadata(0, "casual")
|
||||
playlist_dropdown.add_item("Ranked")
|
||||
|
||||
@@ -48,6 +48,7 @@ var _populating := false
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
AudioManager.bind_tree_buttons(self)
|
||||
# An idle settings screen has no reason to render past the display's own
|
||||
# refresh rate; _on_back_pressed only returns to another capped menu, so
|
||||
# no uncap is needed there (contrast main_menu.gd's _leave_to_gameplay).
|
||||
|
||||
Reference in New Issue
Block a user