aboutsummaryrefslogtreecommitdiff
path: root/client/menu
diff options
context:
space:
mode:
Diffstat (limited to 'client/menu')
-rw-r--r--client/menu/chat/chat_message.gd29
-rw-r--r--client/menu/chat/chat_message.tscn35
-rw-r--r--client/menu/chat/chat_open.gd47
-rw-r--r--client/menu/chat/chat_open.tscn50
-rw-r--r--client/menu/chat/chat_preview.gd33
-rw-r--r--client/menu/chat/chat_preview.tscn39
-rw-r--r--client/menu/game.gd4
-rw-r--r--client/menu/game.tscn6
-rw-r--r--client/menu/lobby.tscn2
-rw-r--r--client/menu/theme/style/item_bubble_progress_style.tres (renamed from client/menu/theme/item_bubble_progress_style.tres)0
-rw-r--r--client/menu/theme/style/lobby_panel_override.tres (renamed from client/menu/theme/lobby_panel_override.tres)0
-rw-r--r--client/menu/theme/style/panel_style.tres8
-rw-r--r--client/menu/theme/theme.tres11
13 files changed, 254 insertions, 10 deletions
diff --git a/client/menu/chat/chat_message.gd b/client/menu/chat/chat_message.gd
new file mode 100644
index 00000000..99a4a520
--- /dev/null
+++ b/client/menu/chat/chat_message.gd
@@ -0,0 +1,29 @@
+# Hurry Curry! - 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 PanelContainer
+class_name ChatMessage
+
+@onready var fade_away_timer = $FadeAway
+
+func set_message(username: String, message: String, fade_away: bool = false, fade_time: float = 5.):
+ $VBox/Sender.text = username
+ $VBox/Message.text = message
+
+ if fade_away:
+ fade_away_timer.start(fade_time)
+
+func _on_fade_away_timeout() -> void:
+ queue_free()
diff --git a/client/menu/chat/chat_message.tscn b/client/menu/chat/chat_message.tscn
new file mode 100644
index 00000000..84ccb402
--- /dev/null
+++ b/client/menu/chat/chat_message.tscn
@@ -0,0 +1,35 @@
+[gd_scene load_steps=5 format=3 uid="uid://bpc2qgsvcafhe"]
+
+[ext_resource type="Script" path="res://menu/chat/chat_message.gd" id="1_ey0qp"]
+[ext_resource type="Theme" uid="uid://b0qmvo504e457" path="res://menu/theme/theme.tres" id="1_rx6vg"]
+
+[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_ocjra"]
+
+[sub_resource type="FontVariation" id="FontVariation_jfhbh"]
+variation_embolden = 1.3
+
+[node name="ChatMessage" type="PanelContainer"]
+offset_right = 72.0
+offset_bottom = 165.0
+theme_override_styles/panel = SubResource("StyleBoxEmpty_ocjra")
+script = ExtResource("1_ey0qp")
+
+[node name="VBox" type="HBoxContainer" parent="."]
+layout_mode = 2
+theme = ExtResource("1_rx6vg")
+
+[node name="Sender" type="Label" parent="VBox"]
+layout_mode = 2
+theme_override_fonts/font = SubResource("FontVariation_jfhbh")
+text = "<Name>"
+
+[node name="Message" type="Label" parent="VBox"]
+layout_mode = 2
+size_flags_horizontal = 3
+text = "Message"
+autowrap_mode = 3
+
+[node name="FadeAway" type="Timer" parent="."]
+one_shot = true
+
+[connection signal="timeout" from="FadeAway" to="." method="_on_fade_away_timeout"]
diff --git a/client/menu/chat/chat_open.gd b/client/menu/chat/chat_open.gd
new file mode 100644
index 00000000..f5b93adf
--- /dev/null
+++ b/client/menu/chat/chat_open.gd
@@ -0,0 +1,47 @@
+# Hurry Curry! - 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 Menu
+class_name ChatOpen
+
+const CHAT_MESSAGE_SCENE = preload("res://menu/chat/chat_message.tscn")
+
+@onready var messages_container: VBoxContainer = $PanelContainer/MarginContainer/VBoxContainer/ScrollContainerCustom/Messages
+@onready var line: LineEdit = $PanelContainer/MarginContainer/VBoxContainer/LineEdit
+@onready var game_menu: GameMenu = get_parent()
+@onready var game: Game = game_menu.game
+
+func _ready() -> void:
+ super()
+ for i in game.text_message_history:
+ add_message(i[0], i[1])
+
+ game.text_message.connect(
+ func message(player: int, text: String, _timeout_initial: float, _timeout_remaining: float):
+ add_message(player, text)
+ )
+
+func _input(event: InputEvent) -> void:
+ if Input.is_action_just_pressed("chat"):
+ if line.text != "":
+ game.mp.send_chat(game.player_id, line.text)
+ exit()
+ super(event)
+
+func add_message(player: int, message: String):
+ var username: String = game.players[player].username
+ var chat_message: ChatMessage = CHAT_MESSAGE_SCENE.instantiate()
+ messages_container.add_child(chat_message)
+ chat_message.set_message("<%s>" % username, message)
diff --git a/client/menu/chat/chat_open.tscn b/client/menu/chat/chat_open.tscn
new file mode 100644
index 00000000..edd9f679
--- /dev/null
+++ b/client/menu/chat/chat_open.tscn
@@ -0,0 +1,50 @@
+[gd_scene load_steps=5 format=3 uid="uid://dbd6k56l4p0ls"]
+
+[ext_resource type="Script" path="res://menu/chat/chat_open.gd" id="1_dsl4a"]
+[ext_resource type="Material" uid="uid://beea1pc5nt67r" path="res://menu/theme/dark_blur_material.tres" id="1_isqmk"]
+[ext_resource type="Script" path="res://menu/blur_setup.gd" id="2_urbd2"]
+[ext_resource type="Theme" uid="uid://b0qmvo504e457" path="res://menu/theme/theme.tres" id="3_v7xmg"]
+
+[node name="ChatOpen" type="Control"]
+layout_mode = 3
+anchors_preset = 9
+anchor_bottom = 1.0
+offset_right = 296.0
+grow_vertical = 2
+script = ExtResource("1_dsl4a")
+support_anim = false
+
+[node name="PanelContainer" type="PanelContainer" parent="."]
+material = ExtResource("1_isqmk")
+layout_mode = 1
+anchors_preset = 9
+anchor_bottom = 1.0
+offset_right = 296.0
+grow_vertical = 2
+theme = ExtResource("3_v7xmg")
+script = ExtResource("2_urbd2")
+
+[node name="MarginContainer" type="MarginContainer" parent="PanelContainer"]
+layout_mode = 2
+
+[node name="VBoxContainer" type="VBoxContainer" parent="PanelContainer/MarginContainer"]
+layout_mode = 2
+size_flags_horizontal = 3
+size_flags_vertical = 3
+theme_override_constants/separation = 0
+
+[node name="ScrollContainerCustom" type="ScrollContainer" parent="PanelContainer/MarginContainer/VBoxContainer"]
+material = ExtResource("1_isqmk")
+layout_mode = 2
+size_flags_horizontal = 3
+size_flags_vertical = 3
+script = ExtResource("2_urbd2")
+
+[node name="Messages" type="VBoxContainer" parent="PanelContainer/MarginContainer/VBoxContainer/ScrollContainerCustom"]
+layout_mode = 2
+size_flags_horizontal = 3
+size_flags_vertical = 3
+
+[node name="LineEdit" type="LineEdit" parent="PanelContainer/MarginContainer/VBoxContainer"]
+layout_mode = 2
+placeholder_text = "Write message"
diff --git a/client/menu/chat/chat_preview.gd b/client/menu/chat/chat_preview.gd
new file mode 100644
index 00000000..189ca89b
--- /dev/null
+++ b/client/menu/chat/chat_preview.gd
@@ -0,0 +1,33 @@
+# Hurry Curry! - 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 Control
+
+const CHAT_MESSAGE_SCENE = preload("res://menu/chat/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(player: int, text: String, timeout_initial: float, timeout_remaining: float):
+ add_message(player, text, timeout_remaining)
+ )
+
+func add_message(player: int, message: String, time: float):
+ var username: String = game.players[player].username
+ var chat_message: ChatMessage = CHAT_MESSAGE_SCENE.instantiate()
+ messages_container.add_child(chat_message)
+ chat_message.set_message("<%s>" % username, message, true, time)
diff --git a/client/menu/chat/chat_preview.tscn b/client/menu/chat/chat_preview.tscn
new file mode 100644
index 00000000..a50b138a
--- /dev/null
+++ b/client/menu/chat/chat_preview.tscn
@@ -0,0 +1,39 @@
+[gd_scene load_steps=5 format=3 uid="uid://xcxbmynn8mhi"]
+
+[ext_resource type="Theme" uid="uid://b0qmvo504e457" path="res://menu/theme/theme.tres" id="1_x8ock"]
+[ext_resource type="Script" path="res://menu/chat/chat_preview.gd" id="2_72x70"]
+[ext_resource type="Material" uid="uid://beea1pc5nt67r" path="res://menu/theme/dark_blur_material.tres" id="4_jo1xn"]
+[ext_resource type="Script" path="res://menu/blur_setup.gd" id="5_1l77s"]
+
+[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_x8ock")
+script = ExtResource("2_72x70")
+
+[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("4_jo1xn")
+layout_mode = 2
+size_flags_horizontal = 3
+size_flags_vertical = 0
+mouse_filter = 2
+script = ExtResource("5_1l77s")
+
+[node name="Messages" type="VBoxContainer" parent="MarginContainer/ScrollContainer/PanelContainer"]
+layout_mode = 2
+mouse_filter = 2
diff --git a/client/menu/game.gd b/client/menu/game.gd
index 6eb87b16..1d961d3c 100644
--- a/client/menu/game.gd
+++ b/client/menu/game.gd
@@ -30,6 +30,10 @@ func _ready():
func _input(_event):
if Input.is_action_just_pressed("ui_menu"):
open_ingame_menu()
+
+ if Input.is_action_just_pressed("chat"):
+ Sound.play_click()
+ submenu("res://menu/chat/chat_open.tscn")
func _menu_cover(state):
game.camera.disable_input_menu = state
diff --git a/client/menu/game.tscn b/client/menu/game.tscn
index 1c19ccf7..cf596f77 100644
--- a/client/menu/game.tscn
+++ b/client/menu/game.tscn
@@ -1,10 +1,11 @@
-[gd_scene load_steps=6 format=3 uid="uid://bbjwoxs71fnsk"]
+[gd_scene load_steps=7 format=3 uid="uid://bbjwoxs71fnsk"]
[ext_resource type="Script" path="res://menu/game.gd" id="1_cdpsh"]
[ext_resource type="PackedScene" uid="uid://c6krh36hoqfg8" path="res://game.tscn" id="2_uojcy"]
[ext_resource type="PackedScene" uid="uid://bpikve6wlsjfl" path="res://menu/overlay.tscn" id="3_i0ytb"]
[ext_resource type="PackedScene" uid="uid://bc50la65ntifb" path="res://menu/lobby.tscn" id="3_udxby"]
[ext_resource type="PackedScene" uid="uid://b21nrnkygiyjt" path="res://menu/popup_message.tscn" id="5_n1wy0"]
+[ext_resource type="PackedScene" uid="uid://xcxbmynn8mhi" path="res://menu/chat/chat_preview.tscn" id="6_dh5lr"]
[node name="GameMenu" type="Control"]
layout_mode = 3
@@ -36,3 +37,6 @@ mouse_filter = 2
[node name="PopupMessage" parent="." instance=ExtResource("5_n1wy0")]
layout_mode = 1
+
+[node name="ChatPreview" parent="." instance=ExtResource("6_dh5lr")]
+layout_mode = 1
diff --git a/client/menu/lobby.tscn b/client/menu/lobby.tscn
index cde4c0b4..05b6507c 100644
--- a/client/menu/lobby.tscn
+++ b/client/menu/lobby.tscn
@@ -2,7 +2,7 @@
[ext_resource type="Theme" uid="uid://b0qmvo504e457" path="res://menu/theme/theme.tres" id="1_u18ke"]
[ext_resource type="Script" path="res://menu/lobby.gd" id="2_7657i"]
-[ext_resource type="StyleBox" uid="uid://de80aw86emnql" path="res://menu/theme/lobby_panel_override.tres" id="3_6iqoe"]
+[ext_resource type="StyleBox" uid="uid://de80aw86emnql" path="res://menu/theme/style/lobby_panel_override.tres" id="3_6iqoe"]
[ext_resource type="Material" uid="uid://beea1pc5nt67r" path="res://menu/theme/dark_blur_material.tres" id="3_esmbx"]
[ext_resource type="Texture2D" uid="uid://35rd5gamtyqm" path="res://menu/arrow.svg" id="3_jxleg"]
[ext_resource type="Texture2D" uid="uid://j75dbytlbju" path="res://menu/arrow_pressed.svg" id="4_eapmn"]
diff --git a/client/menu/theme/item_bubble_progress_style.tres b/client/menu/theme/style/item_bubble_progress_style.tres
index 69543f24..69543f24 100644
--- a/client/menu/theme/item_bubble_progress_style.tres
+++ b/client/menu/theme/style/item_bubble_progress_style.tres
diff --git a/client/menu/theme/lobby_panel_override.tres b/client/menu/theme/style/lobby_panel_override.tres
index 04fd16b0..04fd16b0 100644
--- a/client/menu/theme/lobby_panel_override.tres
+++ b/client/menu/theme/style/lobby_panel_override.tres
diff --git a/client/menu/theme/style/panel_style.tres b/client/menu/theme/style/panel_style.tres
new file mode 100644
index 00000000..d1f27667
--- /dev/null
+++ b/client/menu/theme/style/panel_style.tres
@@ -0,0 +1,8 @@
+[gd_resource type="StyleBoxFlat" format=3 uid="uid://bcd4xcvtv7tws"]
+
+[resource]
+bg_color = Color(0, 0, 0, 0.6)
+corner_radius_top_left = 8
+corner_radius_top_right = 8
+corner_radius_bottom_right = 8
+corner_radius_bottom_left = 8
diff --git a/client/menu/theme/theme.tres b/client/menu/theme/theme.tres
index defb9890..fff223c0 100644
--- a/client/menu/theme/theme.tres
+++ b/client/menu/theme/theme.tres
@@ -5,6 +5,7 @@
[ext_resource type="StyleBox" uid="uid://pi5uhe0lrgka" path="res://menu/theme/style/normal_style.tres" id="2_8fwoi"]
[ext_resource type="StyleBox" uid="uid://dua4jqje3704w" path="res://menu/theme/style/hover_style.tres" id="2_ye28t"]
[ext_resource type="FontFile" uid="uid://bo4vh5xkpvrh1" path="res://menu/theme/font-sansita-swashed.woff2" id="3_8u6ww"]
+[ext_resource type="StyleBox" uid="uid://bcd4xcvtv7tws" path="res://menu/theme/style/panel_style.tres" id="4_42dlp"]
[sub_resource type="StyleBoxLine" id="StyleBoxLine_emtvk"]
content_margin_top = 5.0
@@ -25,13 +26,6 @@ corner_radius_top_right = 5
corner_radius_bottom_right = 5
corner_radius_bottom_left = 5
-[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_sjrhv"]
-bg_color = Color(0, 0, 0, 0.6)
-corner_radius_top_left = 8
-corner_radius_top_right = 8
-corner_radius_bottom_right = 8
-corner_radius_bottom_left = 8
-
[sub_resource type="FontVariation" id="FontVariation_ff4nr"]
base_font = ExtResource("3_8u6ww")
variation_embolden = 0.7
@@ -65,7 +59,8 @@ MarginContainer/constants/margin_bottom = 32
MarginContainer/constants/margin_left = 32
MarginContainer/constants/margin_right = 32
MarginContainer/constants/margin_top = 32
-Panel/styles/panel = SubResource("StyleBoxFlat_sjrhv")
+Panel/styles/panel = ExtResource("4_42dlp")
+PanelContainer/styles/panel = ExtResource("4_42dlp")
RichTextLabel/fonts/bold_font = SubResource("FontVariation_ff4nr")
RichTextLabel/fonts/bold_italics_font = SubResource("FontVariation_lyo8w")
RichTextLabel/fonts/italics_font = SubResource("FontVariation_lyo8w")