feat: update leaderboard GUI, and HUD for gauge

This commit is contained in:
2026-03-25 02:38:09 +08:00
parent 7ca63fea00
commit cda39125f4
18 changed files with 699 additions and 64 deletions
+13
View File
@@ -467,6 +467,12 @@ func _setup_global_match_timer_ui():
func _process(delta):
if not is_inside_tree(): return
if not check_multiplayer(): return
if ui_manager and get_tree():
var all_players = get_tree().get_nodes_in_group("Players")
if all_players.size() > 0:
ui_manager.update_live_leaderboard(all_players)
if multiplayer.is_server() and GameStateManager.is_game_started():
if TurnManager.turn_based_mode:
rpc("sync_turn_index", TurnManager.current_turn_index)
@@ -2268,6 +2274,12 @@ func request_leaderboard_sync():
@rpc("authority", "call_local", "reliable")
func sync_leaderboard_data(player_data: Array):
"""Receive leaderboard data from server and update UI."""
# Update local player node scores first so live UI tick stays synced
for data in player_data:
var p_node = get_node_or_null(str(data.peer_id))
if p_node:
p_node.score = data.score
var leaderboard_panel = get_node_or_null("LeaderboardPanel")
if not leaderboard_panel:
return
@@ -2309,6 +2321,7 @@ func _update_leaderboard_display():
for p in all_players:
var peer_id = p.name.to_int()
var score = goals_cycle_manager.get_player_score(peer_id) if goals_cycle_manager else 0
p.score = score # Assign locally so ui_manager.gd reads correct score
player_data.append({"peer_id": peer_id, "name": p.display_name if not p.display_name.is_empty() else str(p.name), "score": score})
# Sort by score descending (with Stop n Go winner priority)
+193 -42
View File
@@ -14,6 +14,10 @@
[ext_resource type="Texture2D" uid="uid://68x88jj25yxg" path="res://assets/textures/Adjacent.png" id="9_6gcb6"]
[ext_resource type="Texture2D" uid="uid://dasaeaytvhll0" path="res://assets/models/pboard/AdjacentRect.tres" id="9_aspsw"]
[ext_resource type="FontFile" uid="uid://xnjx058n4tsw" path="res://assets/fonts/Nougat-ExtraBlack.ttf" id="13_j8jky"]
[ext_resource type="Texture2D" uid="uid://73ayhl1lqdpt" path="res://assets/graphics/gui/gauge/PowerLabel.png" id="14_vxglm"]
[ext_resource type="Texture2D" uid="uid://dcoaeof23pt3c" path="res://assets/graphics/gui/gauge/Segment0_empty.png" id="15_2f3dj"]
[ext_resource type="Texture2D" uid="uid://ctgxeo2i3vcfq" path="res://assets/graphics/gui/gauge/Segment1_empty.png" id="16_yq6so"]
[ext_resource type="Texture2D" uid="uid://djbin5556lwsx" path="res://assets/graphics/gui/gauge/Segment2_empty.png" id="17_fv21b"]
[ext_resource type="Theme" uid="uid://0dhxl4ohyxh8" path="res://assets/graphics/game_setting/setting_theme.tres" id="18_pm3ni"]
[ext_resource type="Texture2D" uid="uid://ba80xnybpixw2" path="res://assets/graphics/touch_control/take_tile.png" id="25_qkpxi"]
[ext_resource type="Texture2D" uid="uid://bsgqrjx2ity4c" path="res://assets/graphics/touch_control/speed.png" id="26_2f3dj"]
@@ -47,6 +51,20 @@ corner_radius_top_right = 8
corner_radius_bottom_right = 8
corner_radius_bottom_left = 8
[sub_resource type="StyleBoxTexture" id="StyleBoxTexture_tel4y"]
[sub_resource type="StyleBoxTexture" id="StyleBoxTexture_qkpxi"]
texture = ExtResource("14_vxglm")
[sub_resource type="StyleBoxTexture" id="StyleBoxTexture_5q0nq"]
texture = ExtResource("15_2f3dj")
[sub_resource type="StyleBoxTexture" id="StyleBoxTexture_dgi5k"]
texture = ExtResource("16_yq6so")
[sub_resource type="StyleBoxTexture" id="StyleBoxTexture_j8jky"]
texture = ExtResource("17_fv21b")
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_1cewu"]
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_kmb1v"]
@@ -1079,37 +1097,38 @@ layout_mode = 2
anchors_preset = 4
anchor_top = 0.5
anchor_bottom = 0.5
offset_left = 40.0
offset_top = -1.7106018
offset_right = 224.0
offset_bottom = 31.28952
offset_left = 84.0
offset_top = -7.0
offset_right = 229.0
offset_bottom = 29.0
grow_vertical = 2
rotation = -0.10297442
theme_override_styles/panel = SubResource("StyleBoxTexture_tel4y")
[node name="HBox" type="HBoxContainer" parent="PowerUpBar" unique_id=334600330]
layout_mode = 2
theme_override_constants/separation = 4
theme_override_constants/separation = 0
alignment = 1
[node name="PowerLabel" type="Label" parent="PowerUpBar/HBox" unique_id=1945535407]
[node name="PowerLabel" type="Panel" parent="PowerUpBar/HBox" unique_id=1662719884]
custom_minimum_size = Vector2(39, 36)
layout_mode = 2
theme_override_font_sizes/font_size = 18
text = "⚡"
theme_override_styles/panel = SubResource("StyleBoxTexture_qkpxi")
[node name="Segment0" type="Panel" parent="PowerUpBar/HBox" unique_id=500774723]
custom_minimum_size = Vector2(36, 20)
custom_minimum_size = Vector2(33, 36)
layout_mode = 2
theme_override_styles/panel = SubResource("StyleBoxTexture_5q0nq")
[node name="Segment1" type="Panel" parent="PowerUpBar/HBox" unique_id=1042222722]
custom_minimum_size = Vector2(36, 20)
custom_minimum_size = Vector2(33, 36)
layout_mode = 2
theme_override_styles/panel = SubResource("StyleBoxTexture_dgi5k")
[node name="Segment2" type="Panel" parent="PowerUpBar/HBox" unique_id=272336972]
custom_minimum_size = Vector2(36, 20)
layout_mode = 2
[node name="Segment3" type="Panel" parent="PowerUpBar/HBox" unique_id=293120308]
custom_minimum_size = Vector2(36, 20)
custom_minimum_size = Vector2(40, 36)
layout_mode = 2
theme_override_styles/panel = SubResource("StyleBoxTexture_j8jky")
[node name="GoalsTimer" type="PanelContainer" parent="." unique_id=2106663301]
offset_left = 235.8717
@@ -1229,17 +1248,26 @@ horizontal_alignment = 1
[node name="Separator" type="HSeparator" parent="LeaderboardPanel/MarginContainer/VBox" unique_id=1615297005]
layout_mode = 2
[node name="Entry1" type="HBoxContainer" parent="LeaderboardPanel/MarginContainer/VBox" unique_id=1372346601]
[node name="Entry1" type="PanelContainer" parent="LeaderboardPanel/MarginContainer/VBox" unique_id=1372346601]
layout_mode = 2
[node name="RankLabel" type="Label" parent="LeaderboardPanel/MarginContainer/VBox/Entry1" unique_id=828754165]
[node name="HBox" type="HBoxContainer" parent="LeaderboardPanel/MarginContainer/VBox/Entry1" unique_id=617135879]
layout_mode = 2
[node name="RankLabel" type="Label" parent="LeaderboardPanel/MarginContainer/VBox/Entry1/HBox" unique_id=828754165]
custom_minimum_size = Vector2(50, 0)
layout_mode = 2
theme_override_fonts/font = ExtResource("13_j8jky")
theme_override_font_sizes/font_size = 22
text = "1st"
[node name="NameLabel" type="Label" parent="LeaderboardPanel/MarginContainer/VBox/Entry1" unique_id=777741978]
[node name="PortraitRect" type="TextureRect" parent="LeaderboardPanel/MarginContainer/VBox/Entry1/HBox" unique_id=1512406425]
custom_minimum_size = Vector2(24, 24)
layout_mode = 2
expand_mode = 1
stretch_mode = 5
[node name="NameLabel" type="Label" parent="LeaderboardPanel/MarginContainer/VBox/Entry1/HBox" unique_id=777741978]
custom_minimum_size = Vector2(100, 0)
layout_mode = 2
theme_override_fonts/font = ExtResource("13_j8jky")
@@ -1247,7 +1275,14 @@ theme_override_font_sizes/font_size = 22
text = "Player 1"
clip_text = true
[node name="ScoreLabel" type="Label" parent="LeaderboardPanel/MarginContainer/VBox/Entry1" unique_id=163441394]
[node name="GhostIcon" type="TextureRect" parent="LeaderboardPanel/MarginContainer/VBox/Entry1/HBox" unique_id=143108099]
modulate = Color(1, 1, 1, 0)
custom_minimum_size = Vector2(16, 16)
layout_mode = 2
expand_mode = 1
stretch_mode = 5
[node name="ScoreLabel" type="Label" parent="LeaderboardPanel/MarginContainer/VBox/Entry1/HBox" unique_id=163441394]
layout_mode = 2
size_flags_horizontal = 3
theme_override_fonts/font = ExtResource("13_j8jky")
@@ -1255,17 +1290,43 @@ theme_override_font_sizes/font_size = 22
text = "0"
horizontal_alignment = 2
[node name="Entry2" type="HBoxContainer" parent="LeaderboardPanel/MarginContainer/VBox" unique_id=1213770719]
[node name="MiniPowerUpBar" type="HBoxContainer" parent="LeaderboardPanel/MarginContainer/VBox/Entry1/HBox" unique_id=1277323584]
layout_mode = 2
theme_override_constants/separation = 2
alignment = 1
[node name="Segment0" type="Panel" parent="LeaderboardPanel/MarginContainer/VBox/Entry1/HBox/MiniPowerUpBar" unique_id=797392101]
custom_minimum_size = Vector2(12, 12)
layout_mode = 2
[node name="RankLabel" type="Label" parent="LeaderboardPanel/MarginContainer/VBox/Entry2" unique_id=276085006]
[node name="Segment1" type="Panel" parent="LeaderboardPanel/MarginContainer/VBox/Entry1/HBox/MiniPowerUpBar" unique_id=789099266]
custom_minimum_size = Vector2(12, 12)
layout_mode = 2
[node name="Segment2" type="Panel" parent="LeaderboardPanel/MarginContainer/VBox/Entry1/HBox/MiniPowerUpBar" unique_id=1018238656]
custom_minimum_size = Vector2(12, 12)
layout_mode = 2
[node name="Entry2" type="PanelContainer" parent="LeaderboardPanel/MarginContainer/VBox" unique_id=1213770719]
layout_mode = 2
[node name="HBox" type="HBoxContainer" parent="LeaderboardPanel/MarginContainer/VBox/Entry2" unique_id=649896203]
layout_mode = 2
[node name="RankLabel" type="Label" parent="LeaderboardPanel/MarginContainer/VBox/Entry2/HBox" unique_id=276085006]
custom_minimum_size = Vector2(50, 0)
layout_mode = 2
theme_override_fonts/font = ExtResource("13_j8jky")
theme_override_font_sizes/font_size = 22
text = "2nd"
[node name="NameLabel" type="Label" parent="LeaderboardPanel/MarginContainer/VBox/Entry2" unique_id=980063105]
[node name="PortraitRect" type="TextureRect" parent="LeaderboardPanel/MarginContainer/VBox/Entry2/HBox" unique_id=1005069505]
custom_minimum_size = Vector2(24, 24)
layout_mode = 2
expand_mode = 1
stretch_mode = 5
[node name="NameLabel" type="Label" parent="LeaderboardPanel/MarginContainer/VBox/Entry2/HBox" unique_id=980063105]
custom_minimum_size = Vector2(100, 0)
layout_mode = 2
theme_override_fonts/font = ExtResource("13_j8jky")
@@ -1273,7 +1334,14 @@ theme_override_font_sizes/font_size = 22
text = "Player 2"
clip_text = true
[node name="ScoreLabel" type="Label" parent="LeaderboardPanel/MarginContainer/VBox/Entry2" unique_id=630589738]
[node name="GhostIcon" type="TextureRect" parent="LeaderboardPanel/MarginContainer/VBox/Entry2/HBox" unique_id=1898054695]
modulate = Color(1, 1, 1, 0)
custom_minimum_size = Vector2(16, 16)
layout_mode = 2
expand_mode = 1
stretch_mode = 5
[node name="ScoreLabel" type="Label" parent="LeaderboardPanel/MarginContainer/VBox/Entry2/HBox" unique_id=630589738]
layout_mode = 2
size_flags_horizontal = 3
theme_override_fonts/font = ExtResource("13_j8jky")
@@ -1281,17 +1349,43 @@ theme_override_font_sizes/font_size = 22
text = "0"
horizontal_alignment = 2
[node name="Entry3" type="HBoxContainer" parent="LeaderboardPanel/MarginContainer/VBox" unique_id=988674004]
[node name="MiniPowerUpBar" type="HBoxContainer" parent="LeaderboardPanel/MarginContainer/VBox/Entry2/HBox" unique_id=719453508]
layout_mode = 2
theme_override_constants/separation = 2
alignment = 1
[node name="Segment0" type="Panel" parent="LeaderboardPanel/MarginContainer/VBox/Entry2/HBox/MiniPowerUpBar" unique_id=1487042283]
custom_minimum_size = Vector2(12, 12)
layout_mode = 2
[node name="RankLabel" type="Label" parent="LeaderboardPanel/MarginContainer/VBox/Entry3" unique_id=940102589]
[node name="Segment1" type="Panel" parent="LeaderboardPanel/MarginContainer/VBox/Entry2/HBox/MiniPowerUpBar" unique_id=1303981736]
custom_minimum_size = Vector2(12, 12)
layout_mode = 2
[node name="Segment2" type="Panel" parent="LeaderboardPanel/MarginContainer/VBox/Entry2/HBox/MiniPowerUpBar" unique_id=564492200]
custom_minimum_size = Vector2(12, 12)
layout_mode = 2
[node name="Entry3" type="PanelContainer" parent="LeaderboardPanel/MarginContainer/VBox" unique_id=988674004]
layout_mode = 2
[node name="HBox" type="HBoxContainer" parent="LeaderboardPanel/MarginContainer/VBox/Entry3" unique_id=2098193159]
layout_mode = 2
[node name="RankLabel" type="Label" parent="LeaderboardPanel/MarginContainer/VBox/Entry3/HBox" unique_id=940102589]
custom_minimum_size = Vector2(50, 0)
layout_mode = 2
theme_override_fonts/font = ExtResource("13_j8jky")
theme_override_font_sizes/font_size = 22
text = "3rd"
[node name="NameLabel" type="Label" parent="LeaderboardPanel/MarginContainer/VBox/Entry3" unique_id=872999463]
[node name="PortraitRect" type="TextureRect" parent="LeaderboardPanel/MarginContainer/VBox/Entry3/HBox" unique_id=77999167]
custom_minimum_size = Vector2(24, 24)
layout_mode = 2
expand_mode = 1
stretch_mode = 5
[node name="NameLabel" type="Label" parent="LeaderboardPanel/MarginContainer/VBox/Entry3/HBox" unique_id=872999463]
custom_minimum_size = Vector2(100, 0)
layout_mode = 2
theme_override_fonts/font = ExtResource("13_j8jky")
@@ -1299,7 +1393,14 @@ theme_override_font_sizes/font_size = 22
text = "Player 3"
clip_text = true
[node name="ScoreLabel" type="Label" parent="LeaderboardPanel/MarginContainer/VBox/Entry3" unique_id=508325054]
[node name="GhostIcon" type="TextureRect" parent="LeaderboardPanel/MarginContainer/VBox/Entry3/HBox" unique_id=1209672815]
modulate = Color(1, 1, 1, 0)
custom_minimum_size = Vector2(16, 16)
layout_mode = 2
expand_mode = 1
stretch_mode = 5
[node name="ScoreLabel" type="Label" parent="LeaderboardPanel/MarginContainer/VBox/Entry3/HBox" unique_id=508325054]
layout_mode = 2
size_flags_horizontal = 3
theme_override_fonts/font = ExtResource("13_j8jky")
@@ -1307,17 +1408,43 @@ theme_override_font_sizes/font_size = 22
text = "0"
horizontal_alignment = 2
[node name="Entry4" type="HBoxContainer" parent="LeaderboardPanel/MarginContainer/VBox" unique_id=394023021]
[node name="MiniPowerUpBar" type="HBoxContainer" parent="LeaderboardPanel/MarginContainer/VBox/Entry3/HBox" unique_id=1235595014]
layout_mode = 2
theme_override_constants/separation = 2
alignment = 1
[node name="Segment0" type="Panel" parent="LeaderboardPanel/MarginContainer/VBox/Entry3/HBox/MiniPowerUpBar" unique_id=1321277357]
custom_minimum_size = Vector2(12, 12)
layout_mode = 2
[node name="RankLabel" type="Label" parent="LeaderboardPanel/MarginContainer/VBox/Entry4" unique_id=539805932]
[node name="Segment1" type="Panel" parent="LeaderboardPanel/MarginContainer/VBox/Entry3/HBox/MiniPowerUpBar" unique_id=847275899]
custom_minimum_size = Vector2(12, 12)
layout_mode = 2
[node name="Segment2" type="Panel" parent="LeaderboardPanel/MarginContainer/VBox/Entry3/HBox/MiniPowerUpBar" unique_id=701782565]
custom_minimum_size = Vector2(12, 12)
layout_mode = 2
[node name="Entry4" type="PanelContainer" parent="LeaderboardPanel/MarginContainer/VBox" unique_id=394023021]
layout_mode = 2
[node name="HBox" type="HBoxContainer" parent="LeaderboardPanel/MarginContainer/VBox/Entry4" unique_id=1481335373]
layout_mode = 2
[node name="RankLabel" type="Label" parent="LeaderboardPanel/MarginContainer/VBox/Entry4/HBox" unique_id=539805932]
custom_minimum_size = Vector2(50, 0)
layout_mode = 2
theme_override_fonts/font = ExtResource("13_j8jky")
theme_override_font_sizes/font_size = 22
text = "4th"
[node name="NameLabel" type="Label" parent="LeaderboardPanel/MarginContainer/VBox/Entry4" unique_id=379355680]
[node name="PortraitRect" type="TextureRect" parent="LeaderboardPanel/MarginContainer/VBox/Entry4/HBox" unique_id=736863972]
custom_minimum_size = Vector2(24, 24)
layout_mode = 2
expand_mode = 1
stretch_mode = 5
[node name="NameLabel" type="Label" parent="LeaderboardPanel/MarginContainer/VBox/Entry4/HBox" unique_id=379355680]
custom_minimum_size = Vector2(100, 0)
layout_mode = 2
theme_override_fonts/font = ExtResource("13_j8jky")
@@ -1325,7 +1452,14 @@ theme_override_font_sizes/font_size = 22
text = "Player 4"
clip_text = true
[node name="ScoreLabel" type="Label" parent="LeaderboardPanel/MarginContainer/VBox/Entry4" unique_id=560418594]
[node name="GhostIcon" type="TextureRect" parent="LeaderboardPanel/MarginContainer/VBox/Entry4/HBox" unique_id=1812577580]
modulate = Color(1, 1, 1, 0)
custom_minimum_size = Vector2(16, 16)
layout_mode = 2
expand_mode = 1
stretch_mode = 5
[node name="ScoreLabel" type="Label" parent="LeaderboardPanel/MarginContainer/VBox/Entry4/HBox" unique_id=560418594]
layout_mode = 2
size_flags_horizontal = 3
theme_override_fonts/font = ExtResource("13_j8jky")
@@ -1333,6 +1467,23 @@ theme_override_font_sizes/font_size = 22
text = "0"
horizontal_alignment = 2
[node name="MiniPowerUpBar" type="HBoxContainer" parent="LeaderboardPanel/MarginContainer/VBox/Entry4/HBox" unique_id=2059921947]
layout_mode = 2
theme_override_constants/separation = 2
alignment = 1
[node name="Segment0" type="Panel" parent="LeaderboardPanel/MarginContainer/VBox/Entry4/HBox/MiniPowerUpBar" unique_id=1695101926]
custom_minimum_size = Vector2(12, 12)
layout_mode = 2
[node name="Segment1" type="Panel" parent="LeaderboardPanel/MarginContainer/VBox/Entry4/HBox/MiniPowerUpBar" unique_id=1697515395]
custom_minimum_size = Vector2(12, 12)
layout_mode = 2
[node name="Segment2" type="Panel" parent="LeaderboardPanel/MarginContainer/VBox/Entry4/HBox/MiniPowerUpBar" unique_id=500915161]
custom_minimum_size = Vector2(12, 12)
layout_mode = 2
[node name="GlobalMatchTimer" type="PanelContainer" parent="." unique_id=1714357974]
anchors_preset = 5
anchor_left = 0.5
@@ -1355,17 +1506,6 @@ theme_override_font_sizes/font_size = 28
text = "3:00"
horizontal_alignment = 1
[node name="SettingsBtn" type="Button" parent="." unique_id=1964422444]
anchors_preset = 1
anchor_left = 1.0
anchor_right = 1.0
offset_left = -78.0
offset_top = 8.0
offset_right = -30.0
offset_bottom = 56.0
grow_horizontal = 0
text = "⚙"
[node name="TouchControls" type="CanvasLayer" parent="." unique_id=1390485948]
script = ExtResource("touch_manager")
@@ -1730,6 +1870,17 @@ custom_minimum_size = Vector2(0, 40)
layout_mode = 2
text = "Back"
[node name="SettingsBtn" type="Button" parent="." unique_id=1964422444]
anchors_preset = 1
anchor_left = 1.0
anchor_right = 1.0
offset_left = -78.0
offset_top = 8.0
offset_right = -30.0
offset_bottom = 56.0
grow_horizontal = 0
text = "⚙"
[connection signal="text_submitted" from="MessageInput" to="." method="_on_message_input_text_submitted"]
[connection signal="pressed" from="PauseMenu/Panel/VBox/ResumeBtn" to="." method="_on_resume_pressed"]
[connection signal="pressed" from="PauseMenu/Panel/VBox/HowToPlayBtn" to="." method="_on_how_to_play_pressed"]