diff options
Diffstat (limited to 'client/menu')
-rw-r--r-- | client/menu/menu_manager.gd | 19 | ||||
-rw-r--r-- | client/menu/setup_menu.gd | 37 | ||||
-rw-r--r-- | client/menu/setup_menu.tscn | 187 | ||||
-rw-r--r-- | client/menu/theme/paper.tres | 20 |
4 files changed, 234 insertions, 29 deletions
diff --git a/client/menu/menu_manager.gd b/client/menu/menu_manager.gd index e51e47f1..bba074f6 100644 --- a/client/menu/menu_manager.gd +++ b/client/menu/menu_manager.gd @@ -1,3 +1,19 @@ +# Undercooked - a game about cooking +# Copyright 2024 metamuffin +# 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/>. +# extends Control class_name MenuManager @@ -6,11 +22,12 @@ class_name MenuManager "credits": $CreditsMenu, "settings": $SettingsMenu } -@onready var transition = $SceneTransition +@onready var transition: SceneTransition = $SceneTransition var menu_stack = ["main"] func _ready(): + if not Global.settings["setup_complete"]["value"]: return transition.instant_to("res://menu/setup_menu.tscn") get_viewport().gui_focus_changed.connect(Sound.play_hover_maybe) Global.focus_first_button(menus[menu_stack.back()]) diff --git a/client/menu/setup_menu.gd b/client/menu/setup_menu.gd index 5310329e..70b5d642 100644 --- a/client/menu/setup_menu.gd +++ b/client/menu/setup_menu.gd @@ -1,6 +1,43 @@ +# 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 Control @onready var anim: AnimationPlayer = $AnimationPlayer +@onready var username: LineEdit = $ScrollContainer/Control/TextureRect/PaperMargin/Contents/NameEntry/LineEdit +@onready var character_opts: Container = $ScrollContainer/Control/TextureRect/PaperMargin/Contents/UniformEntry func _ready(): anim.play("paper_slide") + +func _on_sign_pressed(): + var character = -1 + for i in character_opts.get_children().size(): + if character_opts.get_children()[i].button_pressed: + character = i + + if username.text == "": OS.alert("Name field cannot be empty."); return + if character == -1: OS.alert("Hairstyle needs to be selected."); return + + anim.play_backwards("paper_slide") + await anim.animation_finished + + Global.profile["username"] = username.text + Global.profile["character"] = character + + Global.settings["setup_complete"]["value"] = true + Global.save_profile() + Global.save_settings() + $SceneTransition.transition_to("res://menu/menu_manager.tscn") diff --git a/client/menu/setup_menu.tscn b/client/menu/setup_menu.tscn index c1d796ef..81c0aad5 100644 --- a/client/menu/setup_menu.tscn +++ b/client/menu/setup_menu.tscn @@ -1,7 +1,9 @@ -[gd_scene load_steps=11 format=3 uid="uid://ddl3efikvqp66"] +[gd_scene load_steps=14 format=3 uid="uid://ddl3efikvqp66"] [ext_resource type="Script" path="res://menu/setup_menu.gd" id="1_mo46n"] [ext_resource type="Theme" uid="uid://ci2qajdoa1an1" path="res://menu/theme/paper.tres" id="1_yq0aa"] +[ext_resource type="FontFile" uid="uid://bo4vh5xkpvrh1" path="res://menu/theme/font-sansita-swashed.woff2" id="3_2vg4d"] +[ext_resource type="PackedScene" uid="uid://bg2d78ycorcqk" path="res://menu/scene_transition.tscn" id="4_u444t"] [sub_resource type="Animation" id="Animation_m4a1a"] length = 0.001 @@ -30,7 +32,7 @@ tracks/0/keys = { "times": PackedFloat32Array(0, 1), "transitions": PackedFloat32Array(1, 1), "update": 0, -"values": [Vector2(0, 600), Vector2(0, 0)] +"values": [Vector2(0, -1800), Vector2(0, 0)] } [sub_resource type="AnimationLibrary" id="AnimationLibrary_wjgak"] @@ -57,6 +59,9 @@ corner_radius_bottom_left = 10 [sub_resource type="ButtonGroup" id="ButtonGroup_8p5im"] +[sub_resource type="FontVariation" id="FontVariation_2cc7p"] +base_font = ExtResource("3_2vg4d") + [node name="SetupMenu" type="Control"] layout_mode = 3 anchors_preset = 15 @@ -67,8 +72,7 @@ grow_vertical = 2 script = ExtResource("1_mo46n") [node name="ColorRect" type="ColorRect" parent="."] -layout_mode = 1 -anchors_preset = 15 +layout_mode = 2 anchor_right = 1.0 anchor_bottom = 1.0 grow_horizontal = 2 @@ -82,12 +86,12 @@ libraries = { speed_scale = 2.0 [node name="ScrollContainer" type="ScrollContainer" parent="."] +clip_contents = false layout_mode = 1 anchors_preset = 15 anchor_right = 1.0 anchor_bottom = 1.0 -offset_right = 1152.0 -offset_bottom = 648.0 +offset_bottom = 0.00012207 grow_horizontal = 2 grow_vertical = 2 horizontal_scroll_mode = 0 @@ -115,7 +119,7 @@ rotation = 0.0174533 theme = ExtResource("1_yq0aa") texture = SubResource("NoiseTexture2D_bvvl7") -[node name="Panel" type="Panel" parent="ScrollContainer/Control/TextureRect"] +[node name="Hole1" type="Panel" parent="ScrollContainer/Control/TextureRect"] layout_mode = 1 anchors_preset = 8 anchor_left = 0.5 @@ -130,7 +134,7 @@ grow_horizontal = 2 grow_vertical = 2 theme_override_styles/panel = SubResource("StyleBoxFlat_e7xn5") -[node name="Panel2" type="Panel" parent="ScrollContainer/Control/TextureRect"] +[node name="Hole2" type="Panel" parent="ScrollContainer/Control/TextureRect"] layout_mode = 1 anchors_preset = 8 anchor_left = 0.5 @@ -145,7 +149,7 @@ grow_horizontal = 2 grow_vertical = 2 theme_override_styles/panel = SubResource("StyleBoxFlat_e7xn5") -[node name="MarginContainer" type="MarginContainer" parent="ScrollContainer/Control/TextureRect"] +[node name="PaperMargin" type="MarginContainer" parent="ScrollContainer/Control/TextureRect"] layout_mode = 1 anchors_preset = 15 anchor_right = 1.0 @@ -153,73 +157,202 @@ anchor_bottom = 1.0 grow_horizontal = 2 grow_vertical = 2 -[node name="VBoxContainer" type="VBoxContainer" parent="ScrollContainer/Control/TextureRect/MarginContainer"] +[node name="Contents" type="VBoxContainer" parent="ScrollContainer/Control/TextureRect/PaperMargin"] layout_mode = 2 -[node name="Title" type="Label" parent="ScrollContainer/Control/TextureRect/MarginContainer/VBoxContainer"] +[node name="Title" type="Label" parent="ScrollContainer/Control/TextureRect/PaperMargin/Contents"] layout_mode = 2 size_flags_horizontal = 4 theme_override_font_sizes/font_size = 30 text = "EMPLOYMENT CONTRACT" -[node name="Sep" type="HSeparator" parent="ScrollContainer/Control/TextureRect/MarginContainer/VBoxContainer"] +[node name="Sep" type="HSeparator" parent="ScrollContainer/Control/TextureRect/PaperMargin/Contents"] +layout_mode = 2 + +[node name="Intro" type="RichTextLabel" parent="ScrollContainer/Control/TextureRect/PaperMargin/Contents"] layout_mode = 2 +bbcode_enabled = true +text = "This is a binding contract between you (the employee) and Musterfoods Ltd. (the employer) for working as a chef or waiter." +fit_content = true +scroll_active = false -[node name="Name" type="RichTextLabel" parent="ScrollContainer/Control/TextureRect/MarginContainer/VBoxContainer"] +[node name="Name" type="RichTextLabel" parent="ScrollContainer/Control/TextureRect/PaperMargin/Contents"] layout_mode = 2 bbcode_enabled = true text = "1. [b]Name of the Employee[/b]" fit_content = true scroll_active = false -[node name="NameEntry" type="HBoxContainer" parent="ScrollContainer/Control/TextureRect/MarginContainer/VBoxContainer"] +[node name="NameEntry" type="HBoxContainer" parent="ScrollContainer/Control/TextureRect/PaperMargin/Contents"] +layout_mode = 2 + +[node name="LineEdit" type="LineEdit" parent="ScrollContainer/Control/TextureRect/PaperMargin/Contents/NameEntry"] +custom_minimum_size = Vector2(300, 30) +layout_mode = 2 + +[node name="Control" type="Control" parent="ScrollContainer/Control/TextureRect/PaperMargin/Contents/NameEntry"] +layout_mode = 2 + +[node name="Position" type="RichTextLabel" parent="ScrollContainer/Control/TextureRect/PaperMargin/Contents"] +layout_mode = 2 +bbcode_enabled = true +text = "2. [b]Employment Position[/b]" +fit_content = true +scroll_active = false + +[node name="PositionEntry" type="HBoxContainer" parent="ScrollContainer/Control/TextureRect/PaperMargin/Contents"] layout_mode = 2 -[node name="LineEdit" type="LineEdit" parent="ScrollContainer/Control/TextureRect/MarginContainer/VBoxContainer/NameEntry"] +[node name="LineEdit" type="LineEdit" parent="ScrollContainer/Control/TextureRect/PaperMargin/Contents/PositionEntry"] custom_minimum_size = Vector2(300, 30) layout_mode = 2 -text = "J́ohn Doe" +theme_override_colors/font_color = Color(0.458824, 0, 0, 1) +theme_override_colors/font_uneditable_color = Color(0.458824, 0, 0, 1) +text = "Chef / Waiting Staff" +editable = false -[node name="Control" type="Control" parent="ScrollContainer/Control/TextureRect/MarginContainer/VBoxContainer/NameEntry"] +[node name="Control" type="Control" parent="ScrollContainer/Control/TextureRect/PaperMargin/Contents/PositionEntry"] layout_mode = 2 -[node name="Uniform" type="RichTextLabel" parent="ScrollContainer/Control/TextureRect/MarginContainer/VBoxContainer"] +[node name="Uniform" type="RichTextLabel" parent="ScrollContainer/Control/TextureRect/PaperMargin/Contents"] layout_mode = 2 bbcode_enabled = true -text = "2. [b]Working Uniform.[/b] You must always have one of the following hairstyles." +text = "3. [b]Working Uniform.[/b] You must always have one of the following hairstyles." fit_content = true scroll_active = false -[node name="VBoxContainer" type="VBoxContainer" parent="ScrollContainer/Control/TextureRect/MarginContainer/VBoxContainer"] +[node name="UniformEntry" type="VBoxContainer" parent="ScrollContainer/Control/TextureRect/PaperMargin/Contents"] layout_mode = 2 -[node name="CheckBox" type="CheckBox" parent="ScrollContainer/Control/TextureRect/MarginContainer/VBoxContainer/VBoxContainer"] +[node name="Style1" type="CheckBox" parent="ScrollContainer/Control/TextureRect/PaperMargin/Contents/UniformEntry"] layout_mode = 2 button_group = SubResource("ButtonGroup_8p5im") text = "Hairstyle 1" -[node name="CheckBox2" type="CheckBox" parent="ScrollContainer/Control/TextureRect/MarginContainer/VBoxContainer/VBoxContainer"] +[node name="Style2" type="CheckBox" parent="ScrollContainer/Control/TextureRect/PaperMargin/Contents/UniformEntry"] layout_mode = 2 button_group = SubResource("ButtonGroup_8p5im") text = "Hairstyle 2" -[node name="CheckBox3" type="CheckBox" parent="ScrollContainer/Control/TextureRect/MarginContainer/VBoxContainer/VBoxContainer"] +[node name="Style3" type="CheckBox" parent="ScrollContainer/Control/TextureRect/PaperMargin/Contents/UniformEntry"] layout_mode = 2 button_group = SubResource("ButtonGroup_8p5im") text = "Hairstyle 3" -[node name="Duties" type="RichTextLabel" parent="ScrollContainer/Control/TextureRect/MarginContainer/VBoxContainer"] +[node name="Duties" type="RichTextLabel" parent="ScrollContainer/Control/TextureRect/PaperMargin/Contents"] +layout_mode = 2 +bbcode_enabled = true +text = "4. [b]Duties.[/b] It is your duty to serve customers the meal or item that they request. +" +fit_content = true +scroll_active = false + +[node name="Terms" type="RichTextLabel" parent="ScrollContainer/Control/TextureRect/PaperMargin/Contents"] layout_mode = 2 bbcode_enabled = true -text = "2. [b]Duties.[/b] It is your duty to serve customers the meal or item that they request. +text = "5. [b]Additional Terms.[/b] You shall not duplicate plates. (That is [u]NOT[/u] possible!) " fit_content = true scroll_active = false -[node name="Terms" type="RichTextLabel" parent="ScrollContainer/Control/TextureRect/MarginContainer/VBoxContainer"] +[node name="Compensation" type="RichTextLabel" parent="ScrollContainer/Control/TextureRect/PaperMargin/Contents"] +layout_mode = 2 +bbcode_enabled = true +text = "4. [b]Compensation.[/b] You will be compensated monthly for your work." +fit_content = true +scroll_active = false + +[node name="CompensationEntry" type="HBoxContainer" parent="ScrollContainer/Control/TextureRect/PaperMargin/Contents"] +layout_mode = 2 + +[node name="Spacer" type="Control" parent="ScrollContainer/Control/TextureRect/PaperMargin/Contents/CompensationEntry"] +custom_minimum_size = Vector2(15.045, 0) +layout_mode = 2 + +[node name="Text1" type="RichTextLabel" parent="ScrollContainer/Control/TextureRect/PaperMargin/Contents/CompensationEntry"] +custom_minimum_size = Vector2(100.08, 0) +layout_mode = 2 +bbcode_enabled = true +text = "The salary is" +scroll_active = false + +[node name="LineEdit" type="LineEdit" parent="ScrollContainer/Control/TextureRect/PaperMargin/Contents/CompensationEntry"] +custom_minimum_size = Vector2(50, 30) +layout_mode = 2 +theme_override_colors/font_uneditable_color = Color(0.478431, 0, 0, 1) +text = "$ 0.00" +editable = false + +[node name="Text2" type="RichTextLabel" parent="ScrollContainer/Control/TextureRect/PaperMargin/Contents/CompensationEntry"] +custom_minimum_size = Vector2(100.08, 0) +layout_mode = 2 +bbcode_enabled = true +text = "per month" +scroll_active = false + +[node name="Spacer" type="Control" parent="ScrollContainer/Control/TextureRect/PaperMargin/Contents"] +custom_minimum_size = Vector2(0, 200) +layout_mode = 2 + +[node name="Signatures" type="HBoxContainer" parent="ScrollContainer/Control/TextureRect/PaperMargin/Contents"] +layout_mode = 2 + +[node name="EmployerMargin" type="MarginContainer" parent="ScrollContainer/Control/TextureRect/PaperMargin/Contents/Signatures"] +layout_mode = 2 + +[node name="Sign" type="VBoxContainer" parent="ScrollContainer/Control/TextureRect/PaperMargin/Contents/Signatures/EmployerMargin"] +layout_mode = 2 + +[node name="Desc" type="RichTextLabel" parent="ScrollContainer/Control/TextureRect/PaperMargin/Contents/Signatures/EmployerMargin/Sign"] +layout_mode = 2 +theme_override_font_sizes/normal_font_size = 15 +bbcode_enabled = true +text = "Signature of the Employer: +Musterfoods Ltd. +Frank Miller, Head of HR" +fit_content = true +scroll_active = false + +[node name="Signature" type="Label" parent="ScrollContainer/Control/TextureRect/PaperMargin/Contents/Signatures/EmployerMargin/Sign"] +custom_minimum_size = Vector2(200, 80) +layout_mode = 2 +theme_override_colors/font_color = Color(0.415686, 0.0253044, 0.135441, 1) +theme_override_fonts/font = SubResource("FontVariation_2cc7p") +theme_override_font_sizes/font_size = 31 +text = "F.Miller" +horizontal_alignment = 1 +vertical_alignment = 1 + +[node name="Underline" type="HSeparator" parent="ScrollContainer/Control/TextureRect/PaperMargin/Contents/Signatures/EmployerMargin/Sign"] +layout_mode = 2 + +[node name="EmployeeMargin" type="MarginContainer" parent="ScrollContainer/Control/TextureRect/PaperMargin/Contents/Signatures"] +layout_mode = 2 + +[node name="Sign" type="VBoxContainer" parent="ScrollContainer/Control/TextureRect/PaperMargin/Contents/Signatures/EmployeeMargin"] +layout_mode = 2 + +[node name="Desc" type="RichTextLabel" parent="ScrollContainer/Control/TextureRect/PaperMargin/Contents/Signatures/EmployeeMargin/Sign"] layout_mode = 2 +theme_override_font_sizes/normal_font_size = 15 bbcode_enabled = true -text = "3. [b]Additional Terms.[/b] You shall not duplicate plates. (That is [u]NOT[/u] possible!) +text = "Signature of the Employee: + + " fit_content = true scroll_active = false + +[node name="Signature" type="Button" parent="ScrollContainer/Control/TextureRect/PaperMargin/Contents/Signatures/EmployeeMargin/Sign"] +custom_minimum_size = Vector2(200, 80) +layout_mode = 2 +text = "Click to sign" + +[node name="Underline" type="HSeparator" parent="ScrollContainer/Control/TextureRect/PaperMargin/Contents/Signatures/EmployeeMargin/Sign"] +layout_mode = 2 + +[node name="SceneTransition" parent="." instance=ExtResource("4_u444t")] +visible = false +layout_mode = 1 + +[connection signal="pressed" from="ScrollContainer/Control/TextureRect/PaperMargin/Contents/Signatures/EmployeeMargin/Sign/Signature" to="." method="_on_sign_pressed"] diff --git a/client/menu/theme/paper.tres b/client/menu/theme/paper.tres index a3514818..91426551 100644 --- a/client/menu/theme/paper.tres +++ b/client/menu/theme/paper.tres @@ -1,6 +1,17 @@ -[gd_resource type="Theme" load_steps=12 format=3 uid="uid://ci2qajdoa1an1"] +[gd_resource type="Theme" load_steps=16 format=3 uid="uid://ci2qajdoa1an1"] [ext_resource type="FontFile" uid="uid://bo4vh5xkpvrh1" path="res://menu/theme/font-sansita-swashed.woff2" id="1_koj1m"] +[ext_resource type="FontFile" uid="uid://5ixo6b3bd3km" path="res://menu/theme/font-josefin-sans.woff2" id="1_tc8bk"] + +[sub_resource type="FontVariation" id="FontVariation_pirkj"] +base_font = ExtResource("1_tc8bk") +variation_embolden = 0.5 + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_xxmhf"] +bg_color = Color(0, 0, 0, 0.305882) + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_3p3im"] +bg_color = Color(0, 0, 0, 0.145098) [sub_resource type="SystemFont" id="SystemFont_3j83h"] @@ -48,6 +59,12 @@ base_font = SubResource("SystemFont_3j83h") variation_embolden = -0.44 [resource] +Button/colors/font_color = Color(0.21875, 0.21875, 0.21875, 1) +Button/fonts/font = SubResource("FontVariation_pirkj") +Button/styles/focus = SubResource("StyleBoxFlat_xxmhf") +Button/styles/hover = SubResource("StyleBoxFlat_3p3im") +Button/styles/normal = SubResource("StyleBoxFlat_xxmhf") +Button/styles/pressed = SubResource("StyleBoxFlat_xxmhf") CheckBox/colors/font_color = Color(0, 0, 0, 1) CheckBox/colors/font_focus_color = Color(0, 0, 0, 1) CheckBox/colors/font_hover_color = Color(0, 0, 0, 1) @@ -69,6 +86,7 @@ LineEdit/colors/font_color = Color(0, 0.0196078, 0.415686, 1) LineEdit/fonts/font = SubResource("FontVariation_cx2xx") LineEdit/styles/focus = SubResource("StyleBoxFlat_huhkg") LineEdit/styles/normal = SubResource("StyleBoxFlat_huhkg") +LineEdit/styles/read_only = SubResource("StyleBoxFlat_huhkg") MarginContainer/constants/margin_bottom = 30 MarginContainer/constants/margin_left = 70 MarginContainer/constants/margin_right = 30 |