aboutsummaryrefslogtreecommitdiff
path: root/client/menu
diff options
context:
space:
mode:
Diffstat (limited to 'client/menu')
-rw-r--r--client/menu/credits.gd10
-rw-r--r--client/menu/settings.gd18
-rw-r--r--client/menu/settings/dropdown_setting.gd40
-rw-r--r--client/menu/settings/game_setting.gd51
-rw-r--r--client/menu/settings/range_setting.gd42
-rw-r--r--client/menu/settings/settings_menu.gd40
-rw-r--r--client/menu/settings/settings_row.gd36
-rw-r--r--client/menu/settings/settings_row.tscn (renamed from client/menu/settings_row.tscn)12
-rw-r--r--client/menu/settings/text_setting.gd38
-rw-r--r--client/menu/settings/toggle_setting.gd34
-rw-r--r--client/menu/settings_row.gd91
-rw-r--r--client/menu/setup.gd2
-rw-r--r--client/menu/sounds/failure.oggbin0 -> 14740 bytes
-rw-r--r--client/menu/sounds/failure.ogg.import19
-rw-r--r--client/menu/sounds/success.oggbin26466 -> 10840 bytes
15 files changed, 315 insertions, 118 deletions
diff --git a/client/menu/credits.gd b/client/menu/credits.gd
index 0ab94fd5..10ea910f 100644
--- a/client/menu/credits.gd
+++ b/client/menu/credits.gd
@@ -1,5 +1,5 @@
# Undercooked - a game about cooking
-# Copyright 2024 metamuffin
+# Copyright 2024 metamuffin, tpart
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
@@ -18,12 +18,16 @@ extends Menu
var contributors := ["sofviic", "metamuffin", "nokoe", "tpart"]
var cc_0 := ["kenney.nl", "Kay Lousberg"]
var cc_by_3 := {
+ "Game_over.wav": "deleted_user_877451",
"Glasses": "Jeremy Edelblut"
}
var cc_by_4 := {
- "Universal UI/Menu Soundpack": "Ellr",
+ "Footstep sounds": "Dryoma",
+ "Page_Turn_24.wav": "Koops",
"Pencil, Writing, Close, A.wav": "InspectorJ",
- "Page_Turn_24.wav": "Koops"
+ "Super Dialogue Audio Pack": "Dillon Becker",
+ "Universal UI/Menu Soundpack": "Ellr",
+ "Woosh Fleuret Escrime B.WAV": "toyoto"
}
@onready var label = $MarginContainer/Panel/MarginContainer/VBoxContainer/RichTextLabel
diff --git a/client/menu/settings.gd b/client/menu/settings.gd
index 66b53f64..efd462ca 100644
--- a/client/menu/settings.gd
+++ b/client/menu/settings.gd
@@ -17,11 +17,7 @@ extends Menu
@onready var options: VBoxContainer = $OuterGap/Panel/InnerGap/VBoxContainer/ScrollContainer/Options
-var settings: Dictionary
-
func _on_back_pressed():
- for k in settings.keys():
- Global.set_setting(k, settings[k].get_value())
Global.save_settings()
Global.update_language()
Global.update_fullscreen()
@@ -36,21 +32,9 @@ func update_rows(fix_focus = false):
c.queue_free()
for k in Global.settings.keys():
- var row: SettingsRow = preload("res://menu/settings_row.tscn").instantiate()
- row.setup(k, Global.settings, Global.default_settings)
- row.connect("apply_preset", apply_preset)
+ var row: SettingsRow = Global.settings[k].get_row()
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():
- Global.set_setting(k, settings[k].get_value())
-
- for k in preset.keys():
- Global.set_setting(k, preset[k])
-
- update_rows(true)
diff --git a/client/menu/settings/dropdown_setting.gd b/client/menu/settings/dropdown_setting.gd
new file mode 100644
index 00000000..47f7355b
--- /dev/null
+++ b/client/menu/settings/dropdown_setting.gd
@@ -0,0 +1,40 @@
+# Undercooked - a game about cooking
+# Copyright 2024 nokoe
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, version 3 of the License only.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <https://www.gnu.org/licenses/>.
+#
+class_name DropdownSetting
+extends GameSetting
+
+var options: Array
+
+func _init(new_description: String, new_preset: int, new_options: Array):
+ assert(new_preset < new_options.size())
+ super(new_description, new_preset)
+ options = new_options
+
+func _update_row():
+ super()
+ row.value_node = OptionButton.new()
+ for i in options:
+ row.value_node.add_item(i)
+ row.value_node.select(_value)
+
+func fetch_setting():
+ if row != null:
+ _value = row.value_node.selected
+
+func set_value(v):
+ super(v)
+ if row != null:
+ row.value_node.selected = _value
diff --git a/client/menu/settings/game_setting.gd b/client/menu/settings/game_setting.gd
new file mode 100644
index 00000000..67dca232
--- /dev/null
+++ b/client/menu/settings/game_setting.gd
@@ -0,0 +1,51 @@
+# Undercooked - a game about cooking
+# Copyright 2024 nokoe
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, version 3 of the License only.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <https://www.gnu.org/licenses/>.
+#
+class_name GameSetting
+extends Object
+
+var preset
+var _value
+var description: String
+
+var row: SettingsRow
+
+func _init(new_description: String, new_preset):
+ _value = new_preset
+ preset = new_preset
+ description = new_description
+
+func reset():
+ set_value(preset)
+
+func get_row() -> SettingsRow:
+ _update_row()
+ return row
+
+func _update_row():
+ if row != null:
+ row.queue_free()
+ row = preload("res://menu/settings/settings_row.tscn").instantiate()
+ row.description = description
+ row.reset.connect(reset)
+
+func fetch_setting():
+ pass
+
+func get_value():
+ return _value
+
+func set_value(v):
+ _value = v
diff --git a/client/menu/settings/range_setting.gd b/client/menu/settings/range_setting.gd
new file mode 100644
index 00000000..97229db9
--- /dev/null
+++ b/client/menu/settings/range_setting.gd
@@ -0,0 +1,42 @@
+# Undercooked - a game about cooking
+# Copyright 2024 nokoe
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, version 3 of the License only.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <https://www.gnu.org/licenses/>.
+#
+class_name RangeSetting
+extends GameSetting
+
+var min_value: float
+var max_value: float
+
+func _init(new_description: String, new_preset: float, new_min_value: float, new_max_value: float):
+ super(new_description, new_preset)
+ min_value = new_min_value
+ max_value = new_max_value
+
+func _update_row():
+ super()
+ row.value_node = HSlider.new()
+ row.value_node.min_value = min_value
+ row.value_node.max_value = max_value
+ row.value_node.tick_count = abs(max_value - min_value)
+ row.value_node.value = _value
+
+func fetch_setting():
+ if row != null:
+ _value = row.value_node.value
+
+func set_value(v):
+ super(v)
+ if row != null:
+ row.value_node.value = _value
diff --git a/client/menu/settings/settings_menu.gd b/client/menu/settings/settings_menu.gd
new file mode 100644
index 00000000..efd462ca
--- /dev/null
+++ b/client/menu/settings/settings_menu.gd
@@ -0,0 +1,40 @@
+# Undercooked - a game about cooking
+# Copyright 2024 metamuffin
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, version 3 of the License only.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <https://www.gnu.org/licenses/>.
+#
+extends Menu
+
+@onready var options: VBoxContainer = $OuterGap/Panel/InnerGap/VBoxContainer/ScrollContainer/Options
+
+func _on_back_pressed():
+ Global.save_settings()
+ Global.update_language()
+ Global.update_fullscreen()
+ exit()
+
+func _ready():
+ super()
+ update_rows()
+
+func update_rows(fix_focus = false):
+ for c in options.get_children():
+ c.queue_free()
+
+ for k in Global.settings.keys():
+ var row: SettingsRow = Global.settings[k].get_row()
+ options.add_child(row)
+
+ if fix_focus:
+ await get_tree().process_frame
+ Global.focus_first_button(self)
diff --git a/client/menu/settings/settings_row.gd b/client/menu/settings/settings_row.gd
new file mode 100644
index 00000000..8c71a8c5
--- /dev/null
+++ b/client/menu/settings/settings_row.gd
@@ -0,0 +1,36 @@
+# Undercooked - a game about cooking
+# Copyright 2024 nokoe
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, version 3 of the License only.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <https://www.gnu.org/licenses/>.
+#
+class_name SettingsRow
+extends PanelContainer
+
+signal reset()
+
+@onready var value_parent = $HBoxContainer/BoxContainer
+@onready var label = $HBoxContainer/Label
+
+var value_node: Node
+var description = tr("no value was given to the row")
+
+func _ready():
+ if value_node != null:
+ var c: Control = value_node
+ c.size_flags_vertical = Control.SIZE_EXPAND_FILL
+ c.size_flags_horizontal = Control.SIZE_EXPAND_FILL
+ label.text = description
+ value_parent.add_child(c)
+
+func _on_reset_pressed():
+ reset.emit()
diff --git a/client/menu/settings_row.tscn b/client/menu/settings/settings_row.tscn
index d08963d6..d9c1f215 100644
--- a/client/menu/settings_row.tscn
+++ b/client/menu/settings/settings_row.tscn
@@ -1,21 +1,21 @@
[gd_scene load_steps=6 format=3 uid="uid://o5e5vpem8w0k"]
-[ext_resource type="Theme" uid="uid://b0qmvo504e457" path="res://menu/theme/theme.tres" id="1_fk0r2"]
-[ext_resource type="Script" path="res://menu/settings_row.gd" id="1_lxjnc"]
-[ext_resource type="FontFile" uid="uid://5ixo6b3bd3km" path="res://menu/theme/font-josefin-sans.woff2" id="3_qh45r"]
+[ext_resource type="Theme" uid="uid://b0qmvo504e457" path="res://menu/theme/theme.tres" id="1_iij3k"]
+[ext_resource type="Script" path="res://menu/settings/settings_row.gd" id="2_l8i7p"]
+[ext_resource type="FontFile" uid="uid://5ixo6b3bd3km" path="res://menu/theme/font-josefin-sans.woff2" id="3_7k5da"]
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_pk3rs"]
content_margin_left = 16.0
[sub_resource type="FontVariation" id="FontVariation_o6i7s"]
-base_font = ExtResource("3_qh45r")
+base_font = ExtResource("3_7k5da")
[node name="SettingsRow" type="PanelContainer"]
offset_right = 105.0
offset_bottom = 23.0
size_flags_horizontal = 3
-theme = ExtResource("1_fk0r2")
-script = ExtResource("1_lxjnc")
+theme = ExtResource("1_iij3k")
+script = ExtResource("2_l8i7p")
[node name="HBoxContainer" type="HBoxContainer" parent="."]
layout_mode = 2
diff --git a/client/menu/settings/text_setting.gd b/client/menu/settings/text_setting.gd
new file mode 100644
index 00000000..c8aa49d4
--- /dev/null
+++ b/client/menu/settings/text_setting.gd
@@ -0,0 +1,38 @@
+# Undercooked - a game about cooking
+# Copyright 2024 nokoe
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, version 3 of the License only.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <https://www.gnu.org/licenses/>.
+#
+class_name TextSetting
+extends GameSetting
+
+var placeholder: String
+
+func _init(new_description: String, new_preset: String, new_placeholder: String = ""):
+ super(new_description, new_preset)
+ placeholder = new_placeholder
+
+func _update_row():
+ super()
+ row.value_node = LineEdit.new()
+ row.value_node.text = _value
+ row.value_node.placeholder_text = placeholder
+
+func fetch_setting():
+ if row != null:
+ _value = row.value_node.text
+
+func set_value(v):
+ super(v)
+ if row != null:
+ row.value_node.text = _value
diff --git a/client/menu/settings/toggle_setting.gd b/client/menu/settings/toggle_setting.gd
new file mode 100644
index 00000000..90e42264
--- /dev/null
+++ b/client/menu/settings/toggle_setting.gd
@@ -0,0 +1,34 @@
+# Undercooked - a game about cooking
+# Copyright 2024 nokoe
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, version 3 of the License only.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <https://www.gnu.org/licenses/>.
+#
+class_name ToggleSetting
+extends GameSetting
+
+func _init(new_description: String, new_preset: bool):
+ super(new_description, new_preset)
+
+func fetch_setting():
+ if row != null:
+ _value = row.value_node.button_pressed
+
+func _update_row():
+ super()
+ row.value_node = CheckButton.new()
+ row.value_node.button_pressed = _value
+
+func set_value(v):
+ super(v)
+ if row != null:
+ row.value_node.button_pressed = _value
diff --git a/client/menu/settings_row.gd b/client/menu/settings_row.gd
deleted file mode 100644
index d57bbee0..00000000
--- a/client/menu/settings_row.gd
+++ /dev/null
@@ -1,91 +0,0 @@
-class_name SettingsRow
-extends PanelContainer
-
-signal apply_preset
-
-@onready var value_parent = $HBoxContainer/BoxContainer
-@onready var label = $HBoxContainer/Label
-
-var setting
-var default
-var value_node
-var description = tr("no value was given to the row")
-
-func setup(key: String, dict: Dictionary, defaults: Dictionary):
- setting = dict[key]
- description = setting["description"]
- var value = setting["value"]
- default = defaults[key]["value"]
- match setting["type"]:
- "toggle":
- value_node = CheckButton.new()
- value_node.button_pressed = value
- "line":
- value_node = LineEdit.new()
- value_node.text = value
- if default != "":
- value_node.placeholder_text = default
- else:
- value_node.placeholder_text = description
- "dropdown":
- value_node = OptionButton.new()
- for i in setting["options"]:
- value_node.add_item(i)
- value_node.select(value)
- "dropdown_preset":
- value_node = OptionButton.new()
- for i in setting["options"]:
- value_node.add_item(i)
- value_node.select(value)
- value_node.connect("item_selected", apply.bind(Global.get(setting["apply"])))
- "range":
- value_node = HSlider.new()
- value_node.min_value = setting["min"]
- value_node.max_value = setting["max"]
- value_node.tick_count = abs(setting["max"] - setting["min"])
- value_node.value = value
- _:
- push_error("Could not set up SettingsRow: Unknown setting type \"%s\"" % setting["type"])
-
-func _ready():
- if value_node != null:
- var c: Control = value_node
- c.size_flags_vertical = Control.SIZE_EXPAND_FILL
- c.size_flags_horizontal = Control.SIZE_EXPAND_FILL
- label.text = description
- value_parent.add_child(c)
-
-func apply(idx: int, apply: Array):
- emit_signal("apply_preset", apply[idx])
-
-func get_value():
- if value_node != null:
- if value_node is CheckButton:
- return value_node.button_pressed
- elif value_node is LineEdit:
- return value_node.text
- elif value_node is OptionButton:
- return value_node.selected
- elif value_node is HSlider:
- return value_node.value
- else:
- push_error("get_value() failed for unknown node type: %s" % value_node)
- return null
- else:
- return null
-
-func _on_reset_pressed():
- match setting["type"]:
- "toggle":
- value_node.button_pressed = default
- "line":
- value_node.text = default
- "dropdown":
- value_node.select(default)
- "dropdown_preset":
- value_node.select(default)
- value_node.emit_signal("item_selected", value_node.selected)
- "range":
- value_node.value = default
- _:
- push_error("Could not reset setting: Unknown setting type \"%s\"" % setting["type"])
diff --git a/client/menu/setup.gd b/client/menu/setup.gd
index 565753d8..c5080920 100644
--- a/client/menu/setup.gd
+++ b/client/menu/setup.gd
@@ -43,7 +43,7 @@ func _on_sign_pressed():
Global.profile["username"] = username.text
Global.profile["character"] = character
- Global.settings["setup_complete"]["value"] = true
+ Global.set_setting("setup_complete", true)
Global.save_profile()
Global.save_settings()
$SceneTransition.transition_to("res://menu/menu_manager.tscn")
diff --git a/client/menu/sounds/failure.ogg b/client/menu/sounds/failure.ogg
new file mode 100644
index 00000000..cbe6db14
--- /dev/null
+++ b/client/menu/sounds/failure.ogg
Binary files differ
diff --git a/client/menu/sounds/failure.ogg.import b/client/menu/sounds/failure.ogg.import
new file mode 100644
index 00000000..78800693
--- /dev/null
+++ b/client/menu/sounds/failure.ogg.import
@@ -0,0 +1,19 @@
+[remap]
+
+importer="oggvorbisstr"
+type="AudioStreamOggVorbis"
+uid="uid://cv4isy6po6pqd"
+path="res://.godot/imported/failure.ogg-4b523df8a2a2485852fc3b46f038f1af.oggvorbisstr"
+
+[deps]
+
+source_file="res://menu/sounds/failure.ogg"
+dest_files=["res://.godot/imported/failure.ogg-4b523df8a2a2485852fc3b46f038f1af.oggvorbisstr"]
+
+[params]
+
+loop=false
+loop_offset=0
+bpm=0
+beat_count=0
+bar_beats=4
diff --git a/client/menu/sounds/success.ogg b/client/menu/sounds/success.ogg
index 590c7dab..37cd2bcd 100644
--- a/client/menu/sounds/success.ogg
+++ b/client/menu/sounds/success.ogg
Binary files differ