aboutsummaryrefslogtreecommitdiff
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
parentd67e6aa03f250715b8e2ec580c93acd443094f72 (diff)
downloadhurrycurry-fde874b3de5f969092a57ff2edcf57c0aff4e2e9.tar
hurrycurry-fde874b3de5f969092a57ff2edcf57c0aff4e2e9.tar.bz2
hurrycurry-fde874b3de5f969092a57ff2edcf57c0aff4e2e9.tar.zst
Add menu sound effects; Fix focus disappearing when changing preset
-rw-r--r--client/menu/credits_menu.gd11
-rw-r--r--client/menu/menu_manager.gd16
-rw-r--r--client/menu/menu_manager.tscn10
-rw-r--r--client/menu/settings_menu.gd3
-rw-r--r--client/menu/sounds/click.oggbin0 -> 24573 bytes
-rw-r--r--client/menu/sounds/click.ogg.import19
-rw-r--r--client/menu/sounds/hover.oggbin0 -> 15692 bytes
-rw-r--r--client/menu/sounds/hover.ogg.import19
8 files changed, 76 insertions, 2 deletions
diff --git a/client/menu/credits_menu.gd b/client/menu/credits_menu.gd
index ece061ec..e8abedb5 100644
--- a/client/menu/credits_menu.gd
+++ b/client/menu/credits_menu.gd
@@ -20,6 +20,9 @@ var cc_0 := ["kenney.nl", "Kay Lousberg"]
var cc_by_3 := {
"Glasses": "Jeremy Edelblut"
}
+var cc_by_4 := {
+ "Universal UI/Menu Soundpack": "Ellr"
+}
@onready var menu_manager: MenuManager = get_parent()
@onready var label = $MarginContainer/Panel/MarginContainer/VBoxContainer/RichTextLabel
@@ -36,10 +39,16 @@ func prepare():
for k in cc_by_3.keys():
var v = cc_by_3[k]
- label.text += "[b]\"%s\" %s[/b]\n" % [k, v]
+ label.text += "[b]\"%s\" by %s[/b]\n" % [k, v]
label.text += tr("Licensed under Creative Commons: By Attribution 3.0 License")
label.text += "\nhttps://creativecommons.org/licenses/by/3.0/\n\n"
+ for k in cc_by_4.keys():
+ var v = cc_by_4[k]
+ label.text += "[b]\"%s\" by %s[/b]\n" % [k, v]
+ label.text += tr("Licensed under Creative Commons: By Attribution 4.0 License")
+ label.text += "\nhttps://creativecommons.org/licenses/by/4.0/\n\n"
+
label.text += "[b]"
label.text += tr("Additional CC0 assets by:")
label.text += "[/b]\n"
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()
diff --git a/client/menu/menu_manager.tscn b/client/menu/menu_manager.tscn
index 56cc6442..c6959407 100644
--- a/client/menu/menu_manager.tscn
+++ b/client/menu/menu_manager.tscn
@@ -1,4 +1,4 @@
-[gd_scene load_steps=7 format=3 uid="uid://cd52sr1cmo8oj"]
+[gd_scene load_steps=9 format=3 uid="uid://cd52sr1cmo8oj"]
[ext_resource type="Script" path="res://menu/menu_manager.gd" id="1_c0rjm"]
[ext_resource type="PackedScene" uid="uid://l4vm07dtda4j" path="res://menu/menu_background.tscn" id="2_nf7b6"]
@@ -6,6 +6,8 @@
[ext_resource type="PackedScene" uid="uid://7mqbxa054bjv" path="res://menu/credits_menu.tscn" id="4_xhcd8"]
[ext_resource type="PackedScene" uid="uid://8ic77jmadadj" path="res://menu/settings_menu.tscn" id="5_lifj8"]
[ext_resource type="PackedScene" uid="uid://bg2d78ycorcqk" path="res://menu/scene_transition.tscn" id="6_p4u45"]
+[ext_resource type="AudioStream" uid="uid://dtr1khfyqr56o" path="res://menu/sounds/hover.ogg" id="7_82cmi"]
+[ext_resource type="AudioStream" uid="uid://cpyn511c5mtni" path="res://menu/sounds/click.ogg" id="8_qwknj"]
[node name="MenuManager" type="Control"]
layout_mode = 3
@@ -32,3 +34,9 @@ layout_mode = 1
[node name="SceneTransition" parent="." instance=ExtResource("6_p4u45")]
visible = false
layout_mode = 1
+
+[node name="Hover" type="AudioStreamPlayer" parent="."]
+stream = ExtResource("7_82cmi")
+
+[node name="Click" type="AudioStreamPlayer" parent="."]
+stream = ExtResource("8_qwknj")
diff --git a/client/menu/settings_menu.gd b/client/menu/settings_menu.gd
index 4c14a459..b433951f 100644
--- a/client/menu/settings_menu.gd
+++ b/client/menu/settings_menu.gd
@@ -43,6 +43,9 @@ func update_rows():
row.connect("apply_preset", apply_preset)
options.add_child(row)
settings[k] = row
+ await get_tree().process_frame
+ Global.focus_first_button(self)
+
func apply_preset(preset: Dictionary):
for k in settings.keys():
diff --git a/client/menu/sounds/click.ogg b/client/menu/sounds/click.ogg
new file mode 100644
index 00000000..db4aaf4e
--- /dev/null
+++ b/client/menu/sounds/click.ogg
Binary files differ
diff --git a/client/menu/sounds/click.ogg.import b/client/menu/sounds/click.ogg.import
new file mode 100644
index 00000000..965b171a
--- /dev/null
+++ b/client/menu/sounds/click.ogg.import
@@ -0,0 +1,19 @@
+[remap]
+
+importer="oggvorbisstr"
+type="AudioStreamOggVorbis"
+uid="uid://cpyn511c5mtni"
+path="res://.godot/imported/click.ogg-e2bf88f5afe364b816ac9ff7e76a0967.oggvorbisstr"
+
+[deps]
+
+source_file="res://menu/sounds/click.ogg"
+dest_files=["res://.godot/imported/click.ogg-e2bf88f5afe364b816ac9ff7e76a0967.oggvorbisstr"]
+
+[params]
+
+loop=false
+loop_offset=0
+bpm=0
+beat_count=0
+bar_beats=4
diff --git a/client/menu/sounds/hover.ogg b/client/menu/sounds/hover.ogg
new file mode 100644
index 00000000..17d414ca
--- /dev/null
+++ b/client/menu/sounds/hover.ogg
Binary files differ
diff --git a/client/menu/sounds/hover.ogg.import b/client/menu/sounds/hover.ogg.import
new file mode 100644
index 00000000..b83eab9d
--- /dev/null
+++ b/client/menu/sounds/hover.ogg.import
@@ -0,0 +1,19 @@
+[remap]
+
+importer="oggvorbisstr"
+type="AudioStreamOggVorbis"
+uid="uid://dtr1khfyqr56o"
+path="res://.godot/imported/hover.ogg-45eb1351c35b416453fb2a6674b9d0f1.oggvorbisstr"
+
+[deps]
+
+source_file="res://menu/sounds/hover.ogg"
+dest_files=["res://.godot/imported/hover.ogg-45eb1351c35b416453fb2a6674b9d0f1.oggvorbisstr"]
+
+[params]
+
+loop=false
+loop_offset=0
+bpm=0
+beat_count=0
+bar_beats=4