aboutsummaryrefslogtreecommitdiff
path: root/client/menu
diff options
context:
space:
mode:
Diffstat (limited to 'client/menu')
-rw-r--r--client/menu/credits_menu.gd19
-rw-r--r--client/menu/credits_menu.tscn83
-rw-r--r--client/menu/main_menu.gd49
-rw-r--r--client/menu/main_menu.tscn89
-rw-r--r--client/menu/menu_background.gd35
-rw-r--r--client/menu/scene_transition.gd28
-rw-r--r--client/menu/scene_transition.tscn71
7 files changed, 374 insertions, 0 deletions
diff --git a/client/menu/credits_menu.gd b/client/menu/credits_menu.gd
new file mode 100644
index 00000000..a48d5461
--- /dev/null
+++ b/client/menu/credits_menu.gd
@@ -0,0 +1,19 @@
+# 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
+
+func _on_back_pressed():
+ $SceneTransition.transition_to("res://scenes/main_menu.tscn")
diff --git a/client/menu/credits_menu.tscn b/client/menu/credits_menu.tscn
new file mode 100644
index 00000000..65035329
--- /dev/null
+++ b/client/menu/credits_menu.tscn
@@ -0,0 +1,83 @@
+[gd_scene load_steps=6 format=3 uid="uid://7mqbxa054bjv"]
+
+[ext_resource type="PackedScene" uid="uid://bgt88u55bndd3" path="res://scenes/menu_background.tscn" id="1_5ay7o"]
+[ext_resource type="Script" path="res://scripts/credits_menu.gd" id="1_igs63"]
+[ext_resource type="PackedScene" uid="uid://ds1njrptrpdco" path="res://scenes/menu_background_scene.tscn" id="2_k0853"]
+[ext_resource type="PackedScene" uid="uid://bg2d78ycorcqk" path="res://scenes/scene_transition.tscn" id="4_fbbdb"]
+
+[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_p2qmw"]
+bg_color = Color(0, 0, 0, 0.576471)
+
+[node name="CreditsMenu" 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_igs63")
+
+[node name="MenuBackground" parent="." instance=ExtResource("1_5ay7o")]
+layout_mode = 1
+script = null
+
+[node name="background_view2" type="SubViewport" parent="MenuBackground"]
+handle_input_locally = false
+size = Vector2i(1152, 648)
+render_target_update_mode = 4
+
+[node name="scene" parent="MenuBackground/background_view2" instance=ExtResource("2_k0853")]
+
+[node name="Panel" type="Panel" parent="."]
+layout_mode = 1
+anchors_preset = 15
+anchor_right = 1.0
+anchor_bottom = 1.0
+grow_horizontal = 2
+grow_vertical = 2
+theme_override_styles/panel = SubResource("StyleBoxFlat_p2qmw")
+
+[node name="RichTextLabel" type="RichTextLabel" parent="Panel"]
+layout_mode = 1
+anchors_preset = 8
+anchor_left = 0.5
+anchor_top = 0.5
+anchor_right = 0.5
+anchor_bottom = 0.5
+offset_left = -222.0
+offset_top = -112.0
+offset_right = 222.0
+offset_bottom = 125.0
+grow_horizontal = 2
+grow_vertical = 2
+bbcode_enabled = true
+text = "[center][b]undercooked - a game about cooking[/b]
+
+by
+
+[b]tpart, nokoe, metamuffin[/b]
+
+using assets from kenney.nl
+
+[/center]"
+
+[node name="back" type="Button" parent="Panel"]
+layout_mode = 1
+anchors_preset = 7
+anchor_left = 0.5
+anchor_top = 1.0
+anchor_right = 0.5
+anchor_bottom = 1.0
+offset_left = -79.0
+offset_top = -65.0
+offset_right = 81.0
+offset_bottom = -34.0
+grow_horizontal = 2
+grow_vertical = 0
+text = "Back"
+
+[node name="SceneTransition" parent="." instance=ExtResource("4_fbbdb")]
+layout_mode = 1
+color = Color(0, 0, 0, 1)
+
+[connection signal="pressed" from="Panel/back" to="." method="_on_back_pressed"]
diff --git a/client/menu/main_menu.gd b/client/menu/main_menu.gd
new file mode 100644
index 00000000..df09cf7f
--- /dev/null
+++ b/client/menu/main_menu.gd
@@ -0,0 +1,49 @@
+# 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
+
+@onready var quick_connect = $side/margin/options/quick_connect
+@onready var quit_button = $side/margin/options/quit
+
+func _ready():
+ quick_connect.grab_focus()
+ if OS.has_feature("web"):
+ quit_button.hide()
+
+func _on_quit_pressed():
+ get_tree().quit()
+
+func _on_credits_pressed():
+ $SceneTransition.transition_to("res://scenes/credits_menu.tscn")
+
+func _on_connect_pressed():
+ connect_to($side/options/connect/uri.text)
+
+func _on_quick_connect_pressed():
+ if OS.has_feature("JavaScript"):
+ connect_to(JavaScriptBridge.eval("""
+ window.location.protocol.endsWith("s:")
+ ? `wss://${window.location.host}/`
+ : `ws://${window.location.hostname}:27032/`
+ """))
+ else:
+ connect_to("wss://undercooked.metamuffin.org/")
+
+func connect_to(url):
+ print("Connecting to %s" % url)
+ Multiplayer.url = url
+ $SceneTransition.transition_to("res://scenes/game.tscn")
diff --git a/client/menu/main_menu.tscn b/client/menu/main_menu.tscn
new file mode 100644
index 00000000..ea9b31fb
--- /dev/null
+++ b/client/menu/main_menu.tscn
@@ -0,0 +1,89 @@
+[gd_scene load_steps=7 format=3 uid="uid://dbj8508whxgwv"]
+
+[ext_resource type="Theme" uid="uid://cnhhreuc4shxv" path="res://scenes/theme.tres" id="1_rmwly"]
+[ext_resource type="Script" path="res://scripts/main_menu.gd" id="2_qot2j"]
+[ext_resource type="PackedScene" uid="uid://bgt88u55bndd3" path="res://scenes/menu_background.tscn" id="3_f3j3x"]
+[ext_resource type="PackedScene" uid="uid://ds1njrptrpdco" path="res://scenes/menu_background_scene.tscn" id="4_ydj5p"]
+[ext_resource type="PackedScene" uid="uid://bg2d78ycorcqk" path="res://scenes/scene_transition.tscn" id="5_651nk"]
+
+[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_d8o0f"]
+bg_color = Color(0, 0, 0, 0.329412)
+
+[node name="MainMenu" type="Control"]
+layout_mode = 3
+anchors_preset = 15
+anchor_right = 1.0
+anchor_bottom = 1.0
+grow_horizontal = 2
+grow_vertical = 2
+theme = ExtResource("1_rmwly")
+script = ExtResource("2_qot2j")
+
+[node name="MenuBackground" parent="." instance=ExtResource("3_f3j3x")]
+layout_mode = 1
+script = null
+
+[node name="background_view2" type="SubViewport" parent="MenuBackground"]
+handle_input_locally = false
+size = Vector2i(1152, 648)
+render_target_update_mode = 4
+
+[node name="scene" parent="MenuBackground/background_view2" instance=ExtResource("4_ydj5p")]
+
+[node name="side" type="PanelContainer" parent="."]
+layout_mode = 1
+anchors_preset = 9
+anchor_bottom = 1.0
+offset_right = 340.0
+grow_vertical = 2
+theme_override_styles/panel = SubResource("StyleBoxFlat_d8o0f")
+
+[node name="options" type="VBoxContainer" parent="side"]
+layout_mode = 2
+
+[node name="quick_connect" type="Button" parent="side/options"]
+layout_mode = 2
+text = "Quick Connect"
+alignment = 0
+
+[node name="connect" type="HBoxContainer" parent="side/options"]
+layout_mode = 2
+
+[node name="uri" type="LineEdit" parent="side/options/connect"]
+layout_mode = 2
+size_flags_horizontal = 3
+placeholder_text = "wss://example.org"
+
+[node name="connect" type="Button" parent="side/options/connect"]
+layout_mode = 2
+text = "Connect"
+
+[node name="change_character" type="Button" parent="side/options"]
+layout_mode = 2
+text = "Select Character (todo)"
+alignment = 0
+
+[node name="settings" type="Button" parent="side/options"]
+layout_mode = 2
+text = "Settings (todo)"
+alignment = 0
+
+[node name="credits" type="Button" parent="side/options"]
+layout_mode = 2
+text = "Credits"
+alignment = 0
+
+[node name="quit" type="Button" parent="side/options"]
+layout_mode = 2
+text = "Quit"
+alignment = 0
+
+[node name="SceneTransition" parent="." instance=ExtResource("5_651nk")]
+layout_mode = 1
+
+[connection signal="pressed" from="side/options/quick_connect" to="." method="_on_quick_connect_pressed"]
+[connection signal="pressed" from="side/options/connect/connect" to="." method="_on_connect_pressed"]
+[connection signal="pressed" from="side/options/change_character" to="." method="_on_credits_pressed"]
+[connection signal="pressed" from="side/options/settings" to="." method="_on_credits_pressed"]
+[connection signal="pressed" from="side/options/credits" to="." method="_on_credits_pressed"]
+[connection signal="pressed" from="side/options/quit" to="." method="_on_quit_pressed"]
diff --git a/client/menu/menu_background.gd b/client/menu/menu_background.gd
new file mode 100644
index 00000000..e5b8ac31
--- /dev/null
+++ b/client/menu/menu_background.gd
@@ -0,0 +1,35 @@
+# 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/>.
+#
+@tool
+extends Node3D
+
+@onready var map = $map
+@onready var voxel_gi: VoxelGI = $VoxelGI
+
+const NULLS = [null,null,null,null]
+const BUCKETS = [[], ["floor","floor","floor","floor","tomato-crate", "raw-steak-crate"], ["table", "chair", "counter"], ["sink", "stove"]]
+
+func _ready():
+ for x in range(-10,11):
+ for y in range(-10,11):
+ var w = exp(-sqrt(x*x+y*y) * 0.15)
+ var k = randf() * w
+ var bucket = BUCKETS[int(floor(k * BUCKETS.size())) % BUCKETS.size()]
+ if bucket.size() == 0: continue
+ var tile = bucket[randi() % bucket.size()]
+ map.update([x,y], tile, NULLS)
+ voxel_gi.bake()
diff --git a/client/menu/scene_transition.gd b/client/menu/scene_transition.gd
new file mode 100644
index 00000000..b5c89579
--- /dev/null
+++ b/client/menu/scene_transition.gd
@@ -0,0 +1,28 @@
+# 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/>.
+#
+class_name SceneTransition
+extends ColorRect
+
+
+@onready var anim = $animation
+
+func _ready():
+ anim.play("fade_in")
+
+func transition_to(path: String):
+ anim.play("fade_out")
+ await anim.animation_finished
+ get_tree().change_scene_to_file(path)
diff --git a/client/menu/scene_transition.tscn b/client/menu/scene_transition.tscn
new file mode 100644
index 00000000..0865dddf
--- /dev/null
+++ b/client/menu/scene_transition.tscn
@@ -0,0 +1,71 @@
+[gd_scene load_steps=6 format=3 uid="uid://bg2d78ycorcqk"]
+
+[ext_resource type="Script" path="res://scripts/scene_transition.gd" id="1_c2vxm"]
+
+[sub_resource type="Animation" id="Animation_xgn2a"]
+length = 0.001
+tracks/0/type = "value"
+tracks/0/imported = false
+tracks/0/enabled = true
+tracks/0/path = NodePath(".:color")
+tracks/0/interp = 1
+tracks/0/loop_wrap = true
+tracks/0/keys = {
+"times": PackedFloat32Array(0),
+"transitions": PackedFloat32Array(1),
+"update": 0,
+"values": [Color(0, 0, 0, 1)]
+}
+
+[sub_resource type="Animation" id="Animation_tglmc"]
+resource_name = "fade_in"
+tracks/0/type = "value"
+tracks/0/imported = false
+tracks/0/enabled = true
+tracks/0/path = NodePath(".:color")
+tracks/0/interp = 1
+tracks/0/loop_wrap = true
+tracks/0/keys = {
+"times": PackedFloat32Array(0, 0.9),
+"transitions": PackedFloat32Array(1, 1),
+"update": 0,
+"values": [Color(0, 0, 0, 1), Color(0, 0, 0, 0)]
+}
+
+[sub_resource type="Animation" id="Animation_egop8"]
+resource_name = "fade_out"
+tracks/0/type = "value"
+tracks/0/imported = false
+tracks/0/enabled = true
+tracks/0/path = NodePath(".:color")
+tracks/0/interp = 1
+tracks/0/loop_wrap = true
+tracks/0/keys = {
+"times": PackedFloat32Array(0, 0.9),
+"transitions": PackedFloat32Array(1, 1),
+"update": 0,
+"values": [Color(0, 0, 0, 0), Color(0, 0, 0, 1)]
+}
+
+[sub_resource type="AnimationLibrary" id="AnimationLibrary_pea72"]
+_data = {
+"RESET": SubResource("Animation_xgn2a"),
+"fade_in": SubResource("Animation_tglmc"),
+"fade_out": SubResource("Animation_egop8")
+}
+
+[node name="SceneTransition" type="ColorRect"]
+anchors_preset = 15
+anchor_right = 1.0
+anchor_bottom = 1.0
+grow_horizontal = 2
+grow_vertical = 2
+mouse_filter = 2
+color = Color(0, 0, 0, 1)
+script = ExtResource("1_c2vxm")
+
+[node name="animation" type="AnimationPlayer" parent="."]
+libraries = {
+"": SubResource("AnimationLibrary_pea72")
+}
+speed_scale = 4.0