diff options
Diffstat (limited to 'client/menu')
23 files changed, 254 insertions, 95 deletions
diff --git a/client/menu/character_menu.gd b/client/menu/character_menu.gd index f4b878be..3e535e71 100644 --- a/client/menu/character_menu.gd +++ b/client/menu/character_menu.gd @@ -19,21 +19,22 @@ extends Control  @onready var num_hairstyles := character.hairstyles.keys().size()  func _ready(): -	$VBoxContainer/top_panel/a/username.text = Global.settings["username"] -	character.select_hairstyle(Global.settings["character"]) +	$VBoxContainer/top_panel/a/username.text = Global.profile["username"] +	character.select_hairstyle(Global.profile["character"]) +	Global.focus_first_button(self)  func _on_back_pressed(): -	$SceneTransition.transition_to("res://menu/main_menu.tscn") +	$SceneTransition.transition_to("res://menu/menu_manager.tscn")  func _on_username_text_changed(new_text): -	Global.settings["username"] = new_text +	Global.profile["username"] = new_text  func _on_character_back_pressed(): -	Global.settings["character"] = (Global.settings["character"] - 1) % num_hairstyles -	character.select_hairstyle(Global.settings["character"]) +	Global.profile["character"] = (Global.profile["character"] - 1) % num_hairstyles +	character.select_hairstyle(Global.profile["character"])  	Global.save_profile()  func _on_character_forward_pressed(): -	Global.settings["character"] = (Global.settings["character"] + 1) % num_hairstyles -	character.select_hairstyle(Global.settings["character"]) +	Global.profile["character"] = (Global.profile["character"] + 1) % num_hairstyles +	character.select_hairstyle(Global.profile["character"])  	Global.save_profile() diff --git a/client/menu/character_menu.tscn b/client/menu/character_menu.tscn index cad0cb35..b958cf9d 100644 --- a/client/menu/character_menu.tscn +++ b/client/menu/character_menu.tscn @@ -1,6 +1,6 @@  [gd_scene load_steps=7 format=3 uid="uid://1f7xpirm5d28"] -[ext_resource type="Theme" uid="uid://b0qmvo504e457" path="res://menu/theme.tres" id="1_ak2pw"] +[ext_resource type="Theme" uid="uid://b0qmvo504e457" path="res://menu/theme/theme.tres" id="1_ak2pw"]  [ext_resource type="Script" path="res://menu/character_menu.gd" id="1_brhd1"]  [ext_resource type="PackedScene" uid="uid://b3hhir2fvnunu" path="res://player/character/character.tscn" id="3_odq7n"]  [ext_resource type="PackedScene" uid="uid://bg2d78ycorcqk" path="res://menu/scene_transition.tscn" id="4_c0ocf"] diff --git a/client/menu/credits_menu.gd b/client/menu/credits_menu.gd index e3ea4c51..2b481e47 100644 --- a/client/menu/credits_menu.gd +++ b/client/menu/credits_menu.gd @@ -21,9 +21,10 @@ var cc_by_3 := {  	"Glasses": "Jeremy Edelblut"  } +@onready var menu_manager: MenuManager = get_parent()  @onready var label = $Panel/MarginContainer/VBoxContainer/RichTextLabel -func _ready(): +func prepare():  	contributors.shuffle()  	label.text = "[center][b]undercooked - a game about cooking[/b]\n\ndeveloped by\n\n[b]"  	label.text += ", ".join(contributors) @@ -34,6 +35,6 @@ func _ready():  		label.text += "[b]\"%s\" %s[/b]\nLicensed under Creative Commons: By Attribution 3.0 License\nhttps://creativecommons.org/licenses/by/3.0/\n\n" % [k, v]  	label.text += "[b]Additional CC0 assets by:[/b]\n" + "\n".join(cc_0) -	 +  func _on_back_pressed(): -	$SceneTransition.transition_to("res://menu/main_menu.tscn") +	menu_manager.go_back() diff --git a/client/menu/credits_menu.tscn b/client/menu/credits_menu.tscn index a6536e16..74d5cbc9 100644 --- a/client/menu/credits_menu.tscn +++ b/client/menu/credits_menu.tscn @@ -1,9 +1,7 @@ -[gd_scene load_steps=6 format=3 uid="uid://7mqbxa054bjv"] +[gd_scene load_steps=4 format=3 uid="uid://7mqbxa054bjv"] -[ext_resource type="Theme" uid="uid://b0qmvo504e457" path="res://menu/theme.tres" id="1_emk5o"] +[ext_resource type="Theme" uid="uid://b0qmvo504e457" path="res://menu/theme/theme.tres" id="1_emk5o"]  [ext_resource type="Script" path="res://menu/credits_menu.gd" id="1_igs63"] -[ext_resource type="PackedScene" uid="uid://l4vm07dtda4j" path="res://menu/menu_background.tscn" id="2_k0853"] -[ext_resource type="PackedScene" uid="uid://bg2d78ycorcqk" path="res://menu/scene_transition.tscn" id="4_fbbdb"]  [sub_resource type="StyleBoxFlat" id="StyleBoxFlat_p2qmw"]  bg_color = Color(0, 0, 0, 0.878431) @@ -18,8 +16,6 @@ grow_vertical = 2  theme = ExtResource("1_emk5o")  script = ExtResource("1_igs63") -[node name="MenuBackground" parent="." instance=ExtResource("2_k0853")] -  [node name="Panel" type="Panel" parent="."]  layout_mode = 1  anchors_preset = 15 @@ -58,8 +54,4 @@ bbcode_enabled = true  layout_mode = 2  text = "Back" -[node name="SceneTransition" parent="." instance=ExtResource("4_fbbdb")] -visible = false -layout_mode = 1 -  [connection signal="pressed" from="Panel/MarginContainer/VBoxContainer/back" to="." method="_on_back_pressed"] diff --git a/client/menu/error_menu.gd b/client/menu/error_menu.gd index 9938ee9d..087261e5 100644 --- a/client/menu/error_menu.gd +++ b/client/menu/error_menu.gd @@ -1,7 +1,8 @@  extends Control  func _ready(): +	Global.focus_first_button(self)  	$Panel/contents/mesage.text = Global.error_message  func _on_return_pressed(): -	$SceneTransition.transition_to("res://menu/main_menu.tscn") +	$SceneTransition.transition_to("res://menu/menu_manager.tscn") diff --git a/client/menu/error_menu.tscn b/client/menu/error_menu.tscn index 0b86cceb..ea01ddc3 100644 --- a/client/menu/error_menu.tscn +++ b/client/menu/error_menu.tscn @@ -1,6 +1,6 @@  [gd_scene load_steps=5 format=3 uid="uid://cimgn07lbcs4v"] -[ext_resource type="Theme" uid="uid://b0qmvo504e457" path="res://menu/theme.tres" id="1_cabdu"] +[ext_resource type="Theme" uid="uid://b0qmvo504e457" path="res://menu/theme/theme.tres" id="1_cabdu"]  [ext_resource type="PackedScene" uid="uid://l4vm07dtda4j" path="res://menu/menu_background.tscn" id="2_5fxol"]  [ext_resource type="Script" path="res://menu/error_menu.gd" id="2_dbe41"]  [ext_resource type="PackedScene" uid="uid://bg2d78ycorcqk" path="res://menu/scene_transition.tscn" id="4_1nbt3"] diff --git a/client/menu/ingame_menu.gd b/client/menu/ingame_menu.gd index 21bfa8ac..4752c382 100644 --- a/client/menu/ingame_menu.gd +++ b/client/menu/ingame_menu.gd @@ -1,9 +1,20 @@  extends Control  @onready var anim = $AnimationPlayer +@onready var options = $Side/Margin/Options + +func act(): +	show() +	anim.play("activate") +	Global.focus_first_button(options) + +func deact(): +	anim.play_backwards("activate") +	await anim.animation_finished +	hide()  func _on_main_menu_pressed(): -	get_parent().transition_to("res://menu/main_menu.tscn") +	get_parent().transition_to("res://menu/menu_manager.tscn")  func _on_quit_pressed():  	get_parent().quit() diff --git a/client/menu/ingame_menu.tscn b/client/menu/ingame_menu.tscn index cf35a7e7..47b7cb54 100644 --- a/client/menu/ingame_menu.tscn +++ b/client/menu/ingame_menu.tscn @@ -1,16 +1,16 @@  [gd_scene load_steps=10 format=3 uid="uid://lxlgtjm8hw7v"]  [ext_resource type="Script" path="res://menu/ingame_menu.gd" id="1_gd1i3"] +[ext_resource type="Theme" uid="uid://b0qmvo504e457" path="res://menu/theme/theme.tres" id="1_lb056"]  [ext_resource type="Shader" path="res://menu/blur_mix.gdshader" id="1_o42mc"] -[ext_resource type="Theme" uid="uid://b0qmvo504e457" path="res://menu/theme.tres" id="1_tm331"] -[ext_resource type="FontFile" uid="uid://bo4vh5xkpvrh1" path="res://menu/font-sansita-swashed.woff2" id="2_4u0ox"] +[ext_resource type="FontFile" uid="uid://bo4vh5xkpvrh1" path="res://menu/theme/font-sansita-swashed.woff2" id="4_27kbu"]  [sub_resource type="Animation" id="Animation_8sedy"]  length = 0.001  tracks/0/type = "bezier"  tracks/0/imported = false  tracks/0/enabled = true -tracks/0/path = NodePath("side:position:x") +tracks/0/path = NodePath("Side:position:x")  tracks/0/interp = 1  tracks/0/loop_wrap = true  tracks/0/keys = { @@ -24,7 +24,7 @@ resource_name = "activate"  tracks/0/type = "bezier"  tracks/0/imported = false  tracks/0/enabled = true -tracks/0/path = NodePath("side:position:x") +tracks/0/path = NodePath("Side:position:x")  tracks/0/interp = 1  tracks/0/loop_wrap = true  tracks/0/keys = { @@ -46,7 +46,7 @@ shader_parameter/mix_amount = 0.3  shader_parameter/color_over = null  [sub_resource type="FontVariation" id="FontVariation_ud3l8"] -base_font = ExtResource("2_4u0ox") +base_font = ExtResource("4_27kbu")  variation_embolden = 0.5  [node name="IngameMenu" type="Control"] @@ -56,7 +56,7 @@ anchor_right = 1.0  anchor_bottom = 1.0  grow_horizontal = 2  grow_vertical = 2 -theme = ExtResource("1_tm331") +theme = ExtResource("1_lb056")  script = ExtResource("1_gd1i3")  [node name="AnimationPlayer" type="AnimationPlayer" parent="."] @@ -65,26 +65,27 @@ libraries = {  }  speed_scale = 8.0 -[node name="side" type="PanelContainer" parent="."] +[node name="Side" type="PanelContainer" parent="."]  material = SubResource("ShaderMaterial_o2vtr")  layout_mode = 1  anchors_preset = 9  anchor_bottom = 1.0  offset_left = -400.0  offset_right = -90.0 +offset_bottom = 1296.0  grow_vertical = 2 -[node name="margin" type="MarginContainer" parent="side"] +[node name="Margin" type="MarginContainer" parent="Side"]  layout_mode = 2  theme_override_constants/margin_left = 20  theme_override_constants/margin_top = 20  theme_override_constants/margin_right = 20  theme_override_constants/margin_bottom = 20 -[node name="options" type="VBoxContainer" parent="side/margin"] +[node name="Options" type="VBoxContainer" parent="Side/Margin"]  layout_mode = 2 -[node name="title" type="Label" parent="side/margin/options"] +[node name="Title" type="Label" parent="Side/Margin/Options"]  layout_mode = 2  auto_translate = false  theme_override_colors/font_outline_color = Color(0.566408, 0.208917, 0.266045, 1) @@ -93,25 +94,25 @@ theme_override_fonts/font = SubResource("FontVariation_ud3l8")  theme_override_font_sizes/font_size = 48  text = "Undercooked" -[node name="spacer" type="Control" parent="side/margin/options"] +[node name="Spacer" type="Control" parent="Side/Margin/Options"]  custom_minimum_size = Vector2(0, 10)  layout_mode = 2 -[node name="reconnect" type="Button" parent="side/margin/options"] +[node name="Reconnect" type="Button" parent="Side/Margin/Options"]  layout_mode = 2  text = "Reconnect"  alignment = 0 -[node name="main_menu" type="Button" parent="side/margin/options"] +[node name="MainMenu" type="Button" parent="Side/Margin/Options"]  layout_mode = 2  text = "Main Menu"  alignment = 0 -[node name="quit" type="Button" parent="side/margin/options"] +[node name="Quit" type="Button" parent="Side/Margin/Options"]  layout_mode = 2  text = "Quit"  alignment = 0 -[connection signal="pressed" from="side/margin/options/reconnect" to="." method="_on_reconnect_pressed"] -[connection signal="pressed" from="side/margin/options/main_menu" to="." method="_on_main_menu_pressed"] -[connection signal="pressed" from="side/margin/options/quit" to="." method="_on_quit_pressed"] +[connection signal="pressed" from="Side/Margin/Options/Reconnect" to="." method="_on_reconnect_pressed"] +[connection signal="pressed" from="Side/Margin/Options/MainMenu" to="." method="_on_main_menu_pressed"] +[connection signal="pressed" from="Side/Margin/Options/Quit" to="." method="_on_quit_pressed"] diff --git a/client/menu/main_menu.gd b/client/menu/main_menu.gd index 31ca5462..28629e0d 100644 --- a/client/menu/main_menu.gd +++ b/client/menu/main_menu.gd @@ -16,26 +16,25 @@  #  extends Control -@onready var transition = $SceneTransition -@onready var quick_connect = $side/margin/options/quick_connect +@onready var menu_manager: MenuManager = get_parent() +  @onready var quit_button = $side/margin/options/quit  @onready var connect_uri = $side/margin/options/connect/uri  func _ready(): -	quick_connect.grab_focus()  	if OS.has_feature("web"):  		quit_button.hide() -	connect_uri.text = Global.settings["last_server_url"] +	connect_uri.text = Global.profile["last_server_url"]  func _on_quit_pressed(): -	transition.quit() +	menu_manager.transition.quit()  func _on_credits_pressed(): -	transition.transition_to("res://menu/credits_menu.tscn") +	menu_manager.goto("credits")  func _on_connect_pressed(): -	var url = $side/margin/options/connect/uri.text -	Global.settings["last_server_url"] = url +	var url = connect_uri.text +	Global.profile["last_server_url"] = url  	Global.save_profile()  	connect_to(url) @@ -52,10 +51,10 @@ func _on_quick_connect_pressed():  func connect_to(url):  	print("Connecting to %s" % url)  	Global.server_url = url -	transition.transition_to("res://game.tscn") +	menu_manager.transition.transition_to("res://game.tscn")  func _on_change_character_pressed(): -	transition.transition_to("res://menu/character_menu.tscn") +	menu_manager.transition.transition_to("res://menu/character_menu.tscn")  func _on_settings_pressed(): -	transition.transition_to("res://menu/settings_menu.tscn") +	menu_manager.goto("settings") diff --git a/client/menu/main_menu.tscn b/client/menu/main_menu.tscn index 0deeb748..76b55a1a 100644 --- a/client/menu/main_menu.tscn +++ b/client/menu/main_menu.tscn @@ -1,11 +1,9 @@ -[gd_scene load_steps=9 format=3 uid="uid://dbj8508whxgwv"] +[gd_scene load_steps=8 format=3 uid="uid://dbj8508whxgwv"] -[ext_resource type="Theme" uid="uid://b0qmvo504e457" path="res://menu/theme.tres" id="1_nlcpo"] +[ext_resource type="Theme" uid="uid://b0qmvo504e457" path="res://menu/theme/theme.tres" id="1_nlcpo"]  [ext_resource type="Script" path="res://menu/main_menu.gd" id="2_qot2j"]  [ext_resource type="Shader" path="res://menu/blur_mix.gdshader" id="4_050xu"] -[ext_resource type="FontFile" uid="uid://bo4vh5xkpvrh1" path="res://menu/font-sansita-swashed.woff2" id="4_mfs30"] -[ext_resource type="PackedScene" uid="uid://l4vm07dtda4j" path="res://menu/menu_background.tscn" id="4_ydj5p"] -[ext_resource type="PackedScene" uid="uid://bg2d78ycorcqk" path="res://menu/scene_transition.tscn" id="5_651nk"] +[ext_resource type="FontFile" uid="uid://bo4vh5xkpvrh1" path="res://menu/theme/font-sansita-swashed.woff2" id="4_mfs30"]  [sub_resource type="ShaderMaterial" id="ShaderMaterial_irdo3"]  shader = ExtResource("4_050xu") @@ -13,6 +11,8 @@ shader_parameter/blur_amount = 3.5  shader_parameter/mix_amount = 0.3  shader_parameter/color_over = null +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_cm1nk"] +  [sub_resource type="FontVariation" id="FontVariation_htgmg"]  base_font = ExtResource("4_mfs30")  variation_embolden = 0.5 @@ -27,8 +27,6 @@ grow_vertical = 2  theme = ExtResource("1_nlcpo")  script = ExtResource("2_qot2j") -[node name="MenuBackground" parent="." instance=ExtResource("4_ydj5p")] -  [node name="side" type="PanelContainer" parent="."]  material = SubResource("ShaderMaterial_irdo3")  layout_mode = 1 @@ -36,6 +34,7 @@ anchors_preset = 9  anchor_bottom = 1.0  offset_right = 340.0  grow_vertical = 2 +theme_override_styles/panel = SubResource("StyleBoxFlat_cm1nk")  [node name="margin" type="MarginContainer" parent="side"]  layout_mode = 2 @@ -98,10 +97,6 @@ layout_mode = 2  text = "Quit"  alignment = 0 -[node name="SceneTransition" parent="." instance=ExtResource("5_651nk")] -visible = false -layout_mode = 1 -  [connection signal="pressed" from="side/margin/options/quick_connect" to="." method="_on_quick_connect_pressed"]  [connection signal="pressed" from="side/margin/options/connect/connect" to="." method="_on_connect_pressed"]  [connection signal="pressed" from="side/margin/options/change_character" to="." method="_on_change_character_pressed"] diff --git a/client/menu/menu_manager.gd b/client/menu/menu_manager.gd new file mode 100644 index 00000000..69866377 --- /dev/null +++ b/client/menu/menu_manager.gd @@ -0,0 +1,36 @@ +extends Control +class_name MenuManager + +@onready var menus = { +	"main": $MainMenu, +	"credits": $CreditsMenu, +	"settings": $SettingsMenu +} +@onready var transition = $SceneTransition + +var menu_stack = ["main"] + +func _ready(): +	Global.focus_first_button(menus[menu_stack.back()]) + +func goto(menu_name: String): +	show_menu(menu_name) +	menu_stack.push_back(menu_name) +	print("Go to called. Stack: " + str(menu_stack)) + +func go_back(): +	menu_stack.pop_back() +	if menu_stack.is_empty(): +		Global.showError("Menu stack empty") +	show_menu(menu_stack.back()) +	print("Go back called. Stack: " + str(menu_stack)) + +func show_menu(menu_name: String): +	for k in menus.keys(): +		if k == menu_name: +			menus[k].show() +			if menus[k].has_method("prepare"): +				menus[k].prepare() # Optionally run some code +			Global.focus_first_button(menus[k]) +		else: +			menus[k].hide() diff --git a/client/menu/menu_manager.tscn b/client/menu/menu_manager.tscn new file mode 100644 index 00000000..6b2d7b33 --- /dev/null +++ b/client/menu/menu_manager.tscn @@ -0,0 +1,38 @@ +[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"] +[ext_resource type="PackedScene" uid="uid://dbj8508whxgwv" path="res://menu/main_menu.tscn" id="3_ccpur"] +[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"] + +[node name="MenuManager" type="Control"] +layout_mode = 3 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +script = ExtResource("1_c0rjm") + +[node name="MenuBackground" parent="." instance=ExtResource("2_nf7b6")] + +[node name="MainMenu" parent="." instance=ExtResource("3_ccpur")] +layout_mode = 1 + +[node name="CreditsMenu" parent="." instance=ExtResource("4_xhcd8")] +visible = false +layout_mode = 1 + +[node name="SettingsMenu" parent="." instance=ExtResource("5_lifj8")] +visible = false +layout_mode = 1 + +[node name="SceneTransition" parent="." instance=ExtResource("6_p4u45")] +layout_mode = 0 +anchors_preset = 0 +anchor_right = 0.0 +anchor_bottom = 0.0 +grow_horizontal = 1 +grow_vertical = 1 diff --git a/client/menu/scene_transition.gd b/client/menu/scene_transition.gd index 8d9f38cf..87a1ec1b 100644 --- a/client/menu/scene_transition.gd +++ b/client/menu/scene_transition.gd @@ -45,9 +45,6 @@ func out():  func _process(_delta):  	if ingame:  		if not menu.visible and Input.is_action_just_pressed("pause"): -			menu.visible = true -			menu.anim.play("activate") +			menu.act()  		elif menu.visible and Input.is_action_just_pressed("pause"): -			menu.anim.play_backwards("activate") -			await menu.anim.animation_finished -			menu.visible = false +			menu.deact() diff --git a/client/menu/settings_menu.gd b/client/menu/settings_menu.gd index a023cf36..6b2a7f60 100644 --- a/client/menu/settings_menu.gd +++ b/client/menu/settings_menu.gd @@ -15,5 +15,22 @@  #  extends Control +@onready var options: VBoxContainer = $outer_gap/panel/inner_gap/options +@onready var menu_manager: MenuManager = get_parent() + +var settings: Dictionary +  func _on_back_pressed(): -	$SceneTransition.transition_to("res://menu/main_menu.tscn") +	for k in settings.keys(): +		Global.settings[k]["value"] = settings[k].get_value() +	Global.save_settings() +	menu_manager.go_back() + + +func _ready(): +	for k in Global.settings.keys(): +		var v = Global.settings[k] +		var row: SettingsRow = preload("res://menu/settings_row.tscn").instantiate() +		row.setup(v["description"], v["value"]) +		options.add_child(row) +		settings[k] = row diff --git a/client/menu/settings_menu.tscn b/client/menu/settings_menu.tscn index 18a32759..6ead9b8b 100644 --- a/client/menu/settings_menu.tscn +++ b/client/menu/settings_menu.tscn @@ -1,9 +1,7 @@ -[gd_scene load_steps=5 format=3 uid="uid://8ic77jmadadj"] +[gd_scene load_steps=3 format=3 uid="uid://8ic77jmadadj"] -[ext_resource type="Theme" uid="uid://b0qmvo504e457" path="res://menu/theme.tres" id="1_foq3a"] -[ext_resource type="PackedScene" uid="uid://l4vm07dtda4j" path="res://menu/menu_background.tscn" id="1_wi8ti"] +[ext_resource type="Theme" uid="uid://b0qmvo504e457" path="res://menu/theme/theme.tres" id="1_foq3a"]  [ext_resource type="Script" path="res://menu/settings_menu.gd" id="2_3hgm8"] -[ext_resource type="PackedScene" uid="uid://bg2d78ycorcqk" path="res://menu/scene_transition.tscn" id="2_t0one"]  [node name="SettingsMenu" type="Control"]  layout_mode = 3 @@ -15,8 +13,6 @@ grow_vertical = 2  theme = ExtResource("1_foq3a")  script = ExtResource("2_3hgm8") -[node name="MenuBackground" parent="." instance=ExtResource("1_wi8ti")] -  [node name="outer_gap" type="MarginContainer" parent="."]  layout_mode = 1  anchors_preset = 15 @@ -58,8 +54,4 @@ layout_mode = 2  size_flags_vertical = 8  text = "Back to Main Menu" -[node name="SceneTransition" parent="." instance=ExtResource("2_t0one")] -visible = false -layout_mode = 1 -  [connection signal="pressed" from="outer_gap/panel/inner_gap/back" to="." method="_on_back_pressed"] diff --git a/client/menu/settings_row.gd b/client/menu/settings_row.gd new file mode 100644 index 00000000..ee4b8cb9 --- /dev/null +++ b/client/menu/settings_row.gd @@ -0,0 +1,36 @@ +class_name SettingsRow +extends PanelContainer + +@onready var value_parent = $HBoxContainer/BoxContainer +@onready var label = $HBoxContainer/Label + +var value_node +var description = tr("no value was given to the row") + +func setup(description_: String, value): +	description = description_ +	if value is bool: +		value_node = CheckButton.new() +		value_node.button_pressed = value +	elif value is String: +		value_node = LineEdit.new() +		value_node.text = value + +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 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 +		else: +			return null +	else: +		return null diff --git a/client/menu/settings_row.tscn b/client/menu/settings_row.tscn new file mode 100644 index 00000000..b083d291 --- /dev/null +++ b/client/menu/settings_row.tscn @@ -0,0 +1,24 @@ +[gd_scene load_steps=2 format=3 uid="uid://o5e5vpem8w0k"] + +[ext_resource type="Script" path="res://menu/settings_row.gd" id="1_lxjnc"] + +[node name="SettingsRow" type="PanelContainer"] +offset_right = 105.0 +offset_bottom = 23.0 +size_flags_horizontal = 3 +script = ExtResource("1_lxjnc") + +[node name="HBoxContainer" type="HBoxContainer" parent="."] +layout_mode = 2 + +[node name="Label" type="Label" parent="HBoxContainer"] +layout_mode = 2 +size_flags_horizontal = 3 + +[node name="BoxContainer" type="BoxContainer" parent="HBoxContainer"] +custom_minimum_size = Vector2(300, 50) +layout_mode = 2 +alignment = 2 + +[node name="Button" type="Button" parent="HBoxContainer"] +layout_mode = 2 diff --git a/client/menu/theme/focus_style.tres b/client/menu/theme/focus_style.tres new file mode 100644 index 00000000..a01843fe --- /dev/null +++ b/client/menu/theme/focus_style.tres @@ -0,0 +1,17 @@ +[gd_resource type="StyleBoxFlat" format=3 uid="uid://b86kbd3pfkd5w"] + +[resource] +content_margin_left = 10.0 +content_margin_top = 10.0 +content_margin_right = 10.0 +content_margin_bottom = 10.0 +bg_color = Color(1, 1, 1, 0.0627451) +border_width_left = 2 +border_width_top = 2 +border_width_right = 2 +border_width_bottom = 2 +border_color = Color(0.818673, 0.926505, 1, 1) +corner_radius_top_left = 5 +corner_radius_top_right = 5 +corner_radius_bottom_right = 5 +corner_radius_bottom_left = 5 diff --git a/client/menu/font-josefin-sans.woff2 b/client/menu/theme/font-josefin-sans.woff2 Binary files differindex dce2708f..dce2708f 100644 --- a/client/menu/font-josefin-sans.woff2 +++ b/client/menu/theme/font-josefin-sans.woff2 diff --git a/client/menu/font-josefin-sans.woff2.import b/client/menu/theme/font-josefin-sans.woff2.import index 9bf40c47..5ecd872c 100644 --- a/client/menu/font-josefin-sans.woff2.import +++ b/client/menu/theme/font-josefin-sans.woff2.import @@ -3,12 +3,12 @@  importer="font_data_dynamic"  type="FontFile"  uid="uid://5ixo6b3bd3km" -path="res://.godot/imported/font-josefin-sans.woff2-8195d19f9e478a66f9d2ca31db663e15.fontdata" +path="res://.godot/imported/font-josefin-sans.woff2-e2c3f263d98e1132cfe6af3f4f0a3454.fontdata"  [deps] -source_file="res://menu/font-josefin-sans.woff2" -dest_files=["res://.godot/imported/font-josefin-sans.woff2-8195d19f9e478a66f9d2ca31db663e15.fontdata"] +source_file="res://menu/theme/font-josefin-sans.woff2" +dest_files=["res://.godot/imported/font-josefin-sans.woff2-e2c3f263d98e1132cfe6af3f4f0a3454.fontdata"]  [params] diff --git a/client/menu/font-sansita-swashed.woff2 b/client/menu/theme/font-sansita-swashed.woff2 Binary files differindex 5c665fb0..5c665fb0 100644 --- a/client/menu/font-sansita-swashed.woff2 +++ b/client/menu/theme/font-sansita-swashed.woff2 diff --git a/client/menu/font-sansita-swashed.woff2.import b/client/menu/theme/font-sansita-swashed.woff2.import index 54056a3c..faf840fa 100644 --- a/client/menu/font-sansita-swashed.woff2.import +++ b/client/menu/theme/font-sansita-swashed.woff2.import @@ -3,12 +3,12 @@  importer="font_data_dynamic"  type="FontFile"  uid="uid://bo4vh5xkpvrh1" -path="res://.godot/imported/font-sansita-swashed.woff2-259623c6db3c7be991207ff769c643a5.fontdata" +path="res://.godot/imported/font-sansita-swashed.woff2-323b4a2ee0671aba6e17a6f073f706f3.fontdata"  [deps] -source_file="res://menu/font-sansita-swashed.woff2" -dest_files=["res://.godot/imported/font-sansita-swashed.woff2-259623c6db3c7be991207ff769c643a5.fontdata"] +source_file="res://menu/theme/font-sansita-swashed.woff2" +dest_files=["res://.godot/imported/font-sansita-swashed.woff2-323b4a2ee0671aba6e17a6f073f706f3.fontdata"]  [params] diff --git a/client/menu/theme.tres b/client/menu/theme/theme.tres index c2ec3b12..96cdbb19 100644 --- a/client/menu/theme.tres +++ b/client/menu/theme/theme.tres @@ -1,10 +1,11 @@ -[gd_resource type="Theme" load_steps=8 format=3 uid="uid://b0qmvo504e457"] +[gd_resource type="Theme" load_steps=9 format=3 uid="uid://b0qmvo504e457"] -[ext_resource type="FontFile" uid="uid://5ixo6b3bd3km" path="res://menu/font-josefin-sans.woff2" id="1_go7fi"] -[ext_resource type="FontFile" uid="uid://bo4vh5xkpvrh1" path="res://menu/font-sansita-swashed.woff2" id="1_tneco"] +[ext_resource type="FontFile" uid="uid://5ixo6b3bd3km" path="res://menu/theme/font-josefin-sans.woff2" id="1_f8qb0"] +[ext_resource type="StyleBox" uid="uid://b86kbd3pfkd5w" path="res://menu/theme/focus_style.tres" id="2_brg2c"] +[ext_resource type="FontFile" uid="uid://bo4vh5xkpvrh1" path="res://menu/theme/font-sansita-swashed.woff2" id="3_8u6ww"]  [sub_resource type="FontVariation" id="FontVariation_lyo8w"] -base_font = ExtResource("1_go7fi") +base_font = ExtResource("1_f8qb0")  variation_embolden = 1.25  spacing_top = 5 @@ -39,25 +40,25 @@ grow_end = 0.0  thickness = 3  [sub_resource type="FontVariation" id="FontVariation_ff4nr"] -base_font = ExtResource("1_tneco") +base_font = ExtResource("3_8u6ww")  variation_embolden = 0.7  [resource]  Button/font_sizes/font_size = 18  Button/fonts/font = SubResource("FontVariation_lyo8w")  Button/styles/disabled = SubResource("StyleBoxFlat_25x32") -Button/styles/focus = SubResource("StyleBoxFlat_25x32") +Button/styles/focus = ExtResource("2_brg2c")  Button/styles/hover = SubResource("StyleBoxFlat_2fl8q")  Button/styles/normal = SubResource("StyleBoxFlat_25x32")  Button/styles/pressed = SubResource("StyleBoxFlat_25x32")  HSeparator/styles/separator = SubResource("StyleBoxLine_emtvk")  Label/font_sizes/font_size = 16 -Label/fonts/font = ExtResource("1_tneco") -LineEdit/styles/focus = SubResource("StyleBoxFlat_25x32") +Label/fonts/font = ExtResource("3_8u6ww") +LineEdit/styles/focus = ExtResource("2_brg2c")  LineEdit/styles/normal = SubResource("StyleBoxFlat_25x32")  LineEdit/styles/read_only = SubResource("StyleBoxFlat_25x32")  RichTextLabel/fonts/bold_font = SubResource("FontVariation_ff4nr")  RichTextLabel/fonts/bold_italics_font = null  RichTextLabel/fonts/italics_font = null  RichTextLabel/fonts/mono_font = null -RichTextLabel/fonts/normal_font = ExtResource("1_tneco") +RichTextLabel/fonts/normal_font = ExtResource("3_8u6ww")  |