diff options
author | metamuffin <metamuffin@disroot.org> | 2024-06-29 21:42:17 +0200 |
---|---|---|
committer | metamuffin <metamuffin@disroot.org> | 2024-06-29 21:42:17 +0200 |
commit | c0f9942cd4562b169a4dddfdc083e505dc465830 (patch) | |
tree | abfaaf02350a5fbb4f4e90787f1c45055e024812 /client/menu | |
parent | 95e008d419053a53e5e32c36751fae40eeec3725 (diff) | |
parent | 4e04980ea7d4548a305586ebf3fe9607c0840bd5 (diff) | |
download | hurrycurry-c0f9942cd4562b169a4dddfdc083e505dc465830.tar hurrycurry-c0f9942cd4562b169a4dddfdc083e505dc465830.tar.bz2 hurrycurry-c0f9942cd4562b169a4dddfdc083e505dc465830.tar.zst |
Merge branch 'master' of https://codeberg.org/metamuffin/undercooked
Diffstat (limited to 'client/menu')
-rw-r--r-- | client/menu/credits_menu.gd | 11 | ||||
-rw-r--r-- | client/menu/menu_manager.gd | 16 | ||||
-rw-r--r-- | client/menu/menu_manager.tscn | 10 | ||||
-rw-r--r-- | client/menu/settings_menu.gd | 8 | ||||
-rw-r--r-- | client/menu/sounds/click.ogg | bin | 0 -> 24573 bytes | |||
-rw-r--r-- | client/menu/sounds/click.ogg.import | 19 | ||||
-rw-r--r-- | client/menu/sounds/hover.ogg | bin | 0 -> 15692 bytes | |||
-rw-r--r-- | client/menu/sounds/hover.ogg.import | 19 |
8 files changed, 79 insertions, 4 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..68f3f2fc 100644 --- a/client/menu/settings_menu.gd +++ b/client/menu/settings_menu.gd @@ -32,7 +32,7 @@ func _ready(): func show_graphis(): menu_manager.goto("settings_graphics") -func update_rows(): +func update_rows(fix_focus = false): for c in options.get_children(): c.queue_free() @@ -43,6 +43,10 @@ func update_rows(): row.connect("apply_preset", apply_preset) options.add_child(row) settings[k] = row + + if fix_focus: + await get_tree().process_frame + Global.focus_first_button(self) func apply_preset(preset: Dictionary): for k in settings.keys(): @@ -51,4 +55,4 @@ func apply_preset(preset: Dictionary): for k in preset.keys(): Global.settings[k]["value"] = preset[k] - update_rows() + update_rows(true) diff --git a/client/menu/sounds/click.ogg b/client/menu/sounds/click.ogg Binary files differnew file mode 100644 index 00000000..db4aaf4e --- /dev/null +++ b/client/menu/sounds/click.ogg 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 Binary files differnew file mode 100644 index 00000000..17d414ca --- /dev/null +++ b/client/menu/sounds/hover.ogg 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 |