aboutsummaryrefslogtreecommitdiff
path: root/client/menu
diff options
context:
space:
mode:
Diffstat (limited to 'client/menu')
-rw-r--r--client/menu/settings.gd44
-rw-r--r--client/menu/settings.tscn13
-rw-r--r--client/menu/settings/settings_category.gd26
3 files changed, 57 insertions, 26 deletions
diff --git a/client/menu/settings.gd b/client/menu/settings.gd
index 27e08db7..93155a93 100644
--- a/client/menu/settings.gd
+++ b/client/menu/settings.gd
@@ -16,7 +16,7 @@
#
extends Menu
-@onready var options: VBoxContainer = $OuterGap/Panel/InnerGap/VBoxContainer/ScrollContainer/Options
+@onready var settings_tabs: TabContainer = $OuterGap/Panel/InnerGap/VBoxContainer/TabContainer
func _ready():
super()
@@ -31,25 +31,35 @@ func exit():
super()
func update_rows(fix_focus = false):
- for c in options.get_children():
+ for c in settings_tabs.get_children():
c.queue_free()
- for i in Global.presets:
- var label := Label.new()
- label.text = i.label
- var hbox := HBoxContainer.new()
- var spacer := Control.new()
- spacer.size_flags_horizontal = Control.SIZE_EXPAND
- hbox.add_child(label)
- hbox.add_child(spacer)
- options.add_child(hbox)
- for b in i.buttons():
- hbox.add_child(b)
-
- for k in Global.settings.keys():
- var row: SettingsRow = Global.settings[k].get_row()
- options.add_child(row)
+# TODO: Re-implement presets in new system
+# for i in Global.presets:
+# var label := Label.new()
+# label.text = i.label
+# var hbox := HBoxContainer.new()
+# var spacer := Control.new()
+# spacer.size_flags_horizontal = Control.SIZE_EXPAND
+# hbox.add_child(label)
+# hbox.add_child(spacer)
+# options.add_child(hbox)
+# for b in i.buttons():
+# hbox.add_child(b)
+ for category: SettingsCategory in Global.default_settings:
+ var category_settings = category.settings
+ var scroll := ScrollContainerCustom.new()
+ var options := VBoxContainer.new()
+ scroll.name = category.name
+ scroll.size_flags_horizontal = Control.SIZE_EXPAND_FILL
+ settings_tabs.add_child(scroll)
+ options.size_flags_horizontal = Control.SIZE_EXPAND_FILL
+ scroll.add_child(options)
+ for k: String in category_settings.keys():
+ var row: SettingsRow = Global.settings[k].get_row()
+ options.add_child(row)
+
if fix_focus:
pass
# TODO: Not implemented!
diff --git a/client/menu/settings.tscn b/client/menu/settings.tscn
index b7918339..9f523f7c 100644
--- a/client/menu/settings.tscn
+++ b/client/menu/settings.tscn
@@ -4,7 +4,8 @@
[ext_resource type="Script" path="res://menu/settings.gd" id="2_3hgm8"]
[ext_resource type="Material" uid="uid://beea1pc5nt67r" path="res://menu/theme/dark_blur_material.tres" id="3_8nykw"]
[ext_resource type="Script" path="res://menu/blur_setup.gd" id="4_v6q3y"]
-[ext_resource type="Script" path="res://menu/scroll_container_custom.gd" id="4_vfb63"]
+
+[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_85urc"]
[node name="SettingsMenu" type="Control"]
layout_mode = 3
@@ -51,16 +52,10 @@ size_flags_horizontal = 0
theme_override_font_sizes/font_size = 36
text = "Settings"
-[node name="ScrollContainer" type="ScrollContainer" parent="OuterGap/Panel/InnerGap/VBoxContainer"]
-layout_mode = 2
-size_flags_vertical = 3
-follow_focus = true
-script = ExtResource("4_vfb63")
-
-[node name="Options" type="VBoxContainer" parent="OuterGap/Panel/InnerGap/VBoxContainer/ScrollContainer"]
+[node name="TabContainer" type="TabContainer" parent="OuterGap/Panel/InnerGap/VBoxContainer"]
layout_mode = 2
-size_flags_horizontal = 3
size_flags_vertical = 3
+theme_override_styles/panel = SubResource("StyleBoxEmpty_85urc")
[node name="Back" type="Button" parent="OuterGap/Panel/InnerGap/VBoxContainer"]
layout_mode = 2
diff --git a/client/menu/settings/settings_category.gd b/client/menu/settings/settings_category.gd
new file mode 100644
index 00000000..e3c2ac09
--- /dev/null
+++ b/client/menu/settings/settings_category.gd
@@ -0,0 +1,26 @@
+# Hurry Curry! - a game about cooking
+# Copyright 2024 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
+# 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 SettingsCategory
+extends Object
+
+var name: String
+var id: String
+var settings: Dictionary # Dictionary[String, GameSetting]
+
+func _init(new_name: String, new_id: String, new_settings: Dictionary):
+ name = new_name
+ id = new_id
+ settings = new_settings