diff options
| author | tpart <tpart120@proton.me> | 2024-08-31 13:27:14 +0200 | 
|---|---|---|
| committer | tpart <tpart120@proton.me> | 2024-08-31 13:27:14 +0200 | 
| commit | d9456a77433dddab61a57ea17610385ef2d05c99 (patch) | |
| tree | daaded70b3fc509c4dc4642a21d0343215531728 /client | |
| parent | 2f7908912ec9779c8c84358aaafceadaa944acb9 (diff) | |
| download | hurrycurry-d9456a77433dddab61a57ea17610385ef2d05c99.tar hurrycurry-d9456a77433dddab61a57ea17610385ef2d05c99.tar.bz2 hurrycurry-d9456a77433dddab61a57ea17610385ef2d05c99.tar.zst | |
Use settings row for preset UI to make style more consistent
Diffstat (limited to 'client')
| -rw-r--r-- | client/menu/settings.gd | 18 | ||||
| -rw-r--r-- | client/menu/settings/settings_row.gd | 3 | 
2 files changed, 10 insertions, 11 deletions
| diff --git a/client/menu/settings.gd b/client/menu/settings.gd index 79043564..eb143900 100644 --- a/client/menu/settings.gd +++ b/client/menu/settings.gd @@ -16,6 +16,8 @@  #  extends Menu +const SETTINGS_ROW_SCENE = preload("res://menu/settings/settings_row.tscn")  +  @onready var settings_tabs: TabContainer = $OuterGap/Panel/InnerGap/VBoxContainer/TabContainer   func _ready(): @@ -46,17 +48,13 @@ func update_rows(fix_focus = false):  		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 i: Preset in category_presets: +				var row: SettingsRow = SETTINGS_ROW_SCENE.instantiate() +				options.add_child(row) +				row.label.text = i.label +				row.reset_button.visible = false  				for b in i.buttons(): -					hbox.add_child(b) +					row.value_parent.add_child(b)  		for k: String in category_settings.keys():  			var row: SettingsRow = Global.settings[k].get_row() diff --git a/client/menu/settings/settings_row.gd b/client/menu/settings/settings_row.gd index bebc5c38..f5621d78 100644 --- a/client/menu/settings/settings_row.gd +++ b/client/menu/settings/settings_row.gd @@ -20,9 +20,10 @@ signal reset()  @onready var value_parent = $HBoxContainer/BoxContainer  @onready var label = $HBoxContainer/Label +@onready var reset_button = $HBoxContainer/Reset   var value_node: Node -var description = tr("no value was given to the row") +var description = tr("No value was given to the row")   func _ready():  	if value_node != null: | 
