diff options
author | metamuffin <metamuffin@disroot.org> | 2024-06-29 23:06:20 +0200 |
---|---|---|
committer | metamuffin <metamuffin@disroot.org> | 2024-06-29 23:06:20 +0200 |
commit | 12b06f3b8769467b957986e2b2601f6dfb7f9dc6 (patch) | |
tree | 9422a0cab2e8991de04c01813136d9c4e1ef25e1 /client/menu | |
parent | b93a28ee71f25061d473777565549d90b6325996 (diff) | |
parent | ebf98091026017e7c410e8c2aeaa5e7c7d326a6c (diff) | |
download | hurrycurry-12b06f3b8769467b957986e2b2601f6dfb7f9dc6.tar hurrycurry-12b06f3b8769467b957986e2b2601f6dfb7f9dc6.tar.bz2 hurrycurry-12b06f3b8769467b957986e2b2601f6dfb7f9dc6.tar.zst |
Merge branch 'master' of https://codeberg.org/metamuffin/undercooked
Diffstat (limited to 'client/menu')
-rw-r--r-- | client/menu/ingame_menu.gd | 3 | ||||
-rw-r--r-- | client/menu/ingame_menu.tscn | 1 | ||||
-rw-r--r-- | client/menu/menu_manager.gd | 17 | ||||
-rw-r--r-- | client/menu/menu_manager.tscn | 10 | ||||
-rw-r--r-- | client/menu/overlay.tscn | 9 | ||||
-rw-r--r-- | client/menu/settings_menu.gd | 1 | ||||
-rw-r--r-- | client/menu/settings_menu.tscn | 2 | ||||
-rw-r--r-- | client/menu/settings_row.gd | 5 |
8 files changed, 22 insertions, 26 deletions
diff --git a/client/menu/ingame_menu.gd b/client/menu/ingame_menu.gd index 73f4dbb3..6fa83a55 100644 --- a/client/menu/ingame_menu.gd +++ b/client/menu/ingame_menu.gd @@ -3,6 +3,9 @@ extends Control @onready var anim = $AnimationPlayer @onready var options = $Side/Margin/Options +func _ready(): + Global.connect_button_sounds(self) + func act(): show() anim.play("activate") diff --git a/client/menu/ingame_menu.tscn b/client/menu/ingame_menu.tscn index ee537720..1e9a2f46 100644 --- a/client/menu/ingame_menu.tscn +++ b/client/menu/ingame_menu.tscn @@ -72,6 +72,7 @@ anchors_preset = 9 anchor_bottom = 1.0 offset_left = -400.0 offset_right = -90.0 +offset_bottom = 648.0 grow_vertical = 2 [node name="Margin" type="MarginContainer" parent="Side"] diff --git a/client/menu/menu_manager.gd b/client/menu/menu_manager.gd index a695cbdc..bba074f6 100644 --- a/client/menu/menu_manager.gd +++ b/client/menu/menu_manager.gd @@ -24,17 +24,15 @@ class_name MenuManager } @onready var transition: SceneTransition = $SceneTransition -@onready var hover_sound = $Hover -@onready var click_sound = $Click - var menu_stack = ["main"] func _ready(): if not Global.settings["setup_complete"]["value"]: return transition.instant_to("res://menu/setup_menu.tscn") + get_viewport().gui_focus_changed.connect(Sound.play_hover_maybe) Global.focus_first_button(menus[menu_stack.back()]) for m in menus.values(): - connect_button_sounds(m) + Global.connect_button_sounds(m) if Global.fade_next: Global.fade_next = false @@ -42,7 +40,7 @@ func _ready(): func _input(_event): if Input.is_action_just_pressed("ui_cancel") && menu_stack.size() > 1: - play_click() + Sound.play_click() go_back() func goto(menu_name: String): @@ -68,12 +66,3 @@ func show_menu(menu_name: String): else: 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 c6959407..56cc6442 100644 --- a/client/menu/menu_manager.tscn +++ b/client/menu/menu_manager.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=9 format=3 uid="uid://cd52sr1cmo8oj"] +[gd_scene load_steps=7 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,8 +6,6 @@ [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 @@ -34,9 +32,3 @@ 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/overlay.tscn b/client/menu/overlay.tscn index d0f002db..66e2a9f3 100644 --- a/client/menu/overlay.tscn +++ b/client/menu/overlay.tscn @@ -1,7 +1,8 @@ -[gd_scene load_steps=7 format=3 uid="uid://bpikve6wlsjfl"] +[gd_scene load_steps=8 format=3 uid="uid://bpikve6wlsjfl"] [ext_resource type="Theme" uid="uid://b0qmvo504e457" path="res://menu/theme/theme.tres" id="1_4kujw"] [ext_resource type="Script" path="res://menu/overlay.gd" id="2_kbjds"] +[ext_resource type="FontFile" uid="uid://bo4vh5xkpvrh1" path="res://menu/theme/font-sansita-swashed.woff2" id="3_u54fv"] [sub_resource type="StyleBoxFlat" id="StyleBoxFlat_04ujj"] bg_color = Color(0, 0, 0, 0) @@ -70,6 +71,7 @@ layout_mode = 2 [node name="Label" type="Label" parent="Control/Paper/Margin/Lines/Line1"] layout_mode = 2 theme_override_colors/font_color = Color(0, 0, 0, 1) +theme_override_fonts/font = ExtResource("3_u54fv") theme_override_font_sizes/font_size = 25 text = "Completed" @@ -81,6 +83,7 @@ size_flags_horizontal = 3 custom_minimum_size = Vector2(100, 0) layout_mode = 2 theme_override_colors/font_color = Color(0, 0.278431, 0, 1) +theme_override_fonts/font = ExtResource("3_u54fv") theme_override_font_sizes/font_size = 35 text = "0" horizontal_alignment = 1 @@ -91,6 +94,7 @@ layout_mode = 2 [node name="Label" type="Label" parent="Control/Paper/Margin/Lines/Line2"] layout_mode = 2 theme_override_colors/font_color = Color(0, 0, 0, 1) +theme_override_fonts/font = ExtResource("3_u54fv") theme_override_font_sizes/font_size = 25 text = "Failed" @@ -102,6 +106,7 @@ size_flags_horizontal = 3 custom_minimum_size = Vector2(100, 0) layout_mode = 2 theme_override_colors/font_color = Color(0.505882, 0, 0, 1) +theme_override_fonts/font = ExtResource("3_u54fv") theme_override_font_sizes/font_size = 35 text = "0" horizontal_alignment = 1 @@ -112,6 +117,7 @@ layout_mode = 2 [node name="Label" type="Label" parent="Control/Paper/Margin/Lines/Line3"] layout_mode = 2 theme_override_colors/font_color = Color(0, 0, 0, 1) +theme_override_fonts/font = ExtResource("3_u54fv") theme_override_font_sizes/font_size = 35 text = "Points" @@ -123,6 +129,7 @@ size_flags_horizontal = 3 custom_minimum_size = Vector2(100, 0) layout_mode = 2 theme_override_colors/font_color = Color(0, 0, 0, 1) +theme_override_fonts/font = ExtResource("3_u54fv") theme_override_font_sizes/font_size = 45 text = "0" horizontal_alignment = 1 diff --git a/client/menu/settings_menu.gd b/client/menu/settings_menu.gd index 68f3f2fc..e593caa0 100644 --- a/client/menu/settings_menu.gd +++ b/client/menu/settings_menu.gd @@ -24,6 +24,7 @@ func _on_back_pressed(): for k in settings.keys(): Global.settings[k]["value"] = settings[k].get_value() Global.save_settings() + Global.update_fullscreen() menu_manager.go_back() func _ready(): diff --git a/client/menu/settings_menu.tscn b/client/menu/settings_menu.tscn index 9be24d86..ecaea17c 100644 --- a/client/menu/settings_menu.tscn +++ b/client/menu/settings_menu.tscn @@ -59,6 +59,6 @@ size_flags_vertical = 3 [node name="Back" type="Button" parent="OuterGap/Panel/InnerGap/VBoxContainer"] layout_mode = 2 size_flags_vertical = 8 -text = "Back to Main Menu" +text = "Save & Apply" [connection signal="pressed" from="OuterGap/Panel/InnerGap/VBoxContainer/Back" to="." method="_on_back_pressed"] diff --git a/client/menu/settings_row.gd b/client/menu/settings_row.gd index 879fb363..30b1fd67 100644 --- a/client/menu/settings_row.gd +++ b/client/menu/settings_row.gd @@ -21,7 +21,10 @@ func setup(key: String, dict: Dictionary, defaults: Dictionary): "line": value_node = LineEdit.new() value_node.text = value - value_node.placeholder_text = default + if default != "": + value_node.placeholder_text = default + else: + value_node.placeholder_text = description "dropdown": value_node = OptionButton.new() for i in setting["options"]: |