aboutsummaryrefslogtreecommitdiff
path: root/client/menu
diff options
context:
space:
mode:
Diffstat (limited to 'client/menu')
-rw-r--r--client/menu/settings.gd30
-rw-r--r--client/menu/settings/settings_category.gd4
2 files changed, 19 insertions, 15 deletions
diff --git a/client/menu/settings.gd b/client/menu/settings.gd
index 93155a93..79043564 100644
--- a/client/menu/settings.gd
+++ b/client/menu/settings.gd
@@ -33,20 +33,7 @@ func exit():
func update_rows(fix_focus = false):
for c in settings_tabs.get_children():
c.queue_free()
-
-# 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()
@@ -56,6 +43,21 @@ func update_rows(fix_focus = false):
settings_tabs.add_child(scroll)
options.size_flags_horizontal = Control.SIZE_EXPAND_FILL
scroll.add_child(options)
+
+ var category_presets = category.presets
+ if category_presets != null:
+ for i in category_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: String in category_settings.keys():
var row: SettingsRow = Global.settings[k].get_row()
options.add_child(row)
diff --git a/client/menu/settings/settings_category.gd b/client/menu/settings/settings_category.gd
index e3c2ac09..c4601429 100644
--- a/client/menu/settings/settings_category.gd
+++ b/client/menu/settings/settings_category.gd
@@ -19,8 +19,10 @@ extends Object
var name: String
var id: String
var settings: Dictionary # Dictionary[String, GameSetting]
+var presets # Array[Preset] | null
-func _init(new_name: String, new_id: String, new_settings: Dictionary):
+func _init(new_name: String, new_id: String, new_settings: Dictionary, new_presets = null):
name = new_name
id = new_id
settings = new_settings
+ presets = new_presets