Audio manager implementation

This commit is contained in:
2026-03-11 10:07:47 -04:00
parent e11eddf1b4
commit ed4359686c
23 changed files with 61 additions and 7 deletions
+3
View File
@@ -82,13 +82,16 @@ func _input(event: InputEvent) -> void:
if event.is_action_pressed("ui_up"):
_cursor = wrapi(_cursor - 1, 0, maxi(1, _items.size()))
AudioManager.play("ui_select")
_refresh_labels()
get_viewport().set_input_as_handled()
elif event.is_action_pressed("ui_down"):
_cursor = wrapi(_cursor + 1, 0, maxi(1, _items.size()))
AudioManager.play("ui_select")
_refresh_labels()
get_viewport().set_input_as_handled()
elif event.is_action_pressed("ui_accept"):
AudioManager.play("ui_click")
_equip_selected()
get_viewport().set_input_as_handled()
elif event.is_action_pressed("ui_cancel"):
+4 -4
View File
@@ -113,24 +113,24 @@ func _build_ui() -> void:
var dep_btn := Button.new()
dep_btn.text = "DEPOSIT\n(ON HAND → BANK)"
dep_btn.pressed.connect(_on_deposit)
dep_btn.pressed.connect(func(): AudioManager.play("ui_click"); _on_deposit())
action_row.add_child(dep_btn)
var wth_btn := Button.new()
wth_btn.text = "WITHDRAW\n(BANK → ON HAND)"
wth_btn.pressed.connect(_on_withdraw)
wth_btn.pressed.connect(func(): AudioManager.play("ui_click"); _on_withdraw())
action_row.add_child(wth_btn)
# Close
var close_btn := Button.new()
close_btn.text = "CLOSE"
close_btn.pressed.connect(close)
close_btn.pressed.connect(func(): AudioManager.play("ui_click"); close())
vbox.add_child(close_btn)
func _add_btn(parent: Node, text: String, cb: Callable) -> void:
var b := Button.new()
b.text = text
b.pressed.connect(cb)
b.pressed.connect(func(): AudioManager.play("ui_click"); cb.call())
parent.add_child(b)
# ---------------------------------------------------------------------------
+1 -1
View File
@@ -43,7 +43,7 @@ func _add_button(parent: Node, text: String, callback: Callable) -> void:
var btn := Button.new()
btn.text = text
btn.custom_minimum_size = Vector2(240, 48)
btn.pressed.connect(callback)
btn.pressed.connect(func(): AudioManager.play("ui_click"); callback.call())
parent.add_child(btn)
# ---------------------------------------------------------------------------
+1 -1
View File
@@ -53,7 +53,7 @@ func _show_victory() -> void:
var btn := Button.new()
btn.text = "RETURN TO HUB"
btn.position = Vector2(-80, 70)
btn.pressed.connect(_fade_out_then_hub)
btn.pressed.connect(func(): AudioManager.play("ui_click"); _fade_out_then_hub())
_root.add_child(btn)
_fade_in()