aboutsummaryrefslogtreecommitdiff
path: root/client
diff options
context:
space:
mode:
authormetamuffin <metamuffin@disroot.org>2025-10-09 20:58:33 +0200
committermetamuffin <metamuffin@disroot.org>2025-10-09 20:58:36 +0200
commit0134c4163fc6aba1aad8e0e8a5800b4967143bdb (patch)
tree7c5531915481213c0c577fe1d59e3693cb22f10b /client
parent135f1288f023671be7d36610bb7d61bde3f1fc7b (diff)
downloadhurrycurry-0134c4163fc6aba1aad8e0e8a5800b4967143bdb.tar
hurrycurry-0134c4163fc6aba1aad8e0e8a5800b4967143bdb.tar.bz2
hurrycurry-0134c4163fc6aba1aad8e0e8a5800b4967143bdb.tar.zst
Add scoreboard menu
Diffstat (limited to 'client')
-rw-r--r--client/game.gd2
-rw-r--r--client/gui/menus/scoreboard.gd43
-rw-r--r--client/gui/menus/scoreboard.gd.uid1
-rw-r--r--client/gui/menus/scoreboard.tscn114
-rw-r--r--client/gui/overlays/popup_message/server_message.gd15
5 files changed, 175 insertions, 0 deletions
diff --git a/client/game.gd b/client/game.gd
index 1316597e..731eceac 100644
--- a/client/game.gd
+++ b/client/game.gd
@@ -351,6 +351,8 @@ func handle_packet(p):
match p.menu:
"score":
menu.submenu("res://gui/menus/rating/rating.tscn", [p.data.stars, p.data.points])
+ "scoreboard":
+ menu.submenu("res://gui/menus/scoreboard.tscn", p.data)
"announce_start":
overlay_announce_title.announce_start()
"server_message":
diff --git a/client/gui/menus/scoreboard.gd b/client/gui/menus/scoreboard.gd
new file mode 100644
index 00000000..c04a3201
--- /dev/null
+++ b/client/gui/menus/scoreboard.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 <https://www.gnu.org/licenses/>.
+#
+extends Menu
+
+@onready var table: GridContainer = $OuterMargin/Panel/InnerMargin/VBoxContainer/ScrollContainer/Table
+@onready var title: Label = $OuterMargin/Panel/InnerMargin/VBoxContainer/Title
+@onready var play_count: Label = $OuterMargin/Panel/InnerMargin/VBoxContainer/PlayCount
+
+@export var font: Font
+
+func _ready() -> void:
+ super()
+ var i = 1
+ title.text = tr("c.menu.scoreboard.title").format([data.map])
+ play_count.text = tr("c.menu.scoreboard.finish_count").format([int(data.plays)])
+ for entry in data.best:
+ push_label("%d." % i)
+ push_label("%d" % entry.score.points)
+ push_label(", ".join(entry.players))
+ i += 1
+
+func push_label(text: String):
+ var label = Label.new()
+ label.add_theme_font_size_override("font_size", 21)
+ label.add_theme_font_override("font", font)
+ label.text = text
+ table.add_child(label)
+
+func _on_back_pressed() -> void:
+ exit()
diff --git a/client/gui/menus/scoreboard.gd.uid b/client/gui/menus/scoreboard.gd.uid
new file mode 100644
index 00000000..53f2b288
--- /dev/null
+++ b/client/gui/menus/scoreboard.gd.uid
@@ -0,0 +1 @@
+uid://d3dd83ooacgmw
diff --git a/client/gui/menus/scoreboard.tscn b/client/gui/menus/scoreboard.tscn
new file mode 100644
index 00000000..4d9f3bd2
--- /dev/null
+++ b/client/gui/menus/scoreboard.tscn
@@ -0,0 +1,114 @@
+[gd_scene load_steps=11 format=3 uid="uid://cgevgyr5out81"]
+
+[ext_resource type="Script" uid="uid://d3dd83ooacgmw" path="res://gui/menus/scoreboard.gd" id="1_8iwl3"]
+[ext_resource type="Script" uid="uid://byshs20og68tn" path="res://gui/components/smart_margin_container.gd" id="1_bfqap"]
+[ext_resource type="Material" uid="uid://beea1pc5nt67r" path="res://gui/resources/materials/dark_blur_material.tres" id="2_s6kc8"]
+[ext_resource type="Script" uid="uid://cmncjc06kadpe" path="res://gui/components/blur_setup.gd" id="3_8iwl3"]
+[ext_resource type="Script" uid="uid://bd7bylb2t2m0" path="res://gui/components/touch_scroll_container.gd" id="5_c3g22"]
+[ext_resource type="FontFile" uid="uid://5ixo6b3bd3km" path="res://gui/resources/fonts/font-josefin-sans.woff2" id="6_b3vhr"]
+[ext_resource type="FontVariation" uid="uid://cl6m4hqsnrpav" path="res://gui/resources/fonts/sansita-swashed-bold.tres" id="7_tlf07"]
+
+[sub_resource type="Theme" id="Theme_grptf"]
+
+[sub_resource type="FontVariation" id="FontVariation_t5x0r"]
+base_font = ExtResource("7_tlf07")
+variation_opentype = {
+2003265652: 800
+}
+
+[sub_resource type="FontVariation" id="FontVariation_tlf07"]
+base_font = ExtResource("6_b3vhr")
+variation_opentype = {
+2003265652: 700
+}
+
+[node name="Scoreboard" type="Control"]
+layout_mode = 3
+anchors_preset = 15
+anchor_right = 1.0
+anchor_bottom = 1.0
+grow_horizontal = 2
+grow_vertical = 2
+theme = SubResource("Theme_grptf")
+script = ExtResource("1_8iwl3")
+support_anim = false
+
+[node name="OuterMargin" type="MarginContainer" parent="."]
+layout_mode = 1
+anchors_preset = 15
+anchor_right = 1.0
+anchor_bottom = 1.0
+grow_horizontal = 2
+grow_vertical = 2
+theme_override_constants/margin_left = 50
+theme_override_constants/margin_top = 50
+theme_override_constants/margin_right = 50
+theme_override_constants/margin_bottom = 50
+script = ExtResource("1_bfqap")
+
+[node name="Panel" type="Panel" parent="OuterMargin"]
+material = ExtResource("2_s6kc8")
+layout_mode = 2
+script = ExtResource("3_8iwl3")
+
+[node name="InnerMargin" type="MarginContainer" parent="OuterMargin/Panel"]
+layout_mode = 1
+anchors_preset = 15
+anchor_right = 1.0
+anchor_bottom = 1.0
+grow_horizontal = 2
+grow_vertical = 2
+theme_override_constants/margin_left = 50
+theme_override_constants/margin_top = 50
+theme_override_constants/margin_right = 50
+theme_override_constants/margin_bottom = 50
+
+[node name="VBoxContainer" type="VBoxContainer" parent="OuterMargin/Panel/InnerMargin"]
+layout_mode = 2
+size_flags_horizontal = 3
+
+[node name="Title" type="Label" parent="OuterMargin/Panel/InnerMargin/VBoxContainer"]
+layout_mode = 2
+theme_override_fonts/font = SubResource("FontVariation_t5x0r")
+theme_override_font_sizes/font_size = 48
+text = "Scoreboard for placeholder"
+horizontal_alignment = 1
+
+[node name="PlayCount" type="Label" parent="OuterMargin/Panel/InnerMargin/VBoxContainer"]
+layout_mode = 2
+text = "123 games were played on this map"
+horizontal_alignment = 1
+
+[node name="ScrollContainer" type="ScrollContainer" parent="OuterMargin/Panel/InnerMargin/VBoxContainer"]
+layout_mode = 2
+size_flags_vertical = 3
+script = ExtResource("5_c3g22")
+
+[node name="Table" type="GridContainer" parent="OuterMargin/Panel/InnerMargin/VBoxContainer/ScrollContainer"]
+layout_mode = 2
+columns = 3
+
+[node name="Rank" type="Label" parent="OuterMargin/Panel/InnerMargin/VBoxContainer/ScrollContainer/Table"]
+layout_mode = 2
+theme_override_fonts/font = SubResource("FontVariation_tlf07")
+theme_override_font_sizes/font_size = 21
+text = "c.menu.scoreboard.rank"
+
+[node name="Points" type="Label" parent="OuterMargin/Panel/InnerMargin/VBoxContainer/ScrollContainer/Table"]
+layout_mode = 2
+theme_override_fonts/font = SubResource("FontVariation_tlf07")
+theme_override_font_sizes/font_size = 21
+text = "c.score.points"
+
+[node name="Players" type="Label" parent="OuterMargin/Panel/InnerMargin/VBoxContainer/ScrollContainer/Table"]
+layout_mode = 2
+size_flags_horizontal = 3
+theme_override_fonts/font = SubResource("FontVariation_tlf07")
+theme_override_font_sizes/font_size = 21
+text = "c.menu.scoreboard.players"
+
+[node name="Back" type="Button" parent="OuterMargin/Panel/InnerMargin/VBoxContainer"]
+layout_mode = 2
+text = "c.menu.back"
+
+[connection signal="pressed" from="OuterMargin/Panel/InnerMargin/VBoxContainer/Back" to="." method="_on_back_pressed"]
diff --git a/client/gui/overlays/popup_message/server_message.gd b/client/gui/overlays/popup_message/server_message.gd
index a0688dc5..76ff9361 100644
--- a/client/gui/overlays/popup_message/server_message.gd
+++ b/client/gui/overlays/popup_message/server_message.gd
@@ -1,3 +1,18 @@
+# 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 <https://www.gnu.org/licenses/>.
+#
extends BlurSetup
class_name ServerMessage