diff options
Diffstat (limited to 'client/menu')
-rw-r--r-- | client/menu/server_message.gd | 28 | ||||
-rw-r--r-- | client/menu/server_message.tscn | 60 |
2 files changed, 88 insertions, 0 deletions
diff --git a/client/menu/server_message.gd b/client/menu/server_message.gd new file mode 100644 index 00000000..ffd7887b --- /dev/null +++ b/client/menu/server_message.gd @@ -0,0 +1,28 @@ +# Undercooked - a game about cooking +# 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 MarginContainer +class_name ServerMessage + +@onready var popup_timer = $PopupTimer +@onready var popup_label = $VBoxContainer/ServerMessage/Label + +func display_popup(msg: String): + popup_label.text = msg + show() + popup_timer.start() + +func _on_popup_timer_timeout(): + hide() diff --git a/client/menu/server_message.tscn b/client/menu/server_message.tscn new file mode 100644 index 00000000..06193d4a --- /dev/null +++ b/client/menu/server_message.tscn @@ -0,0 +1,60 @@ +[gd_scene load_steps=7 format=3 uid="uid://b21nrnkygiyjt"] + +[ext_resource type="Theme" uid="uid://b0qmvo504e457" path="res://menu/theme/theme.tres" id="1_p0jm7"] +[ext_resource type="Shader" path="res://menu/blur_mix.gdshader" id="2_e1f4e"] +[ext_resource type="Script" path="res://menu/server_message.gd" id="2_j4xya"] + +[sub_resource type="ShaderMaterial" id="ShaderMaterial_k0m35"] +shader = ExtResource("2_e1f4e") +shader_parameter/blur_amount = 3.5 +shader_parameter/mix_amount = 0.85 +shader_parameter/color_over = Color(1, 1, 1, 1) + +[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="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="MarginContainer"] +visible = false +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +mouse_filter = 2 +theme = ExtResource("1_p0jm7") +script = ExtResource("2_j4xya") + +[node name="VBoxContainer" type="VBoxContainer" parent="."] +layout_mode = 2 +mouse_filter = 2 + +[node name="ServerMessage" type="PanelContainer" parent="VBoxContainer"] +material = SubResource("ShaderMaterial_k0m35") +layout_mode = 2 +size_flags_horizontal = 4 +size_flags_vertical = 0 +mouse_filter = 2 +theme_override_styles/panel = SubResource("StyleBoxFlat_vq4dg") + +[node name="Label" type="Label" parent="VBoxContainer/ServerMessage"] +layout_mode = 2 +theme_override_colors/font_color = Color(0, 0, 0, 1) +theme_override_styles/normal = SubResource("StyleBoxEmpty_3rgop") +text = "Server message" +horizontal_alignment = 1 + +[node name="PopupTimer" type="Timer" parent="."] +wait_time = 3.0 +one_shot = true + +[connection signal="timeout" from="PopupTimer" to="." method="_on_popup_timer_timeout"] |