From 6efdec681466addf3c203640518bd8db122270db Mon Sep 17 00:00:00 2001 From: metamuffin Date: Fri, 5 Sep 2025 23:05:01 +0200 Subject: refactor scene tree of all overlays to be children of Overlays --- client/gui/overlays/announce_title.gd | 43 ++ client/gui/overlays/announce_title.gd.uid | 1 + client/gui/overlays/announce_title.tscn | 374 ++++++++++++++ client/gui/overlays/chat.gd | 34 ++ client/gui/overlays/chat.gd.uid | 1 + client/gui/overlays/chat.tscn | 39 ++ client/gui/overlays/ingame/announce_title.gd | 42 -- client/gui/overlays/ingame/announce_title.gd.uid | 1 - client/gui/overlays/ingame/chat.gd | 34 -- client/gui/overlays/ingame/chat.gd.uid | 1 - client/gui/overlays/ingame/chat.tscn | 39 -- client/gui/overlays/ingame/score.gd | 68 --- client/gui/overlays/ingame/score.gd.uid | 1 - client/gui/overlays/ingame/score.tscn | 555 --------------------- client/gui/overlays/lobby/lobby.gd | 2 +- client/gui/overlays/overlays.gd | 24 + client/gui/overlays/overlays.gd.uid | 1 + client/gui/overlays/overlays.tscn | 41 ++ client/gui/overlays/pinned_messages.gd | 55 ++ client/gui/overlays/pinned_messages.gd.uid | 1 + client/gui/overlays/pinned_messages.tscn | 22 + client/gui/overlays/popup_message/popup_message.gd | 230 +++++++++ .../overlays/popup_message/popup_message.gd.uid | 1 + .../gui/overlays/popup_message/popup_message.tscn | 164 ++++++ .../gui/overlays/popup_message/server_message.gd | 13 + .../overlays/popup_message/server_message.gd.uid | 1 + .../gui/overlays/popup_message/server_message.tscn | 51 ++ client/gui/overlays/score.gd | 65 +++ client/gui/overlays/score.gd.uid | 1 + client/gui/overlays/score.tscn | 185 +++++++ 30 files changed, 1348 insertions(+), 742 deletions(-) create mode 100644 client/gui/overlays/announce_title.gd create mode 100644 client/gui/overlays/announce_title.gd.uid create mode 100644 client/gui/overlays/announce_title.tscn create mode 100644 client/gui/overlays/chat.gd create mode 100644 client/gui/overlays/chat.gd.uid create mode 100644 client/gui/overlays/chat.tscn delete mode 100644 client/gui/overlays/ingame/announce_title.gd delete mode 100644 client/gui/overlays/ingame/announce_title.gd.uid delete mode 100644 client/gui/overlays/ingame/chat.gd delete mode 100644 client/gui/overlays/ingame/chat.gd.uid delete mode 100644 client/gui/overlays/ingame/chat.tscn delete mode 100644 client/gui/overlays/ingame/score.gd delete mode 100644 client/gui/overlays/ingame/score.gd.uid delete mode 100644 client/gui/overlays/ingame/score.tscn create mode 100644 client/gui/overlays/overlays.gd create mode 100644 client/gui/overlays/overlays.gd.uid create mode 100644 client/gui/overlays/overlays.tscn create mode 100644 client/gui/overlays/pinned_messages.gd create mode 100644 client/gui/overlays/pinned_messages.gd.uid create mode 100644 client/gui/overlays/pinned_messages.tscn create mode 100644 client/gui/overlays/popup_message/popup_message.gd create mode 100644 client/gui/overlays/popup_message/popup_message.gd.uid create mode 100644 client/gui/overlays/popup_message/popup_message.tscn create mode 100644 client/gui/overlays/popup_message/server_message.gd create mode 100644 client/gui/overlays/popup_message/server_message.gd.uid create mode 100644 client/gui/overlays/popup_message/server_message.tscn create mode 100644 client/gui/overlays/score.gd create mode 100644 client/gui/overlays/score.gd.uid create mode 100644 client/gui/overlays/score.tscn (limited to 'client/gui/overlays') diff --git a/client/gui/overlays/announce_title.gd b/client/gui/overlays/announce_title.gd new file mode 100644 index 00000000..66d5434b --- /dev/null +++ b/client/gui/overlays/announce_title.gd @@ -0,0 +1,43 @@ +# Hurry Curry! - a game about cooking +# Copyright (C) 2025 Hurry Curry! contributors +# +# 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 . +# +extends Control +class_name AnnounceTitle + +@onready var init_delay: Timer = $InitialDelay +@onready var prep_timer: Timer = $PreperationTimer +@onready var anim_player: AnimationPlayer = $AnimationPlayer +@onready var label: Label = $Center/Node2D/Label + +func announce_start() -> void: + init_delay.start() + await init_delay.timeout + + Sound.play_game_start() + show() + label.text = tr("c.announce.ready") + anim_player.play("fade_in") + await anim_player.animation_finished + prep_timer.start() + await prep_timer.timeout + anim_player.play("fade_out") + await anim_player.animation_finished + + label.text = tr("c.announce.go") + anim_player.play("fade_in") + await anim_player.animation_finished + anim_player.play("fade_out") + await anim_player.animation_finished + hide() diff --git a/client/gui/overlays/announce_title.gd.uid b/client/gui/overlays/announce_title.gd.uid new file mode 100644 index 00000000..e57b9722 --- /dev/null +++ b/client/gui/overlays/announce_title.gd.uid @@ -0,0 +1 @@ +uid://ci08whhm2ej1m diff --git a/client/gui/overlays/announce_title.tscn b/client/gui/overlays/announce_title.tscn new file mode 100644 index 00000000..79ec11e8 --- /dev/null +++ b/client/gui/overlays/announce_title.tscn @@ -0,0 +1,374 @@ +[gd_scene load_steps=10 format=3 uid="uid://c7pykhpdhgs64"] + +[ext_resource type="Script" uid="uid://ci08whhm2ej1m" path="res://gui/overlays/announce_title.gd" id="1_6bcyw"] +[ext_resource type="FontFile" uid="uid://bo4vh5xkpvrh1" path="res://gui/resources/fonts/font-sansita-swashed.woff2" id="2_037n2"] + +[sub_resource type="FontVariation" id="FontVariation_8f216"] +base_font = ExtResource("2_037n2") +variation_embolden = 0.5 + +[sub_resource type="Animation" id="Animation_owy7i"] +length = 0.001 +tracks/0/type = "bezier" +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/path = NodePath("Center/Node2D:scale:x") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/keys = { +"handle_modes": PackedInt32Array(0), +"points": PackedFloat32Array(1e-05, -0.25, 0, 0.25, 0), +"times": PackedFloat32Array(0) +} +tracks/1/type = "bezier" +tracks/1/imported = false +tracks/1/enabled = true +tracks/1/path = NodePath("Center/Node2D:scale:y") +tracks/1/interp = 1 +tracks/1/loop_wrap = true +tracks/1/keys = { +"handle_modes": PackedInt32Array(0), +"points": PackedFloat32Array(1e-05, -0.25, 0, 0.25, 0), +"times": PackedFloat32Array(0) +} +tracks/2/type = "bezier" +tracks/2/imported = false +tracks/2/enabled = true +tracks/2/path = NodePath("Center/Node2D:modulate:r") +tracks/2/interp = 1 +tracks/2/loop_wrap = true +tracks/2/keys = { +"handle_modes": PackedInt32Array(0), +"points": PackedFloat32Array(1, -0.25, 0, 0.25, 0), +"times": PackedFloat32Array(0) +} +tracks/3/type = "bezier" +tracks/3/imported = false +tracks/3/enabled = true +tracks/3/path = NodePath("Center/Node2D:modulate:g") +tracks/3/interp = 1 +tracks/3/loop_wrap = true +tracks/3/keys = { +"handle_modes": PackedInt32Array(0), +"points": PackedFloat32Array(1, -0.25, 0, 0.25, 0), +"times": PackedFloat32Array(0) +} +tracks/4/type = "bezier" +tracks/4/imported = false +tracks/4/enabled = true +tracks/4/path = NodePath("Center/Node2D:modulate:b") +tracks/4/interp = 1 +tracks/4/loop_wrap = true +tracks/4/keys = { +"handle_modes": PackedInt32Array(0), +"points": PackedFloat32Array(1, -0.25, 0, 0.25, 0), +"times": PackedFloat32Array(0) +} +tracks/5/type = "bezier" +tracks/5/imported = false +tracks/5/enabled = true +tracks/5/path = NodePath("Center/Node2D:modulate:a") +tracks/5/interp = 1 +tracks/5/loop_wrap = true +tracks/5/keys = { +"handle_modes": PackedInt32Array(0), +"points": PackedFloat32Array(0, -0.25, 0, 0.25, 0), +"times": PackedFloat32Array(0) +} + +[sub_resource type="Animation" id="Animation_kmsgw"] +resource_name = "fade_in" +length = 0.5 +tracks/0/type = "bezier" +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/path = NodePath("Center/Node2D:scale:x") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/keys = { +"handle_modes": PackedInt32Array(0, 0), +"points": PackedFloat32Array(1e-05, -0.25, 0, 0.25, 0, 1, -0.25, 0, 0.25, 0), +"times": PackedFloat32Array(0, 0.5) +} +tracks/1/type = "bezier" +tracks/1/imported = false +tracks/1/enabled = true +tracks/1/path = NodePath("Center/Node2D:scale:y") +tracks/1/interp = 1 +tracks/1/loop_wrap = true +tracks/1/keys = { +"handle_modes": PackedInt32Array(0, 0), +"points": PackedFloat32Array(1e-05, -0.25, 0, 0.25, 0, 1, -0.25, 0, 0.25, 0), +"times": PackedFloat32Array(0, 0.5) +} +tracks/2/type = "bezier" +tracks/2/imported = false +tracks/2/enabled = true +tracks/2/path = NodePath("Center/Node2D:modulate:r") +tracks/2/interp = 1 +tracks/2/loop_wrap = true +tracks/2/keys = { +"handle_modes": PackedInt32Array(0, 0), +"points": PackedFloat32Array(1, -0.25, 0, 0.25, 0, 1, -0.25, 0, 0.25, 0), +"times": PackedFloat32Array(0, 0.5) +} +tracks/3/type = "bezier" +tracks/3/imported = false +tracks/3/enabled = true +tracks/3/path = NodePath("Center/Node2D:modulate:g") +tracks/3/interp = 1 +tracks/3/loop_wrap = true +tracks/3/keys = { +"handle_modes": PackedInt32Array(0, 0), +"points": PackedFloat32Array(1, -0.25, 0, 0.25, 0, 1, -0.25, 0, 0.25, 0), +"times": PackedFloat32Array(0, 0.5) +} +tracks/4/type = "bezier" +tracks/4/imported = false +tracks/4/enabled = true +tracks/4/path = NodePath("Center/Node2D:modulate:b") +tracks/4/interp = 1 +tracks/4/loop_wrap = true +tracks/4/keys = { +"handle_modes": PackedInt32Array(0, 0), +"points": PackedFloat32Array(1, -0.25, 0, 0.25, 0, 1, -0.25, 0, 0.25, 0), +"times": PackedFloat32Array(0, 0.5) +} +tracks/5/type = "bezier" +tracks/5/imported = false +tracks/5/enabled = true +tracks/5/path = NodePath("Center/Node2D:modulate:a") +tracks/5/interp = 1 +tracks/5/loop_wrap = true +tracks/5/keys = { +"handle_modes": PackedInt32Array(0, 0), +"points": PackedFloat32Array(0, -0.25, 0, 0.25, 0, 1, -0.25, 0, 0.25, 0), +"times": PackedFloat32Array(0, 0.5) +} + +[sub_resource type="Animation" id="Animation_874f2"] +resource_name = "fade_in_and_out" +length = 0.8 +tracks/0/type = "bezier" +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/path = NodePath("Center/Node2D:modulate:r") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/keys = { +"handle_modes": PackedInt32Array(0, 0, 0), +"points": PackedFloat32Array(1, -0.25, 0, 0.25, 0, 1, -0.25, 0, 0.25, 0, 1, -0.25, 0, 0.25, 0), +"times": PackedFloat32Array(0, 0.3, 0.8) +} +tracks/1/type = "bezier" +tracks/1/imported = false +tracks/1/enabled = true +tracks/1/path = NodePath("Center/Node2D:modulate:g") +tracks/1/interp = 1 +tracks/1/loop_wrap = true +tracks/1/keys = { +"handle_modes": PackedInt32Array(0, 0, 0), +"points": PackedFloat32Array(1, -0.25, 0, 0.25, 0, 1, -0.25, 0, 0.25, 0, 1, -0.25, 0, 0.25, 0), +"times": PackedFloat32Array(0, 0.3, 0.8) +} +tracks/2/type = "bezier" +tracks/2/imported = false +tracks/2/enabled = true +tracks/2/path = NodePath("Center/Node2D:modulate:b") +tracks/2/interp = 1 +tracks/2/loop_wrap = true +tracks/2/keys = { +"handle_modes": PackedInt32Array(0, 0, 0), +"points": PackedFloat32Array(1, -0.25, 0, 0.25, 0, 1, -0.25, 0, 0.25, 0, 1, -0.25, 0, 0.25, 0), +"times": PackedFloat32Array(0, 0.3, 0.8) +} +tracks/3/type = "bezier" +tracks/3/imported = false +tracks/3/enabled = true +tracks/3/path = NodePath("Center/Node2D:modulate:a") +tracks/3/interp = 1 +tracks/3/loop_wrap = true +tracks/3/keys = { +"handle_modes": PackedInt32Array(0, 0, 0), +"points": PackedFloat32Array(0, -0.25, 0, 0.25, 0, 1, -0.25, 0, 0.25, 0, 0, -0.25, 0, 0.25, 0), +"times": PackedFloat32Array(0, 0.3, 0.8) +} +tracks/4/type = "bezier" +tracks/4/imported = false +tracks/4/enabled = true +tracks/4/path = NodePath("Center/Node2D:scale:x") +tracks/4/interp = 1 +tracks/4/loop_wrap = true +tracks/4/keys = { +"handle_modes": PackedInt32Array(0, 0), +"points": PackedFloat32Array(1e-05, -0.25, 0, 0.25, 0, 2, -0.25, 0, 0.25, 0), +"times": PackedFloat32Array(0, 0.8) +} +tracks/5/type = "bezier" +tracks/5/imported = false +tracks/5/enabled = true +tracks/5/path = NodePath("Center/Node2D:scale:y") +tracks/5/interp = 1 +tracks/5/loop_wrap = true +tracks/5/keys = { +"handle_modes": PackedInt32Array(0, 0), +"points": PackedFloat32Array(1e-05, -0.25, 0, 0.25, 0, 2, -0.25, 0, 0.25, 0), +"times": PackedFloat32Array(0, 0.8) +} + +[sub_resource type="Animation" id="Animation_x6gse"] +resource_name = "fade_out" +tracks/0/type = "bezier" +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/path = NodePath("Center/Node2D:modulate:r") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/keys = { +"handle_modes": PackedInt32Array(0, 0), +"points": PackedFloat32Array(1, -0.25, 0, 0.25, 0, 1, -0.25, 0, 0.25, 0), +"times": PackedFloat32Array(0, 1) +} +tracks/1/type = "bezier" +tracks/1/imported = false +tracks/1/enabled = true +tracks/1/path = NodePath("Center/Node2D:modulate:g") +tracks/1/interp = 1 +tracks/1/loop_wrap = true +tracks/1/keys = { +"handle_modes": PackedInt32Array(0, 0), +"points": PackedFloat32Array(1, -0.25, 0, 0.25, 0, 1, -0.25, 0, 0.25, 0), +"times": PackedFloat32Array(0, 1) +} +tracks/2/type = "bezier" +tracks/2/imported = false +tracks/2/enabled = true +tracks/2/path = NodePath("Center/Node2D:modulate:b") +tracks/2/interp = 1 +tracks/2/loop_wrap = true +tracks/2/keys = { +"handle_modes": PackedInt32Array(0, 0), +"points": PackedFloat32Array(1, -0.25, 0, 0.25, 0, 1, -0.25, 0, 0.25, 0), +"times": PackedFloat32Array(0, 1) +} +tracks/3/type = "bezier" +tracks/3/imported = false +tracks/3/enabled = true +tracks/3/path = NodePath("Center/Node2D:modulate:a") +tracks/3/interp = 1 +tracks/3/loop_wrap = true +tracks/3/keys = { +"handle_modes": PackedInt32Array(0, 0), +"points": PackedFloat32Array(1, -0.25, 0, 0.25, 0, 0, -0.25, 0, 0.25, 0), +"times": PackedFloat32Array(0, 1) +} + +[sub_resource type="Animation" id="Animation_deqe4"] +resource_name = "fade_out_quick" +length = 0.25 +tracks/0/type = "bezier" +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/path = NodePath("Center/Node2D:modulate:r") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/keys = { +"handle_modes": PackedInt32Array(0, 0), +"points": PackedFloat32Array(1, -0.125, 0, 0.125, 0, 1, -0.125, 0, 0.125, 0), +"times": PackedFloat32Array(0, 0.25) +} +tracks/1/type = "bezier" +tracks/1/imported = false +tracks/1/enabled = true +tracks/1/path = NodePath("Center/Node2D:modulate:g") +tracks/1/interp = 1 +tracks/1/loop_wrap = true +tracks/1/keys = { +"handle_modes": PackedInt32Array(0, 0), +"points": PackedFloat32Array(1, -0.125, 0, 0.125, 0, 1, -0.125, 0, 0.125, 0), +"times": PackedFloat32Array(0, 0.25) +} +tracks/2/type = "bezier" +tracks/2/imported = false +tracks/2/enabled = true +tracks/2/path = NodePath("Center/Node2D:modulate:b") +tracks/2/interp = 1 +tracks/2/loop_wrap = true +tracks/2/keys = { +"handle_modes": PackedInt32Array(0, 0), +"points": PackedFloat32Array(1, -0.125, 0, 0.125, 0, 1, -0.125, 0, 0.125, 0), +"times": PackedFloat32Array(0, 0.25) +} +tracks/3/type = "bezier" +tracks/3/imported = false +tracks/3/enabled = true +tracks/3/path = NodePath("Center/Node2D:modulate:a") +tracks/3/interp = 1 +tracks/3/loop_wrap = true +tracks/3/keys = { +"handle_modes": PackedInt32Array(0, 0), +"points": PackedFloat32Array(1, -0.125, 0, 0.125, 0, 0, -0.125, 0, 0.125, 0), +"times": PackedFloat32Array(0, 0.25) +} + +[sub_resource type="AnimationLibrary" id="AnimationLibrary_deqe4"] +_data = { +&"RESET": SubResource("Animation_owy7i"), +&"fade_in": SubResource("Animation_kmsgw"), +&"fade_in_and_out": SubResource("Animation_874f2"), +&"fade_out": SubResource("Animation_x6gse"), +&"fade_out_quick": SubResource("Animation_deqe4") +} + +[node name="AnnounceTitle" type="Control"] +visible = false +layout_mode = 3 +anchors_preset = 0 +script = ExtResource("1_6bcyw") + +[node name="Center" type="Control" parent="."] +layout_mode = 1 +anchors_preset = 8 +anchor_left = 0.5 +anchor_top = 0.5 +anchor_right = 0.5 +anchor_bottom = 0.5 +grow_horizontal = 2 +grow_vertical = 2 + +[node name="Node2D" type="Node2D" parent="Center"] +modulate = Color(1, 1, 1, 0) +scale = Vector2(1e-05, 1e-05) + +[node name="Label" type="Label" parent="Center/Node2D"] +anchors_preset = 8 +anchor_left = 0.5 +anchor_top = 0.5 +anchor_right = 0.5 +anchor_bottom = 0.5 +offset_left = -375.0 +offset_top = -50.0 +offset_right = 375.0 +offset_bottom = 50.0 +grow_horizontal = 2 +grow_vertical = 2 +size_flags_vertical = 1 +theme_override_colors/font_outline_color = Color(0.564706, 0.207843, 0.266667, 1) +theme_override_constants/outline_size = 20 +theme_override_fonts/font = SubResource("FontVariation_8f216") +theme_override_font_sizes/font_size = 64 +text = "GO!" +horizontal_alignment = 1 +vertical_alignment = 1 + +[node name="AnimationPlayer" type="AnimationPlayer" parent="."] +libraries = { +&"": SubResource("AnimationLibrary_deqe4") +} + +[node name="PreperationTimer" type="Timer" parent="."] +one_shot = true + +[node name="InitialDelay" type="Timer" parent="."] +wait_time = 0.5 +one_shot = true diff --git a/client/gui/overlays/chat.gd b/client/gui/overlays/chat.gd new file mode 100644 index 00000000..676337a6 --- /dev/null +++ b/client/gui/overlays/chat.gd @@ -0,0 +1,34 @@ +# Hurry Curry! - a game about cooking +# Copyright (C) 2025 Hurry Curry! contributors +# +# 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 . +# +extends Control +class_name ChatPreview + +const CHAT_MESSAGE_SCENE = preload("res://gui/components/message/chat_message.tscn") + +@onready var game: Game = $"../../Game" # TODO +@onready var messages_container: VBoxContainer = $MarginContainer/ScrollContainer/PanelContainer/Messages + +func _ready(): + game.text_message.connect(func(message: Game.TextMessage): + var chat_message: ChatMessage = CHAT_MESSAGE_SCENE.instantiate() + messages_container.add_child(chat_message) + chat_message.set_message( + message.username, + message.text, + message.color, + true, + message.timeout_remaining) + ) diff --git a/client/gui/overlays/chat.gd.uid b/client/gui/overlays/chat.gd.uid new file mode 100644 index 00000000..7a372630 --- /dev/null +++ b/client/gui/overlays/chat.gd.uid @@ -0,0 +1 @@ +uid://bgt04y4ncl1fv diff --git a/client/gui/overlays/chat.tscn b/client/gui/overlays/chat.tscn new file mode 100644 index 00000000..068d0ee4 --- /dev/null +++ b/client/gui/overlays/chat.tscn @@ -0,0 +1,39 @@ +[gd_scene load_steps=5 format=3 uid="uid://xcxbmynn8mhi"] + +[ext_resource type="Theme" uid="uid://b0qmvo504e457" path="res://gui/resources/theme/theme.tres" id="1_lmy51"] +[ext_resource type="Script" uid="uid://bgt04y4ncl1fv" path="res://gui/overlays/chat.gd" id="2_3543w"] +[ext_resource type="Material" uid="uid://beea1pc5nt67r" path="res://gui/resources/materials/dark_blur_material.tres" id="3_15i2y"] +[ext_resource type="Script" uid="uid://cmncjc06kadpe" path="res://gui/components/blur_setup.gd" id="4_3rmhr"] + +[node name="ChatPreview" type="Control"] +layout_mode = 3 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +mouse_filter = 2 +theme = ExtResource("1_lmy51") +script = ExtResource("2_3543w") + +[node name="MarginContainer" type="MarginContainer" parent="."] +layout_mode = 2 +anchor_bottom = 1.0 +offset_right = 296.0 +grow_vertical = 2 + +[node name="ScrollContainer" type="ScrollContainer" parent="MarginContainer"] +layout_mode = 2 +horizontal_scroll_mode = 0 + +[node name="PanelContainer" type="PanelContainer" parent="MarginContainer/ScrollContainer"] +material = ExtResource("3_15i2y") +layout_mode = 2 +size_flags_horizontal = 3 +size_flags_vertical = 0 +mouse_filter = 2 +script = ExtResource("4_3rmhr") + +[node name="Messages" type="VBoxContainer" parent="MarginContainer/ScrollContainer/PanelContainer"] +layout_mode = 2 +mouse_filter = 2 diff --git a/client/gui/overlays/ingame/announce_title.gd b/client/gui/overlays/ingame/announce_title.gd deleted file mode 100644 index 227e184f..00000000 --- a/client/gui/overlays/ingame/announce_title.gd +++ /dev/null @@ -1,42 +0,0 @@ -# Hurry Curry! - a game about cooking -# Copyright (C) 2025 Hurry Curry! contributors -# -# 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 . -# -extends Control - -@onready var init_delay: Timer = $InitialDelay -@onready var prep_timer: Timer = $PreperationTimer -@onready var anim_player: AnimationPlayer = $AnimationPlayer -@onready var label: Label = $Center/Node2D/Label - -func announce_start() -> void: - init_delay.start() - await init_delay.timeout - - Sound.play_game_start() - show() - label.text = tr("c.announce.ready") - anim_player.play("fade_in") - await anim_player.animation_finished - prep_timer.start() - await prep_timer.timeout - anim_player.play("fade_out") - await anim_player.animation_finished - - label.text = tr("c.announce.go") - anim_player.play("fade_in") - await anim_player.animation_finished - anim_player.play("fade_out") - await anim_player.animation_finished - hide() diff --git a/client/gui/overlays/ingame/announce_title.gd.uid b/client/gui/overlays/ingame/announce_title.gd.uid deleted file mode 100644 index e57b9722..00000000 --- a/client/gui/overlays/ingame/announce_title.gd.uid +++ /dev/null @@ -1 +0,0 @@ -uid://ci08whhm2ej1m diff --git a/client/gui/overlays/ingame/chat.gd b/client/gui/overlays/ingame/chat.gd deleted file mode 100644 index 673dc979..00000000 --- a/client/gui/overlays/ingame/chat.gd +++ /dev/null @@ -1,34 +0,0 @@ -# Hurry Curry! - a game about cooking -# Copyright (C) 2025 Hurry Curry! contributors -# -# 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 . -# -extends Control -class_name ChatPreview - -const CHAT_MESSAGE_SCENE = preload("res://gui/components/message/chat_message.tscn") - -@onready var game: Game = $"../Game" -@onready var messages_container: VBoxContainer = $MarginContainer/ScrollContainer/PanelContainer/Messages - -func _ready(): - game.text_message.connect(func(message: Game.TextMessage): - var chat_message: ChatMessage = CHAT_MESSAGE_SCENE.instantiate() - messages_container.add_child(chat_message) - chat_message.set_message( - message.username, - message.text, - message.color, - true, - message.timeout_remaining) - ) diff --git a/client/gui/overlays/ingame/chat.gd.uid b/client/gui/overlays/ingame/chat.gd.uid deleted file mode 100644 index 7a372630..00000000 --- a/client/gui/overlays/ingame/chat.gd.uid +++ /dev/null @@ -1 +0,0 @@ -uid://bgt04y4ncl1fv diff --git a/client/gui/overlays/ingame/chat.tscn b/client/gui/overlays/ingame/chat.tscn deleted file mode 100644 index f5b1060c..00000000 --- a/client/gui/overlays/ingame/chat.tscn +++ /dev/null @@ -1,39 +0,0 @@ -[gd_scene load_steps=5 format=3 uid="uid://xcxbmynn8mhi"] - -[ext_resource type="Theme" uid="uid://b0qmvo504e457" path="res://gui/resources/theme/theme.tres" id="1_lmy51"] -[ext_resource type="Script" uid="uid://bgt04y4ncl1fv" path="res://gui/overlays/ingame/chat.gd" id="2_3543w"] -[ext_resource type="Material" uid="uid://beea1pc5nt67r" path="res://gui/resources/materials/dark_blur_material.tres" id="3_15i2y"] -[ext_resource type="Script" uid="uid://cmncjc06kadpe" path="res://gui/components/blur_setup.gd" id="4_3rmhr"] - -[node name="ChatPreview" type="Control"] -layout_mode = 3 -anchors_preset = 15 -anchor_right = 1.0 -anchor_bottom = 1.0 -grow_horizontal = 2 -grow_vertical = 2 -mouse_filter = 2 -theme = ExtResource("1_lmy51") -script = ExtResource("2_3543w") - -[node name="MarginContainer" type="MarginContainer" parent="."] -layout_mode = 2 -anchor_bottom = 1.0 -offset_right = 296.0 -grow_vertical = 2 - -[node name="ScrollContainer" type="ScrollContainer" parent="MarginContainer"] -layout_mode = 2 -horizontal_scroll_mode = 0 - -[node name="PanelContainer" type="PanelContainer" parent="MarginContainer/ScrollContainer"] -material = ExtResource("3_15i2y") -layout_mode = 2 -size_flags_horizontal = 3 -size_flags_vertical = 0 -mouse_filter = 2 -script = ExtResource("4_3rmhr") - -[node name="Messages" type="VBoxContainer" parent="MarginContainer/ScrollContainer/PanelContainer"] -layout_mode = 2 -mouse_filter = 2 diff --git a/client/gui/overlays/ingame/score.gd b/client/gui/overlays/ingame/score.gd deleted file mode 100644 index d4e2e3d3..00000000 --- a/client/gui/overlays/ingame/score.gd +++ /dev/null @@ -1,68 +0,0 @@ -# Hurry Curry! - a game about cooking -# Copyright (C) 2025 Hurry Curry! contributors -# -# 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 . -# -class_name Overlay -extends PanelContainer - -const LABEL_SCALE: Vector2 = Vector2(1.5, 1.5) - -var failed: int = 0 -var completed: int = 0 -var points: int = 0 - -@onready var failed_label: Label = $Score/Paper/Margin/Lines/Line2/Failed -@onready var completed_label: Label = $Score/Paper/Margin/Lines/Line1/Completed -@onready var points_label: Label = $Score/Paper/Margin/Lines/Line3/Points -@onready var timer: Timer = $Timer -@onready var seconds_label: Label = $Time/Paper/Line/Seconds -@onready var decimals_label: Label = $Time/Paper/Line/Decimals -@onready var announcement = $Announcement - -func update(failed_: int, completed_: int, points_: int, time: float): - if failed_ - failed: - failed_label.text = str(failed_) - failed_label.scale = LABEL_SCALE - failed = failed_ - if completed_ - completed: - completed_label.text = str(completed_) - completed_label.scale = LABEL_SCALE - completed = completed_ - if points_ - points: - points_label.text = str(points_) - points_label.scale = LABEL_SCALE - points = points_ - - timer.stop() - if time > 0.: - timer.wait_time = time - timer.start() - -func set_ingame(_state: bool, lobby: bool): - if lobby: - hide() - timer.stop() - else: - show() - -func announce_start(): - announcement.announce_start() - -func _process(delta): - failed_label.scale = G.interpolate(failed_label.scale, Vector2(1, 1), delta * 4.) - completed_label.scale = G.interpolate(completed_label.scale, Vector2(1, 1), delta * 4.) - points_label.scale = G.interpolate(points_label.scale, Vector2(1, 1), delta * 4.) - var seconds: float = floor(timer.time_left) - seconds_label.text = str(int(seconds)) - decimals_label.text = "%01d" % int((timer.time_left - seconds) * 10) diff --git a/client/gui/overlays/ingame/score.gd.uid b/client/gui/overlays/ingame/score.gd.uid deleted file mode 100644 index ff13fb53..00000000 --- a/client/gui/overlays/ingame/score.gd.uid +++ /dev/null @@ -1 +0,0 @@ -uid://mcgg3q0l03dx diff --git a/client/gui/overlays/ingame/score.tscn b/client/gui/overlays/ingame/score.tscn deleted file mode 100644 index 497275f5..00000000 --- a/client/gui/overlays/ingame/score.tscn +++ /dev/null @@ -1,555 +0,0 @@ -[gd_scene load_steps=14 format=3 uid="uid://bpikve6wlsjfl"] - -[ext_resource type="Theme" uid="uid://b0qmvo504e457" path="res://gui/resources/theme/theme.tres" id="1_4kujw"] -[ext_resource type="Script" uid="uid://mcgg3q0l03dx" path="res://gui/overlays/ingame/score.gd" id="2_kbjds"] -[ext_resource type="Texture2D" uid="uid://chxkwohi56cxx" path="res://gui/resources/shaders/paper.tres" id="3_oum5g"] -[ext_resource type="FontFile" uid="uid://bo4vh5xkpvrh1" path="res://gui/resources/fonts/font-sansita-swashed.woff2" id="3_u54fv"] -[ext_resource type="Script" uid="uid://ci08whhm2ej1m" path="res://gui/overlays/ingame/announce_title.gd" id="5_874f2"] - -[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_04ujj"] -bg_color = Color(0, 0, 0, 0) - -[sub_resource type="FontVariation" id="FontVariation_8f216"] -base_font = ExtResource("3_u54fv") -variation_embolden = 0.5 - -[sub_resource type="Animation" id="Animation_owy7i"] -length = 0.001 -tracks/0/type = "bezier" -tracks/0/imported = false -tracks/0/enabled = true -tracks/0/path = NodePath("Center/Node2D:scale:x") -tracks/0/interp = 1 -tracks/0/loop_wrap = true -tracks/0/keys = { -"handle_modes": PackedInt32Array(0), -"points": PackedFloat32Array(1e-05, -0.25, 0, 0.25, 0), -"times": PackedFloat32Array(0) -} -tracks/1/type = "bezier" -tracks/1/imported = false -tracks/1/enabled = true -tracks/1/path = NodePath("Center/Node2D:scale:y") -tracks/1/interp = 1 -tracks/1/loop_wrap = true -tracks/1/keys = { -"handle_modes": PackedInt32Array(0), -"points": PackedFloat32Array(1e-05, -0.25, 0, 0.25, 0), -"times": PackedFloat32Array(0) -} -tracks/2/type = "bezier" -tracks/2/imported = false -tracks/2/enabled = true -tracks/2/path = NodePath("Center/Node2D:modulate:r") -tracks/2/interp = 1 -tracks/2/loop_wrap = true -tracks/2/keys = { -"handle_modes": PackedInt32Array(0), -"points": PackedFloat32Array(1, -0.25, 0, 0.25, 0), -"times": PackedFloat32Array(0) -} -tracks/3/type = "bezier" -tracks/3/imported = false -tracks/3/enabled = true -tracks/3/path = NodePath("Center/Node2D:modulate:g") -tracks/3/interp = 1 -tracks/3/loop_wrap = true -tracks/3/keys = { -"handle_modes": PackedInt32Array(0), -"points": PackedFloat32Array(1, -0.25, 0, 0.25, 0), -"times": PackedFloat32Array(0) -} -tracks/4/type = "bezier" -tracks/4/imported = false -tracks/4/enabled = true -tracks/4/path = NodePath("Center/Node2D:modulate:b") -tracks/4/interp = 1 -tracks/4/loop_wrap = true -tracks/4/keys = { -"handle_modes": PackedInt32Array(0), -"points": PackedFloat32Array(1, -0.25, 0, 0.25, 0), -"times": PackedFloat32Array(0) -} -tracks/5/type = "bezier" -tracks/5/imported = false -tracks/5/enabled = true -tracks/5/path = NodePath("Center/Node2D:modulate:a") -tracks/5/interp = 1 -tracks/5/loop_wrap = true -tracks/5/keys = { -"handle_modes": PackedInt32Array(0), -"points": PackedFloat32Array(0, -0.25, 0, 0.25, 0), -"times": PackedFloat32Array(0) -} - -[sub_resource type="Animation" id="Animation_kmsgw"] -resource_name = "fade_in" -length = 0.5 -tracks/0/type = "bezier" -tracks/0/imported = false -tracks/0/enabled = true -tracks/0/path = NodePath("Center/Node2D:scale:x") -tracks/0/interp = 1 -tracks/0/loop_wrap = true -tracks/0/keys = { -"handle_modes": PackedInt32Array(0, 0), -"points": PackedFloat32Array(1e-05, -0.25, 0, 0.25, 0, 1, -0.25, 0, 0.25, 0), -"times": PackedFloat32Array(0, 0.5) -} -tracks/1/type = "bezier" -tracks/1/imported = false -tracks/1/enabled = true -tracks/1/path = NodePath("Center/Node2D:scale:y") -tracks/1/interp = 1 -tracks/1/loop_wrap = true -tracks/1/keys = { -"handle_modes": PackedInt32Array(0, 0), -"points": PackedFloat32Array(1e-05, -0.25, 0, 0.25, 0, 1, -0.25, 0, 0.25, 0), -"times": PackedFloat32Array(0, 0.5) -} -tracks/2/type = "bezier" -tracks/2/imported = false -tracks/2/enabled = true -tracks/2/path = NodePath("Center/Node2D:modulate:r") -tracks/2/interp = 1 -tracks/2/loop_wrap = true -tracks/2/keys = { -"handle_modes": PackedInt32Array(0, 0), -"points": PackedFloat32Array(1, -0.25, 0, 0.25, 0, 1, -0.25, 0, 0.25, 0), -"times": PackedFloat32Array(0, 0.5) -} -tracks/3/type = "bezier" -tracks/3/imported = false -tracks/3/enabled = true -tracks/3/path = NodePath("Center/Node2D:modulate:g") -tracks/3/interp = 1 -tracks/3/loop_wrap = true -tracks/3/keys = { -"handle_modes": PackedInt32Array(0, 0), -"points": PackedFloat32Array(1, -0.25, 0, 0.25, 0, 1, -0.25, 0, 0.25, 0), -"times": PackedFloat32Array(0, 0.5) -} -tracks/4/type = "bezier" -tracks/4/imported = false -tracks/4/enabled = true -tracks/4/path = NodePath("Center/Node2D:modulate:b") -tracks/4/interp = 1 -tracks/4/loop_wrap = true -tracks/4/keys = { -"handle_modes": PackedInt32Array(0, 0), -"points": PackedFloat32Array(1, -0.25, 0, 0.25, 0, 1, -0.25, 0, 0.25, 0), -"times": PackedFloat32Array(0, 0.5) -} -tracks/5/type = "bezier" -tracks/5/imported = false -tracks/5/enabled = true -tracks/5/path = NodePath("Center/Node2D:modulate:a") -tracks/5/interp = 1 -tracks/5/loop_wrap = true -tracks/5/keys = { -"handle_modes": PackedInt32Array(0, 0), -"points": PackedFloat32Array(0, -0.25, 0, 0.25, 0, 1, -0.25, 0, 0.25, 0), -"times": PackedFloat32Array(0, 0.5) -} - -[sub_resource type="Animation" id="Animation_874f2"] -resource_name = "fade_in_and_out" -length = 0.8 -tracks/0/type = "bezier" -tracks/0/imported = false -tracks/0/enabled = true -tracks/0/path = NodePath("Center/Node2D:modulate:r") -tracks/0/interp = 1 -tracks/0/loop_wrap = true -tracks/0/keys = { -"handle_modes": PackedInt32Array(0, 0, 0), -"points": PackedFloat32Array(1, -0.25, 0, 0.25, 0, 1, -0.25, 0, 0.25, 0, 1, -0.25, 0, 0.25, 0), -"times": PackedFloat32Array(0, 0.3, 0.8) -} -tracks/1/type = "bezier" -tracks/1/imported = false -tracks/1/enabled = true -tracks/1/path = NodePath("Center/Node2D:modulate:g") -tracks/1/interp = 1 -tracks/1/loop_wrap = true -tracks/1/keys = { -"handle_modes": PackedInt32Array(0, 0, 0), -"points": PackedFloat32Array(1, -0.25, 0, 0.25, 0, 1, -0.25, 0, 0.25, 0, 1, -0.25, 0, 0.25, 0), -"times": PackedFloat32Array(0, 0.3, 0.8) -} -tracks/2/type = "bezier" -tracks/2/imported = false -tracks/2/enabled = true -tracks/2/path = NodePath("Center/Node2D:modulate:b") -tracks/2/interp = 1 -tracks/2/loop_wrap = true -tracks/2/keys = { -"handle_modes": PackedInt32Array(0, 0, 0), -"points": PackedFloat32Array(1, -0.25, 0, 0.25, 0, 1, -0.25, 0, 0.25, 0, 1, -0.25, 0, 0.25, 0), -"times": PackedFloat32Array(0, 0.3, 0.8) -} -tracks/3/type = "bezier" -tracks/3/imported = false -tracks/3/enabled = true -tracks/3/path = NodePath("Center/Node2D:modulate:a") -tracks/3/interp = 1 -tracks/3/loop_wrap = true -tracks/3/keys = { -"handle_modes": PackedInt32Array(0, 0, 0), -"points": PackedFloat32Array(0, -0.25, 0, 0.25, 0, 1, -0.25, 0, 0.25, 0, 0, -0.25, 0, 0.25, 0), -"times": PackedFloat32Array(0, 0.3, 0.8) -} -tracks/4/type = "bezier" -tracks/4/imported = false -tracks/4/enabled = true -tracks/4/path = NodePath("Center/Node2D:scale:x") -tracks/4/interp = 1 -tracks/4/loop_wrap = true -tracks/4/keys = { -"handle_modes": PackedInt32Array(0, 0), -"points": PackedFloat32Array(1e-05, -0.25, 0, 0.25, 0, 2, -0.25, 0, 0.25, 0), -"times": PackedFloat32Array(0, 0.8) -} -tracks/5/type = "bezier" -tracks/5/imported = false -tracks/5/enabled = true -tracks/5/path = NodePath("Center/Node2D:scale:y") -tracks/5/interp = 1 -tracks/5/loop_wrap = true -tracks/5/keys = { -"handle_modes": PackedInt32Array(0, 0), -"points": PackedFloat32Array(1e-05, -0.25, 0, 0.25, 0, 2, -0.25, 0, 0.25, 0), -"times": PackedFloat32Array(0, 0.8) -} - -[sub_resource type="Animation" id="Animation_x6gse"] -resource_name = "fade_out" -tracks/0/type = "bezier" -tracks/0/imported = false -tracks/0/enabled = true -tracks/0/path = NodePath("Center/Node2D:modulate:r") -tracks/0/interp = 1 -tracks/0/loop_wrap = true -tracks/0/keys = { -"handle_modes": PackedInt32Array(0, 0), -"points": PackedFloat32Array(1, -0.25, 0, 0.25, 0, 1, -0.25, 0, 0.25, 0), -"times": PackedFloat32Array(0, 1) -} -tracks/1/type = "bezier" -tracks/1/imported = false -tracks/1/enabled = true -tracks/1/path = NodePath("Center/Node2D:modulate:g") -tracks/1/interp = 1 -tracks/1/loop_wrap = true -tracks/1/keys = { -"handle_modes": PackedInt32Array(0, 0), -"points": PackedFloat32Array(1, -0.25, 0, 0.25, 0, 1, -0.25, 0, 0.25, 0), -"times": PackedFloat32Array(0, 1) -} -tracks/2/type = "bezier" -tracks/2/imported = false -tracks/2/enabled = true -tracks/2/path = NodePath("Center/Node2D:modulate:b") -tracks/2/interp = 1 -tracks/2/loop_wrap = true -tracks/2/keys = { -"handle_modes": PackedInt32Array(0, 0), -"points": PackedFloat32Array(1, -0.25, 0, 0.25, 0, 1, -0.25, 0, 0.25, 0), -"times": PackedFloat32Array(0, 1) -} -tracks/3/type = "bezier" -tracks/3/imported = false -tracks/3/enabled = true -tracks/3/path = NodePath("Center/Node2D:modulate:a") -tracks/3/interp = 1 -tracks/3/loop_wrap = true -tracks/3/keys = { -"handle_modes": PackedInt32Array(0, 0), -"points": PackedFloat32Array(1, -0.25, 0, 0.25, 0, 0, -0.25, 0, 0.25, 0), -"times": PackedFloat32Array(0, 1) -} - -[sub_resource type="Animation" id="Animation_deqe4"] -resource_name = "fade_out_quick" -length = 0.25 -tracks/0/type = "bezier" -tracks/0/imported = false -tracks/0/enabled = true -tracks/0/path = NodePath("Center/Node2D:modulate:r") -tracks/0/interp = 1 -tracks/0/loop_wrap = true -tracks/0/keys = { -"handle_modes": PackedInt32Array(0, 0), -"points": PackedFloat32Array(1, -0.125, 0, 0.125, 0, 1, -0.125, 0, 0.125, 0), -"times": PackedFloat32Array(0, 0.25) -} -tracks/1/type = "bezier" -tracks/1/imported = false -tracks/1/enabled = true -tracks/1/path = NodePath("Center/Node2D:modulate:g") -tracks/1/interp = 1 -tracks/1/loop_wrap = true -tracks/1/keys = { -"handle_modes": PackedInt32Array(0, 0), -"points": PackedFloat32Array(1, -0.125, 0, 0.125, 0, 1, -0.125, 0, 0.125, 0), -"times": PackedFloat32Array(0, 0.25) -} -tracks/2/type = "bezier" -tracks/2/imported = false -tracks/2/enabled = true -tracks/2/path = NodePath("Center/Node2D:modulate:b") -tracks/2/interp = 1 -tracks/2/loop_wrap = true -tracks/2/keys = { -"handle_modes": PackedInt32Array(0, 0), -"points": PackedFloat32Array(1, -0.125, 0, 0.125, 0, 1, -0.125, 0, 0.125, 0), -"times": PackedFloat32Array(0, 0.25) -} -tracks/3/type = "bezier" -tracks/3/imported = false -tracks/3/enabled = true -tracks/3/path = NodePath("Center/Node2D:modulate:a") -tracks/3/interp = 1 -tracks/3/loop_wrap = true -tracks/3/keys = { -"handle_modes": PackedInt32Array(0, 0), -"points": PackedFloat32Array(1, -0.125, 0, 0.125, 0, 0, -0.125, 0, 0.125, 0), -"times": PackedFloat32Array(0, 0.25) -} - -[sub_resource type="AnimationLibrary" id="AnimationLibrary_deqe4"] -_data = { -&"RESET": SubResource("Animation_owy7i"), -&"fade_in": SubResource("Animation_kmsgw"), -&"fade_in_and_out": SubResource("Animation_874f2"), -&"fade_out": SubResource("Animation_x6gse"), -&"fade_out_quick": SubResource("Animation_deqe4") -} - -[node name="Overlay" type="PanelContainer"] -layout_direction = 2 -anchors_preset = 15 -anchor_right = 1.0 -anchor_bottom = 1.0 -grow_horizontal = 2 -grow_vertical = 2 -mouse_filter = 2 -theme = ExtResource("1_4kujw") -theme_override_styles/panel = SubResource("StyleBoxFlat_04ujj") -script = ExtResource("2_kbjds") - -[node name="Timer" type="Timer" parent="."] -wait_time = 30.0 - -[node name="Score" type="Control" parent="."] -layout_mode = 2 -size_flags_horizontal = 8 -size_flags_vertical = 0 - -[node name="Paper" type="TextureRect" parent="Score"] -layout_mode = 1 -anchors_preset = 8 -anchor_left = 0.5 -anchor_top = 0.5 -anchor_right = 0.5 -anchor_bottom = 0.5 -offset_left = -242.0 -offset_top = -327.0 -offset_right = 270.0 -offset_bottom = 185.0 -grow_horizontal = 2 -grow_vertical = 2 -rotation = 0.0610865 -texture = ExtResource("3_oum5g") - -[node name="Margin" type="MarginContainer" parent="Score/Paper"] -layout_mode = 1 -anchors_preset = 2 -anchor_top = 1.0 -anchor_bottom = 1.0 -offset_top = -142.0 -offset_right = 258.0 -grow_vertical = 0 -theme_override_constants/margin_left = 10 -theme_override_constants/margin_bottom = 10 - -[node name="Lines" type="VBoxContainer" parent="Score/Paper/Margin"] -layout_direction = 1 -layout_mode = 2 -size_flags_horizontal = 0 -size_flags_vertical = 8 - -[node name="Line1" type="HBoxContainer" parent="Score/Paper/Margin/Lines"] -layout_mode = 2 - -[node name="Label" type="Label" parent="Score/Paper/Margin/Lines/Line1"] -layout_mode = 2 -theme_override_colors/font_color = Color(0, 0, 0, 1) -theme_override_fonts/font = ExtResource("3_u54fv") -theme_override_font_sizes/font_size = 25 -text = "c.score.completed" - -[node name="Spacer" type="Control" parent="Score/Paper/Margin/Lines/Line1"] -layout_mode = 2 -size_flags_horizontal = 3 - -[node name="Completed" type="Label" parent="Score/Paper/Margin/Lines/Line1"] -auto_translate_mode = 2 -custom_minimum_size = Vector2(100, 0) -layout_mode = 2 -theme_override_colors/font_color = Color(0, 0.278431, 0, 1) -theme_override_fonts/font = ExtResource("3_u54fv") -theme_override_font_sizes/font_size = 35 -text = "0" -horizontal_alignment = 1 - -[node name="Line2" type="HBoxContainer" parent="Score/Paper/Margin/Lines"] -layout_mode = 2 - -[node name="Label" type="Label" parent="Score/Paper/Margin/Lines/Line2"] -layout_mode = 2 -theme_override_colors/font_color = Color(0, 0, 0, 1) -theme_override_fonts/font = ExtResource("3_u54fv") -theme_override_font_sizes/font_size = 25 -text = "c.score.failed" - -[node name="Spacer" type="Control" parent="Score/Paper/Margin/Lines/Line2"] -layout_mode = 2 -size_flags_horizontal = 3 - -[node name="Failed" type="Label" parent="Score/Paper/Margin/Lines/Line2"] -auto_translate_mode = 2 -custom_minimum_size = Vector2(100, 0) -layout_mode = 2 -theme_override_colors/font_color = Color(0.505882, 0, 0, 1) -theme_override_fonts/font = ExtResource("3_u54fv") -theme_override_font_sizes/font_size = 35 -text = "0" -horizontal_alignment = 1 - -[node name="Line3" type="HBoxContainer" parent="Score/Paper/Margin/Lines"] -layout_mode = 2 - -[node name="Label" type="Label" parent="Score/Paper/Margin/Lines/Line3"] -layout_mode = 2 -theme_override_colors/font_color = Color(0, 0, 0, 1) -theme_override_fonts/font = ExtResource("3_u54fv") -theme_override_font_sizes/font_size = 35 -text = "c.score.points" - -[node name="Spacer" type="Control" parent="Score/Paper/Margin/Lines/Line3"] -layout_mode = 2 -size_flags_horizontal = 3 - -[node name="Points" type="Label" parent="Score/Paper/Margin/Lines/Line3"] -auto_translate_mode = 2 -custom_minimum_size = Vector2(100, 0) -layout_mode = 2 -theme_override_colors/font_color = Color(0, 0, 0, 1) -theme_override_fonts/font = ExtResource("3_u54fv") -theme_override_font_sizes/font_size = 45 -text = "0" -horizontal_alignment = 1 - -[node name="Time" type="Control" parent="."] -layout_mode = 2 -size_flags_horizontal = 8 -size_flags_vertical = 8 - -[node name="Paper" type="TextureRect" parent="Time"] -layout_mode = 1 -anchors_preset = 8 -anchor_left = 0.5 -anchor_top = 0.5 -anchor_right = 0.5 -anchor_bottom = 0.5 -offset_left = -206.0 -offset_top = -119.0 -offset_right = 306.0 -offset_bottom = 393.0 -grow_horizontal = 2 -grow_vertical = 2 -rotation = 0.0610865 -texture = ExtResource("3_oum5g") - -[node name="Line" type="HBoxContainer" parent="Time/Paper"] -layout_mode = 0 - -[node name="Seconds" type="Label" parent="Time/Paper/Line"] -auto_translate_mode = 2 -custom_minimum_size = Vector2(100, 0) -layout_mode = 2 -theme_override_colors/font_color = Color(0, 0, 0, 1) -theme_override_fonts/font = ExtResource("3_u54fv") -theme_override_font_sizes/font_size = 45 -text = "300" -horizontal_alignment = 2 - -[node name="Point" type="Label" parent="Time/Paper/Line"] -auto_translate_mode = 2 -layout_mode = 2 -theme_override_colors/font_color = Color(0, 0, 0, 1) -theme_override_fonts/font = ExtResource("3_u54fv") -theme_override_font_sizes/font_size = 45 -text = "." -horizontal_alignment = 1 - -[node name="Decimals" type="Label" parent="Time/Paper/Line"] -auto_translate_mode = 2 -layout_mode = 2 -theme_override_colors/font_color = Color(0, 0, 0, 1) -theme_override_fonts/font = ExtResource("3_u54fv") -theme_override_font_sizes/font_size = 45 -text = "00" - -[node name="Announcement" type="Control" parent="."] -visible = false -layout_mode = 2 -script = ExtResource("5_874f2") - -[node name="Center" type="Control" parent="Announcement"] -layout_mode = 1 -anchors_preset = 8 -anchor_left = 0.5 -anchor_top = 0.5 -anchor_right = 0.5 -anchor_bottom = 0.5 -grow_horizontal = 2 -grow_vertical = 2 - -[node name="Node2D" type="Node2D" parent="Announcement/Center"] -modulate = Color(1, 1, 1, 0) -scale = Vector2(1e-05, 1e-05) - -[node name="Label" type="Label" parent="Announcement/Center/Node2D"] -anchors_preset = 8 -anchor_left = 0.5 -anchor_top = 0.5 -anchor_right = 0.5 -anchor_bottom = 0.5 -offset_left = -375.0 -offset_top = -50.0 -offset_right = 375.0 -offset_bottom = 50.0 -grow_horizontal = 2 -grow_vertical = 2 -size_flags_vertical = 1 -theme_override_colors/font_outline_color = Color(0.564706, 0.207843, 0.266667, 1) -theme_override_constants/outline_size = 20 -theme_override_fonts/font = SubResource("FontVariation_8f216") -theme_override_font_sizes/font_size = 64 -text = "GO!" -horizontal_alignment = 1 -vertical_alignment = 1 - -[node name="AnimationPlayer" type="AnimationPlayer" parent="Announcement"] -libraries = { -&"": SubResource("AnimationLibrary_deqe4") -} - -[node name="PreperationTimer" type="Timer" parent="Announcement"] -one_shot = true - -[node name="InitialDelay" type="Timer" parent="Announcement"] -wait_time = 0.5 -one_shot = true diff --git a/client/gui/overlays/lobby/lobby.gd b/client/gui/overlays/lobby/lobby.gd index 3971dbb3..431cec2d 100644 --- a/client/gui/overlays/lobby/lobby.gd +++ b/client/gui/overlays/lobby/lobby.gd @@ -29,7 +29,7 @@ var bot_reset_buttons := {} var bot_inc_buttons := {} var bot_dec_buttons := {} -@onready var game: Game = $"../Game" +@onready var game: Game = $"../../Game" # TODO @onready var player_container = $PlayerList/VBoxContainer/Players @onready var map_name_label = $Sidebar/Bottom/MarginContainer/VBoxContainer/HBoxContainer/Map/Name diff --git a/client/gui/overlays/overlays.gd b/client/gui/overlays/overlays.gd new file mode 100644 index 00000000..2ffdd372 --- /dev/null +++ b/client/gui/overlays/overlays.gd @@ -0,0 +1,24 @@ +# Hurry Curry! - a game about cooking +# Copyright (C) 2025 Hurry Curry! contributors +# +# 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 . +# +extends Control +class_name Overlays + +func _ready(): + Settings.hook_changed_init("ui.hide_overlays", false, func (v): visible = v) + +func _input(_event): + if Input.is_action_just_pressed("toggle_overlay"): + Global.set_setting("ui.hide_overlays", not Global.get_setting("ui.hide_overlays")) diff --git a/client/gui/overlays/overlays.gd.uid b/client/gui/overlays/overlays.gd.uid new file mode 100644 index 00000000..5f61ed5d --- /dev/null +++ b/client/gui/overlays/overlays.gd.uid @@ -0,0 +1 @@ +uid://bkvtm1jlme6jf diff --git a/client/gui/overlays/overlays.tscn b/client/gui/overlays/overlays.tscn new file mode 100644 index 00000000..67f1082f --- /dev/null +++ b/client/gui/overlays/overlays.tscn @@ -0,0 +1,41 @@ +[gd_scene load_steps=8 format=3 uid="uid://cr26jennm5c0c"] + +[ext_resource type="Script" uid="uid://bkvtm1jlme6jf" path="res://gui/overlays/overlays.gd" id="1_dcvak"] +[ext_resource type="PackedScene" uid="uid://xcxbmynn8mhi" path="res://gui/overlays/chat.tscn" id="1_n4uhr"] +[ext_resource type="PackedScene" uid="uid://bpikve6wlsjfl" path="res://gui/overlays/score.tscn" id="2_whygm"] +[ext_resource type="PackedScene" uid="uid://dcrr1rwdwbkq8" path="res://gui/overlays/pinned_messages.tscn" id="3_dcvak"] +[ext_resource type="PackedScene" uid="uid://bc50la65ntifb" path="res://gui/overlays/lobby/lobby.tscn" id="4_jwd7s"] +[ext_resource type="PackedScene" uid="uid://c7pykhpdhgs64" path="res://gui/overlays/announce_title.tscn" id="5_whygm"] +[ext_resource type="PackedScene" uid="uid://b21nrnkygiyjt" path="res://gui/overlays/popup_message/popup_message.tscn" id="7_jwd7s"] + +[node name="Overlays" 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_dcvak") + +[node name="ChatPreview" parent="." instance=ExtResource("1_n4uhr")] +layout_mode = 1 + +[node name="Score" parent="." instance=ExtResource("2_whygm")] +layout_mode = 1 + +[node name="PinnedMessages" parent="." instance=ExtResource("3_dcvak")] +layout_mode = 1 + +[node name="Lobby" parent="." instance=ExtResource("4_jwd7s")] +layout_mode = 1 + +[node name="AnnounceTitle" parent="." instance=ExtResource("5_whygm")] +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 + +[node name="PopupMessage" parent="." instance=ExtResource("7_jwd7s")] +layout_mode = 1 diff --git a/client/gui/overlays/pinned_messages.gd b/client/gui/overlays/pinned_messages.gd new file mode 100644 index 00000000..fe82f904 --- /dev/null +++ b/client/gui/overlays/pinned_messages.gd @@ -0,0 +1,55 @@ +# Hurry Curry! - a game about cooking +# Copyright (C) 2025 Hurry Curry! contributors +# +# 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 . +# +extends Control +class_name PinnedItemMessages + +const ITEM_MESSAGE_SCENE := preload("res://gui/components/message/item/item_message.tscn") +const PAPER_PANEL_STYLE := preload("res://gui/resources/style/paper_panel_style.tres") + +var pinned_items := {} + +@onready var pinned_items_container: HBoxContainer = $HBoxContainer + +func pin_item(item_name: String, timeout_initial_: float, timeout_remaining_: float, player_id: float): + var item_message: ItemMessage = ITEM_MESSAGE_SCENE.instantiate() + item_message.remove_theme_stylebox_override("panel") + item_message.enable_rotation = false + item_message.enable_grayscale = true + item_message.add_theme_stylebox_override("panel", PAPER_PANEL_STYLE) + pinned_items_container.add_child(item_message) + item_message.set_subviewport_size(Vector2(96, 84)) + item_message.set_round_corner_radius_progress(0) + item_message.set_item(item_name, timeout_initial_, timeout_remaining_) + pinned_items[player_id] = item_message + sort_pins() + +func clear_item(player_id: float): + if player_id in pinned_items: + if is_instance_valid(pinned_items[player_id]): + pinned_items[player_id].queue_free() + +func sort_pins(): + var sorted_nodes := pinned_items_container.get_children() + + sorted_nodes.sort_custom( + func(a: Node, b: Node): return a.timeout_remaining < b.timeout_remaining + ) + + for node in pinned_items_container.get_children(): + pinned_items_container.remove_child(node) + + for node in sorted_nodes: + pinned_items_container.add_child(node) diff --git a/client/gui/overlays/pinned_messages.gd.uid b/client/gui/overlays/pinned_messages.gd.uid new file mode 100644 index 00000000..2325c656 --- /dev/null +++ b/client/gui/overlays/pinned_messages.gd.uid @@ -0,0 +1 @@ +uid://c0k6f1wkynbkd diff --git a/client/gui/overlays/pinned_messages.tscn b/client/gui/overlays/pinned_messages.tscn new file mode 100644 index 00000000..318c9b85 --- /dev/null +++ b/client/gui/overlays/pinned_messages.tscn @@ -0,0 +1,22 @@ +[gd_scene load_steps=2 format=3 uid="uid://dcrr1rwdwbkq8"] + +[ext_resource type="Script" uid="uid://c0k6f1wkynbkd" path="res://gui/overlays/pinned_messages.gd" id="1_q0jkk"] + +[node name="PinnedItemMessages" type="Control"] +layout_mode = 3 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +mouse_filter = 2 +script = ExtResource("1_q0jkk") + +[node name="HBoxContainer" type="HBoxContainer" parent="."] +layout_direction = 2 +layout_mode = 1 +anchors_preset = 10 +anchor_right = 1.0 +offset_bottom = 256.0 +grow_horizontal = 2 +mouse_filter = 2 diff --git a/client/gui/overlays/popup_message/popup_message.gd b/client/gui/overlays/popup_message/popup_message.gd new file mode 100644 index 00000000..d577465b --- /dev/null +++ b/client/gui/overlays/popup_message/popup_message.gd @@ -0,0 +1,230 @@ +# Hurry Curry! - a game about cooking +# Copyright (C) 2025 Hurry Curry! contributors +# +# 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 . +# +extends Control +class_name PopupMessage + +const SERVER_MESSAGE_SCENE = preload("res://gui/overlays/popup_message/server_message.tscn") + +var is_ingame := false +var is_joined := false + +var positional_messages = {} + +@onready var positional_messages_node: Control = $Positional +@onready var server_msg = $Static/VBox/ServerMessage +@onready var hint_msg = $Static/VBox/HintMessage + +@onready var server_msg_label: Label = $Static/VBox/ServerMessage/CenterContainer/Label +@onready var hint_msg_label: Label = $Static/VBox/HintMessage/CenterContainer/Label + +@onready var auto_hint_timers: Node = $Timers/AutoHints +@onready var server_msg_timer: Timer = $Timers/Server +@onready var hint_msg_timer: Timer = $Timers/Hint +@onready var reset_timer = $Timers/Reset +@onready var join_while_running_timer = $Timers/JoinWhileRunning + +@onready var game: Game = $"../../Game" # TODO + +func _ready(): + game.join_state_updated.connect(func(state: Game.JoinState): + is_joined = state == Game.JoinState.JOINED + ) + game.update_tutorial_running.connect( + func a(running: bool): + if running: + stop_game_hints() + else: + update_state() + ) + game.in_lobby_updated.connect( + func a(in_lobby): + is_ingame = not in_lobby + update_state() + ) + +func _process(_delta: float): + for pos: Vector2 in positional_messages.keys(): + var msg: PositionalMessage = positional_messages[pos] + var pos_3d = Vector3(pos.x + 0.5, 1.5, pos.y + 0.5) + var pos_2d = get_viewport().get_camera_3d().unproject_position(pos_3d) + + msg.node_2d.position = pos_2d.clamp( + Vector2.ZERO + 0.5 * msg.node.size, + Vector2(get_viewport_rect().size) - 0.5 * msg.node.size + ) + + if msg.node.size != msg.last_size: + msg.last_size = msg.node.size + msg.node.position = -0.5 * msg.last_size + +func update_state(): + if is_ingame and is_joined: + start_game_hints() + elif is_ingame: + stop_game_hints() + join_while_running_timer.start() + else: + stop_game_hints() + +func display_server_msg(msg: String, auto_remove := true): + server_msg.show() + server_msg_label.text = msg + + if auto_remove: + server_msg_timer.start() + +func _on_server_timeout() -> void: + clear_server_msg() + +func display_server_msg_positional(text: String, pos: Vector2, use_monospace: bool): + var msg := PositionalMessage.new() + msg.node = SERVER_MESSAGE_SCENE.instantiate() + msg.node_2d = Node2D.new() + positional_messages_node.add_child(msg.node_2d) + msg.node_2d.add_child(msg.node) + msg.node.set_text(text, use_monospace) + msg.node.size = Vector2.ZERO + msg.position = pos + positional_messages[pos] = msg + +func clear_server_msg(position_ = null): + if position_ == null: + server_msg_timer.stop() + server_msg.hide() + else: + if position_ in positional_messages: + var msg: PositionalMessage = positional_messages[position_] + msg.node_2d.queue_free() + positional_messages.erase(position_) + +func display_hint_msg(msg: String): + hint_msg.show() + hint_msg_label.text = msg + hint_msg_timer.start() + +func _on_hint_timer_timeout(): + hint_msg.hide() + +func start_game_hints(): + for c: Timer in auto_hint_timers.get_children(): + c.start() + +func stop_game_hints(): + _on_hint_timer_timeout() + for c: Timer in auto_hint_timers.get_children(): + c.stop() + reset_timer.stop() + join_while_running_timer.stop() + +func _input(_event): + if Input.is_action_just_pressed("boost"): + Global.set_hint("has_boosted", true) + if any_action_just_pressed(["forwards", "backwards", "left", "right"]): + Global.set_hint("has_moved", true) + if any_action_just_pressed(["rotate_left", "rotate_right", "rotate_up", "rotate_down"]): + if not Global.get_hint("has_reset"): + reset_timer.start() + Global.set_hint("has_rotated", true) + if any_action_just_pressed(["zoom_in", "zoom_out"]): + Global.set_hint("has_zoomed", true) + if Input.is_action_just_pressed("interact_left") or Input.is_action_just_pressed("interact_right"): + Global.set_hint("has_interacted", true) + if Input.is_action_just_pressed("reset"): + Global.set_hint("has_reset", true) + +func _on_boost_timeout(): + if not Global.get_hint("has_boosted") and not Global.using_touch: + display_hint_msg(tr("c.hint.boost").format([display_keybind("boost")])) + +func _on_move_timeout(): + if not Global.get_hint("has_moved") and not Global.using_touch: + display_hint_msg(tr("c.hint.movement").format([", ".join( + [ + display_keybind("forwards"), + display_keybind("left"), + display_keybind("backwards"), + display_keybind("right") + ] + )])) + +func _on_interact_timeout(): + if not Global.get_hint("has_interacted") and not Global.using_touch: + display_hint_msg(tr("c.hint.interact").format([display_keybind("interact")])) + +func _on_reset_timeout(): + if not Global.get_hint("has_reset") and not Global.using_touch: + display_hint_msg(tr("c.hint.reset_camera").format([display_keybind("reset")])) + +func _on_zoom_timeout(): + if not Global.get_hint("has_zoomed") and not Global.using_touch: + display_hint_msg(tr("c.hint.zoom_camera").format([", ".join( + [ + display_keybind("zoom_in"), + display_keybind("zoom_out") + ] + )])) + +func display_keybind(action_name: String) -> String: + var events := InputManager.get_events(action_name) + + if events.size() == 0: + # There are no events which match the action + return tr("c.settings.input.unknown_event") + + for event: InputEvent in events: + # Try to find event which matches input method + var type := InputManager.get_event_type(event) + if Global.using_joypad and type != InputManager.EventType.JOYPAD: + continue + if Global.using_touch and type != InputManager.EventType.TOUCH: + continue + return InputManager.display_input_event(event) + + # No matching event found. Just show any event. + return InputManager.display_input_event(events[0]) + +func any_action_just_pressed(actions: Array) -> bool: + for a: String in actions: + if Input.is_action_just_pressed(a): + return true + return false + +func _on_rotate_camera_timeout(): + if not Global.get_hint("has_rotated") and not Global.using_touch: + display_hint_msg(tr("c.hint.rotate").format([", ".join( + [ + display_keybind("rotate_up"), + display_keybind("rotate_left"), + display_keybind("rotate_down"), + display_keybind("rotate_right") + ] + )])) + +func _on_join_while_running_timeout(): + if not game.join_state == Game.JoinState.JOINED and not Global.get_hint("has_seen_join_while_running"): + Global.set_hint("has_seen_join_while_running", true) + display_hint_msg(tr("c.hint.join_while_running").format([display_keybind("menu")])) + +func _on_performance_timeout() -> void: + if not Global.get_hint("has_seen_performance") and Engine.get_frames_per_second() < DisplayServer.screen_get_refresh_rate() * 0.75: + Global.set_hint("has_seen_performance", true) + display_hint_msg(tr("c.hint.framerate_low")) + +class PositionalMessage: + var node: ServerMessage + var node_2d: Node2D + var position: Vector2 + var last_size: Vector2 diff --git a/client/gui/overlays/popup_message/popup_message.gd.uid b/client/gui/overlays/popup_message/popup_message.gd.uid new file mode 100644 index 00000000..d9aa95c5 --- /dev/null +++ b/client/gui/overlays/popup_message/popup_message.gd.uid @@ -0,0 +1 @@ +uid://c2cx41lrgf5b0 diff --git a/client/gui/overlays/popup_message/popup_message.tscn b/client/gui/overlays/popup_message/popup_message.tscn new file mode 100644 index 00000000..15d56c40 --- /dev/null +++ b/client/gui/overlays/popup_message/popup_message.tscn @@ -0,0 +1,164 @@ +[gd_scene load_steps=12 format=3 uid="uid://b21nrnkygiyjt"] + +[ext_resource type="Theme" uid="uid://b0qmvo504e457" path="res://gui/resources/theme/theme.tres" id="1_a1566"] +[ext_resource type="Script" uid="uid://c2cx41lrgf5b0" path="res://gui/overlays/popup_message/popup_message.gd" id="2_sbew6"] +[ext_resource type="Shader" uid="uid://cwldxegcj55if" path="res://gui/resources/shaders/blur_mix.gdshader" id="3_2vnom"] +[ext_resource type="PackedScene" uid="uid://dq61p3a8og2b6" path="res://gui/overlays/popup_message/server_message.tscn" id="3_m3rok"] +[ext_resource type="Script" uid="uid://cmncjc06kadpe" path="res://gui/components/blur_setup.gd" id="4_pvwmw"] +[ext_resource type="FontFile" uid="uid://bk704sc5gkrb3" path="res://gui/resources/fonts/font-azaret-mono.woff2" id="4_wsrnf"] +[ext_resource type="Texture2D" uid="uid://b2uv5rf0enikf" path="res://gui/resources/icons/hint.svg" id="5_2dxsd"] + +[sub_resource type="ShaderMaterial" id="ShaderMaterial_k0m35"] +shader = ExtResource("3_2vnom") +shader_parameter/blur_amount = 3.5 +shader_parameter/mix_amount = 0.85 +shader_parameter/mix_amount_no_blur = 1.0 +shader_parameter/color_over = Color(0, 0, 0, 1) +shader_parameter/enable_blur = false + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_vq4dg"] +bg_color = Color(1, 1, 1, 0.878431) +corner_radius_top_left = 16 +corner_radius_top_right = 16 +corner_radius_bottom_right = 16 +corner_radius_bottom_left = 16 + +[sub_resource type="FontVariation" id="FontVariation_qfltj"] +base_font = ExtResource("4_wsrnf") +variation_embolden = 0.75 + +[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_3rgop"] +content_margin_left = 32.0 +content_margin_top = 8.0 +content_margin_right = 32.0 +content_margin_bottom = 8.0 + +[node name="PopupMessage" type="Control"] +layout_mode = 3 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +mouse_filter = 2 +script = ExtResource("2_sbew6") + +[node name="Static" type="MarginContainer" parent="."] +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +mouse_filter = 2 +theme = ExtResource("1_a1566") + +[node name="VBox" type="VBoxContainer" parent="Static"] +layout_mode = 2 +mouse_filter = 2 + +[node name="ServerMessage" parent="Static/VBox" instance=ExtResource("3_m3rok")] +visible = false +layout_mode = 2 + +[node name="HintMessage" type="PanelContainer" parent="Static/VBox"] +visible = false +material = SubResource("ShaderMaterial_k0m35") +layout_mode = 2 +size_flags_vertical = 0 +mouse_filter = 2 +theme_override_styles/panel = SubResource("StyleBoxFlat_vq4dg") +script = ExtResource("4_pvwmw") + +[node name="CenterContainer" type="HBoxContainer" parent="Static/VBox/HintMessage"] +layout_mode = 2 +mouse_filter = 2 +alignment = 1 + +[node name="MarginContainer" type="MarginContainer" parent="Static/VBox/HintMessage/CenterContainer"] +layout_mode = 2 +mouse_filter = 2 +theme_override_constants/margin_left = 4 +theme_override_constants/margin_top = 4 +theme_override_constants/margin_right = 4 +theme_override_constants/margin_bottom = 4 + +[node name="TextureRect" type="TextureRect" parent="Static/VBox/HintMessage/CenterContainer/MarginContainer"] +custom_minimum_size = Vector2(28, 28) +layout_mode = 2 +mouse_filter = 2 +texture = ExtResource("5_2dxsd") +expand_mode = 1 +stretch_mode = 4 + +[node name="Label" type="Label" parent="Static/VBox/HintMessage/CenterContainer"] +layout_mode = 2 +size_flags_horizontal = 3 +theme_override_fonts/font = SubResource("FontVariation_qfltj") +theme_override_styles/normal = SubResource("StyleBoxEmpty_3rgop") +text = "A hint is worth more than a thousand manuals" +autowrap_mode = 3 + +[node name="Positional" type="Control" parent="."] +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +mouse_filter = 2 + +[node name="Timers" type="Node" parent="."] + +[node name="Server" type="Timer" parent="Timers"] +wait_time = 5.0 +one_shot = true + +[node name="Hint" type="Timer" parent="Timers"] +wait_time = 10.0 +one_shot = true + +[node name="AutoHints" type="Node" parent="Timers"] + +[node name="Move" type="Timer" parent="Timers/AutoHints"] +wait_time = 2.0 +one_shot = true + +[node name="Performance" type="Timer" parent="Timers/AutoHints"] +wait_time = 20.0 +one_shot = true + +[node name="Boost" type="Timer" parent="Timers/AutoHints"] +wait_time = 90.0 +one_shot = true + +[node name="Interact" type="Timer" parent="Timers/AutoHints"] +wait_time = 15.0 +one_shot = true + +[node name="RotateCamera" type="Timer" parent="Timers/AutoHints"] +wait_time = 120.0 +one_shot = true + +[node name="Zoom" type="Timer" parent="Timers/AutoHints"] +wait_time = 135.0 +one_shot = true + +[node name="Reset" type="Timer" parent="Timers"] +wait_time = 10.0 +one_shot = true + +[node name="JoinWhileRunning" type="Timer" parent="Timers"] +wait_time = 5.0 +one_shot = true + +[connection signal="timeout" from="Timers/Server" to="." method="_on_server_timeout"] +[connection signal="timeout" from="Timers/Hint" to="Static" method="_on_hint_timer_timeout"] +[connection signal="timeout" from="Timers/AutoHints/Move" to="Static" method="_on_move_timeout"] +[connection signal="timeout" from="Timers/AutoHints/Performance" to="Static" method="_on_performance_timeout"] +[connection signal="timeout" from="Timers/AutoHints/Boost" to="Static" method="_on_boost_timeout"] +[connection signal="timeout" from="Timers/AutoHints/Interact" to="Static" method="_on_interact_timeout"] +[connection signal="timeout" from="Timers/AutoHints/RotateCamera" to="Static" method="_on_rotate_camera_timeout"] +[connection signal="timeout" from="Timers/AutoHints/Zoom" to="Static" method="_on_zoom_timeout"] +[connection signal="timeout" from="Timers/Reset" to="Static" method="_on_reset_timeout"] +[connection signal="timeout" from="Timers/JoinWhileRunning" to="Static" method="_on_join_while_running_timeout"] diff --git a/client/gui/overlays/popup_message/server_message.gd b/client/gui/overlays/popup_message/server_message.gd new file mode 100644 index 00000000..a0688dc5 --- /dev/null +++ b/client/gui/overlays/popup_message/server_message.gd @@ -0,0 +1,13 @@ +extends BlurSetup +class_name ServerMessage + +const DEFAULT_FONT = preload("res://gui/resources/fonts/font-josefin-sans.woff2") +const MONOSPACE_FONT = preload("res://gui/resources/fonts/font-azaret-mono.woff2") + +@onready var label: Label = $CenterContainer/Label + +func set_text(text: String, use_monospace := true): + label.text = text + var font: FontVariation = label.get_theme_font("font") + font.base_font = MONOSPACE_FONT if use_monospace else DEFAULT_FONT + label.add_theme_font_size_override("font_size", 16 if use_monospace else 20) diff --git a/client/gui/overlays/popup_message/server_message.gd.uid b/client/gui/overlays/popup_message/server_message.gd.uid new file mode 100644 index 00000000..775979e0 --- /dev/null +++ b/client/gui/overlays/popup_message/server_message.gd.uid @@ -0,0 +1 @@ +uid://dfgwh7x7sqc21 diff --git a/client/gui/overlays/popup_message/server_message.tscn b/client/gui/overlays/popup_message/server_message.tscn new file mode 100644 index 00000000..f3297cd4 --- /dev/null +++ b/client/gui/overlays/popup_message/server_message.tscn @@ -0,0 +1,51 @@ +[gd_scene load_steps=8 format=3 uid="uid://dq61p3a8og2b6"] + +[ext_resource type="Shader" uid="uid://cwldxegcj55if" path="res://gui/resources/shaders/blur_mix.gdshader" id="1_qv8ew"] +[ext_resource type="Script" uid="uid://dfgwh7x7sqc21" path="res://gui/overlays/popup_message/server_message.gd" id="2_csqo8"] +[ext_resource type="FontFile" uid="uid://bk704sc5gkrb3" path="res://gui/resources/fonts/font-azaret-mono.woff2" id="3_dw20j"] + +[sub_resource type="ShaderMaterial" id="ShaderMaterial_q3bbd"] +shader = ExtResource("1_qv8ew") +shader_parameter/blur_amount = 3.5 +shader_parameter/mix_amount = 0.85 +shader_parameter/mix_amount_no_blur = 0.85 +shader_parameter/color_over = Color(1, 1, 1, 1) +shader_parameter/enable_blur = true + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_vq4dg"] +bg_color = Color(1, 1, 1, 0.878431) +corner_radius_top_left = 16 +corner_radius_top_right = 16 +corner_radius_bottom_right = 16 +corner_radius_bottom_left = 16 + +[sub_resource type="FontVariation" id="FontVariation_qfltj"] +resource_local_to_scene = true +base_font = ExtResource("3_dw20j") +variation_embolden = 0.75 + +[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_3rgop"] +content_margin_left = 32.0 +content_margin_top = 8.0 +content_margin_right = 32.0 +content_margin_bottom = 8.0 + +[node name="ServerMessage" type="PanelContainer"] +material = SubResource("ShaderMaterial_q3bbd") +size_flags_horizontal = 4 +size_flags_vertical = 0 +mouse_filter = 2 +theme_override_styles/panel = SubResource("StyleBoxFlat_vq4dg") +script = ExtResource("2_csqo8") + +[node name="CenterContainer" type="CenterContainer" parent="."] +layout_mode = 2 +mouse_filter = 2 + +[node name="Label" type="Label" parent="CenterContainer"] +layout_mode = 2 +theme_override_colors/font_color = Color(0, 0, 0, 1) +theme_override_fonts/font = SubResource("FontVariation_qfltj") +theme_override_font_sizes/font_size = 16 +theme_override_styles/normal = SubResource("StyleBoxEmpty_3rgop") +text = "Server message" diff --git a/client/gui/overlays/score.gd b/client/gui/overlays/score.gd new file mode 100644 index 00000000..8c8e4d1e --- /dev/null +++ b/client/gui/overlays/score.gd @@ -0,0 +1,65 @@ +# Hurry Curry! - a game about cooking +# Copyright (C) 2025 Hurry Curry! contributors +# +# 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 . +# +class_name Overlay +extends PanelContainer + +const LABEL_SCALE: Vector2 = Vector2(1.5, 1.5) + +var failed: int = 0 +var completed: int = 0 +var points: int = 0 + +@onready var failed_label: Label = $Score/Paper/Margin/Lines/Line2/Failed +@onready var completed_label: Label = $Score/Paper/Margin/Lines/Line1/Completed +@onready var points_label: Label = $Score/Paper/Margin/Lines/Line3/Points +@onready var timer: Timer = $Timer +@onready var seconds_label: Label = $Time/Paper/Line/Seconds +@onready var decimals_label: Label = $Time/Paper/Line/Decimals +@onready var announcement = $Announcement + +func update(failed_: int, completed_: int, points_: int, time: float): + if failed_ - failed: + failed_label.text = str(failed_) + failed_label.scale = LABEL_SCALE + failed = failed_ + if completed_ - completed: + completed_label.text = str(completed_) + completed_label.scale = LABEL_SCALE + completed = completed_ + if points_ - points: + points_label.text = str(points_) + points_label.scale = LABEL_SCALE + points = points_ + + timer.stop() + if time > 0.: + timer.wait_time = time + timer.start() + +func set_ingame(_state: bool, lobby: bool): + if lobby: + hide() + timer.stop() + else: + show() + +func _process(delta): + failed_label.scale = G.interpolate(failed_label.scale, Vector2(1, 1), delta * 4.) + completed_label.scale = G.interpolate(completed_label.scale, Vector2(1, 1), delta * 4.) + points_label.scale = G.interpolate(points_label.scale, Vector2(1, 1), delta * 4.) + var seconds: float = floor(timer.time_left) + seconds_label.text = str(int(seconds)) + decimals_label.text = "%01d" % int((timer.time_left - seconds) * 10) diff --git a/client/gui/overlays/score.gd.uid b/client/gui/overlays/score.gd.uid new file mode 100644 index 00000000..ff13fb53 --- /dev/null +++ b/client/gui/overlays/score.gd.uid @@ -0,0 +1 @@ +uid://mcgg3q0l03dx diff --git a/client/gui/overlays/score.tscn b/client/gui/overlays/score.tscn new file mode 100644 index 00000000..3f0d3034 --- /dev/null +++ b/client/gui/overlays/score.tscn @@ -0,0 +1,185 @@ +[gd_scene load_steps=6 format=3 uid="uid://bpikve6wlsjfl"] + +[ext_resource type="Theme" uid="uid://b0qmvo504e457" path="res://gui/resources/theme/theme.tres" id="1_4kujw"] +[ext_resource type="Script" uid="uid://mcgg3q0l03dx" path="res://gui/overlays/score.gd" id="2_kbjds"] +[ext_resource type="Texture2D" uid="uid://chxkwohi56cxx" path="res://gui/resources/shaders/paper.tres" id="3_oum5g"] +[ext_resource type="FontFile" uid="uid://bo4vh5xkpvrh1" path="res://gui/resources/fonts/font-sansita-swashed.woff2" id="3_u54fv"] + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_04ujj"] +bg_color = Color(0, 0, 0, 0) + +[node name="ScoreOverlay" type="PanelContainer"] +layout_direction = 2 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +mouse_filter = 2 +theme = ExtResource("1_4kujw") +theme_override_styles/panel = SubResource("StyleBoxFlat_04ujj") +script = ExtResource("2_kbjds") + +[node name="Timer" type="Timer" parent="."] +wait_time = 30.0 + +[node name="Score" type="Control" parent="."] +layout_mode = 2 +size_flags_horizontal = 8 +size_flags_vertical = 0 + +[node name="Paper" type="TextureRect" parent="Score"] +layout_mode = 1 +anchors_preset = 8 +anchor_left = 0.5 +anchor_top = 0.5 +anchor_right = 0.5 +anchor_bottom = 0.5 +offset_left = -242.0 +offset_top = -327.0 +offset_right = 270.0 +offset_bottom = 185.0 +grow_horizontal = 2 +grow_vertical = 2 +rotation = 0.0610865 +texture = ExtResource("3_oum5g") + +[node name="Margin" type="MarginContainer" parent="Score/Paper"] +layout_mode = 1 +anchors_preset = 2 +anchor_top = 1.0 +anchor_bottom = 1.0 +offset_top = -142.0 +offset_right = 258.0 +grow_vertical = 0 +theme_override_constants/margin_left = 10 +theme_override_constants/margin_bottom = 10 + +[node name="Lines" type="VBoxContainer" parent="Score/Paper/Margin"] +layout_direction = 1 +layout_mode = 2 +size_flags_horizontal = 0 +size_flags_vertical = 8 + +[node name="Line1" type="HBoxContainer" parent="Score/Paper/Margin/Lines"] +layout_mode = 2 + +[node name="Label" type="Label" parent="Score/Paper/Margin/Lines/Line1"] +layout_mode = 2 +theme_override_colors/font_color = Color(0, 0, 0, 1) +theme_override_fonts/font = ExtResource("3_u54fv") +theme_override_font_sizes/font_size = 25 +text = "c.score.completed" + +[node name="Spacer" type="Control" parent="Score/Paper/Margin/Lines/Line1"] +layout_mode = 2 +size_flags_horizontal = 3 + +[node name="Completed" type="Label" parent="Score/Paper/Margin/Lines/Line1"] +auto_translate_mode = 2 +custom_minimum_size = Vector2(100, 0) +layout_mode = 2 +theme_override_colors/font_color = Color(0, 0.278431, 0, 1) +theme_override_fonts/font = ExtResource("3_u54fv") +theme_override_font_sizes/font_size = 35 +text = "0" +horizontal_alignment = 1 + +[node name="Line2" type="HBoxContainer" parent="Score/Paper/Margin/Lines"] +layout_mode = 2 + +[node name="Label" type="Label" parent="Score/Paper/Margin/Lines/Line2"] +layout_mode = 2 +theme_override_colors/font_color = Color(0, 0, 0, 1) +theme_override_fonts/font = ExtResource("3_u54fv") +theme_override_font_sizes/font_size = 25 +text = "c.score.failed" + +[node name="Spacer" type="Control" parent="Score/Paper/Margin/Lines/Line2"] +layout_mode = 2 +size_flags_horizontal = 3 + +[node name="Failed" type="Label" parent="Score/Paper/Margin/Lines/Line2"] +auto_translate_mode = 2 +custom_minimum_size = Vector2(100, 0) +layout_mode = 2 +theme_override_colors/font_color = Color(0.505882, 0, 0, 1) +theme_override_fonts/font = ExtResource("3_u54fv") +theme_override_font_sizes/font_size = 35 +text = "0" +horizontal_alignment = 1 + +[node name="Line3" type="HBoxContainer" parent="Score/Paper/Margin/Lines"] +layout_mode = 2 + +[node name="Label" type="Label" parent="Score/Paper/Margin/Lines/Line3"] +layout_mode = 2 +theme_override_colors/font_color = Color(0, 0, 0, 1) +theme_override_fonts/font = ExtResource("3_u54fv") +theme_override_font_sizes/font_size = 35 +text = "c.score.points" + +[node name="Spacer" type="Control" parent="Score/Paper/Margin/Lines/Line3"] +layout_mode = 2 +size_flags_horizontal = 3 + +[node name="Points" type="Label" parent="Score/Paper/Margin/Lines/Line3"] +auto_translate_mode = 2 +custom_minimum_size = Vector2(100, 0) +layout_mode = 2 +theme_override_colors/font_color = Color(0, 0, 0, 1) +theme_override_fonts/font = ExtResource("3_u54fv") +theme_override_font_sizes/font_size = 45 +text = "0" +horizontal_alignment = 1 + +[node name="Time" type="Control" parent="."] +layout_mode = 2 +size_flags_horizontal = 8 +size_flags_vertical = 8 + +[node name="Paper" type="TextureRect" parent="Time"] +layout_mode = 1 +anchors_preset = 8 +anchor_left = 0.5 +anchor_top = 0.5 +anchor_right = 0.5 +anchor_bottom = 0.5 +offset_left = -206.0 +offset_top = -119.0 +offset_right = 306.0 +offset_bottom = 393.0 +grow_horizontal = 2 +grow_vertical = 2 +rotation = 0.0610865 +texture = ExtResource("3_oum5g") + +[node name="Line" type="HBoxContainer" parent="Time/Paper"] +layout_mode = 0 + +[node name="Seconds" type="Label" parent="Time/Paper/Line"] +auto_translate_mode = 2 +custom_minimum_size = Vector2(100, 0) +layout_mode = 2 +theme_override_colors/font_color = Color(0, 0, 0, 1) +theme_override_fonts/font = ExtResource("3_u54fv") +theme_override_font_sizes/font_size = 45 +text = "300" +horizontal_alignment = 2 + +[node name="Point" type="Label" parent="Time/Paper/Line"] +auto_translate_mode = 2 +layout_mode = 2 +theme_override_colors/font_color = Color(0, 0, 0, 1) +theme_override_fonts/font = ExtResource("3_u54fv") +theme_override_font_sizes/font_size = 45 +text = "." +horizontal_alignment = 1 + +[node name="Decimals" type="Label" parent="Time/Paper/Line"] +auto_translate_mode = 2 +layout_mode = 2 +theme_override_colors/font_color = Color(0, 0, 0, 1) +theme_override_fonts/font = ExtResource("3_u54fv") +theme_override_font_sizes/font_size = 45 +text = "00" -- cgit v1.2.3-70-g09d2