diff options
Diffstat (limited to 'client')
-rw-r--r-- | client/game.tscn | 6 | ||||
-rw-r--r-- | client/menu/ingame_menu.gd | 9 | ||||
-rw-r--r-- | client/menu/ingame_menu.tscn | 112 | ||||
-rw-r--r-- | client/menu/main_menu.gd | 3 | ||||
-rw-r--r-- | client/menu/scene_transition.gd | 24 | ||||
-rw-r--r-- | client/menu/scene_transition.tscn | 9 | ||||
-rw-r--r-- | client/project.godot | 5 |
7 files changed, 163 insertions, 5 deletions
diff --git a/client/game.tscn b/client/game.tscn index 34c2fe40..2b9a1b9f 100644 --- a/client/game.tscn +++ b/client/game.tscn @@ -1,9 +1,10 @@ -[gd_scene load_steps=8 format=3 uid="uid://c6krh36hoqfg8"] +[gd_scene load_steps=9 format=3 uid="uid://c6krh36hoqfg8"] [ext_resource type="PackedScene" uid="uid://cs8gxa22c6joh" path="res://map/map.tscn" id="1_ex12v"] [ext_resource type="Script" path="res://game.gd" id="1_sftfn"] [ext_resource type="PackedScene" uid="uid://b31mlnao6ybt8" path="res://player/follow_camera.tscn" id="2_s8y6o"] [ext_resource type="PackedScene" uid="uid://c0euiv7duqfp4" path="res://player/marker.tscn" id="4_igl0o"] +[ext_resource type="PackedScene" uid="uid://bg2d78ycorcqk" path="res://menu/scene_transition.tscn" id="5_yg6cl"] [sub_resource type="PhysicalSkyMaterial" id="PhysicalSkyMaterial_mvn2w"] @@ -30,3 +31,6 @@ transform = Transform3D(1, 0, 0, 0, 0.258819, 0.965926, 0, -0.965926, 0.258819, [node name="Marker" parent="." instance=ExtResource("4_igl0o")] visible = false + +[node name="SceneTransition" parent="." instance=ExtResource("5_yg6cl")] +ingame = true diff --git a/client/menu/ingame_menu.gd b/client/menu/ingame_menu.gd new file mode 100644 index 00000000..7a6d8e1a --- /dev/null +++ b/client/menu/ingame_menu.gd @@ -0,0 +1,9 @@ +extends Control + +@onready var anim = $AnimationPlayer + +func _on_main_menu_pressed(): + get_parent().transition_to("res://menu/main_menu.tscn") + +func _on_quit_pressed(): + get_parent().quit() diff --git a/client/menu/ingame_menu.tscn b/client/menu/ingame_menu.tscn new file mode 100644 index 00000000..641ec0d9 --- /dev/null +++ b/client/menu/ingame_menu.tscn @@ -0,0 +1,112 @@ +[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="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"] + +[sub_resource type="Animation" id="Animation_660jl"] +resource_name = "activate" +tracks/0/type = "bezier" +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/path = NodePath("side:position:x") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/keys = { +"handle_modes": PackedInt32Array(0, 0), +"points": PackedFloat32Array(-400, -0.25, 0, 0.25, 0, 0, -0.25, 0, 0.25, 0), +"times": PackedFloat32Array(0, 1) +} + +[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/interp = 1 +tracks/0/loop_wrap = true +tracks/0/keys = { +"handle_modes": PackedInt32Array(0), +"points": PackedFloat32Array(-400, -0.25, 0, 0.25, 0), +"times": PackedFloat32Array(0) +} + +[sub_resource type="AnimationLibrary" id="AnimationLibrary_u0kyp"] +_data = { +"RESET": SubResource("Animation_8sedy"), +"activate": SubResource("Animation_660jl") +} + +[sub_resource type="ShaderMaterial" id="ShaderMaterial_o2vtr"] +shader = ExtResource("1_o42mc") +shader_parameter/blur_amount = 3.5 +shader_parameter/mix_amount = 0.3 +shader_parameter/color_over = null + +[sub_resource type="FontVariation" id="FontVariation_ud3l8"] +base_font = ExtResource("2_4u0ox") +variation_embolden = 0.5 + +[node name="IngameMenu" 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_tm331") +script = ExtResource("1_gd1i3") + +[node name="AnimationPlayer" type="AnimationPlayer" parent="."] +libraries = { +"": SubResource("AnimationLibrary_u0kyp") +} +speed_scale = 8.0 + +[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"] +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"] +layout_mode = 2 + +[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) +theme_override_constants/outline_size = 10 +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"] +custom_minimum_size = Vector2(0, 10) +layout_mode = 2 + +[node name="main_menu" type="Button" parent="side/margin/options"] +layout_mode = 2 +text = "Main Menu" +alignment = 0 + +[node name="quit" type="Button" parent="side/margin/options"] +layout_mode = 2 +text = "Quit" +alignment = 0 + +[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"] diff --git a/client/menu/main_menu.gd b/client/menu/main_menu.gd index 1ac80408..e7ffa70a 100644 --- a/client/menu/main_menu.gd +++ b/client/menu/main_menu.gd @@ -25,7 +25,7 @@ func _ready(): quit_button.hide() func _on_quit_pressed(): - get_tree().quit() + $SceneTransition.quit() func _on_credits_pressed(): $SceneTransition.transition_to("res://menu/credits_menu.tscn") @@ -48,7 +48,6 @@ func connect_to(url): Multiplayer.url = url $SceneTransition.transition_to("res://game.tscn") - func _on_change_character_pressed(): $SceneTransition.transition_to("res://menu/character_menu.tscn") diff --git a/client/menu/scene_transition.gd b/client/menu/scene_transition.gd index 8b972c1b..3ab7cdb6 100644 --- a/client/menu/scene_transition.gd +++ b/client/menu/scene_transition.gd @@ -17,12 +17,34 @@ class_name SceneTransition extends ColorRect @onready var anim = $animation +@export var ingame = false func _ready(): self.visible = true anim.play("fade_in") func transition_to(path: String): + await out() + get_tree().change_scene_to_file(path) + +func quit(): + await out() + get_tree().quit() + +func out(): + if menu.visible: + menu.anim.play_backwards("activate") + await menu.anim.animation_finished anim.play("fade_out") await anim.animation_finished - get_tree().change_scene_to_file(path) + +@onready var menu = $IngameMenu +func _process(_delta): + if ingame: + if not menu.visible and Input.is_action_just_pressed("pause"): + menu.visible = true + menu.anim.play("activate") + elif menu.visible and Input.is_action_just_pressed("pause"): + menu.anim.play_backwards("activate") + await menu.anim.animation_finished + menu.visible = false diff --git a/client/menu/scene_transition.tscn b/client/menu/scene_transition.tscn index df21d242..ddfd6238 100644 --- a/client/menu/scene_transition.tscn +++ b/client/menu/scene_transition.tscn @@ -1,6 +1,7 @@ -[gd_scene load_steps=6 format=3 uid="uid://bg2d78ycorcqk"] +[gd_scene load_steps=7 format=3 uid="uid://bg2d78ycorcqk"] [ext_resource type="Script" path="res://menu/scene_transition.gd" id="1_fpbwj"] +[ext_resource type="PackedScene" uid="uid://lxlgtjm8hw7v" path="res://menu/ingame_menu.tscn" id="2_aqaj2"] [sub_resource type="Animation" id="Animation_xgn2a"] length = 0.001 @@ -69,3 +70,9 @@ libraries = { "": SubResource("AnimationLibrary_pea72") } speed_scale = 4.0 + +[node name="IngameMenu" parent="." instance=ExtResource("2_aqaj2")] +visible = false +layout_mode = 1 +offset_right = 2304.0 +offset_bottom = 1296.0 diff --git a/client/project.godot b/client/project.godot index aa024f72..037135f2 100644 --- a/client/project.godot +++ b/client/project.godot @@ -66,6 +66,11 @@ interact={ "events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":32,"key_label":0,"unicode":32,"echo":false,"script":null) ] } +pause={ +"deadzone": 0.5, +"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194305,"key_label":0,"unicode":0,"echo":false,"script":null) +] +} [internationalization] |