feat : Refactored Game Over UI from programmatic to scene-based architecture and resolved critical multiplayer/spawn bugs

This commit is contained in:
2026-04-01 06:06:09 +08:00
parent a88839b396
commit f2739841c6
5 changed files with 816 additions and 195 deletions
+504
View File
@@ -0,0 +1,504 @@
[gd_scene format=3]
[ext_resource type="Script" path="res://scripts/ui/game_over_panel.gd" id="1_script"]
[ext_resource type="FontFile" uid="uid://xnjx058n4tsw" path="res://assets/fonts/Nougat-ExtraBlack.ttf" id="2_font"]
[ext_resource type="PackedScene" uid="uid://ejeamn0pyey4" path="res://assets/characters/Bob.glb" id="3_bob"]
[ext_resource type="PackedScene" uid="uid://d4cul3w3wem5w" path="res://assets/characters/Gatot.glb" id="4_gatot"]
[ext_resource type="PackedScene" uid="uid://1vk0mjnwkngi" path="res://assets/characters/Masbro.glb" id="5_masbro"]
[ext_resource type="PackedScene" uid="uid://bmln7v6v5kvxg" path="res://assets/characters/Oldpop.glb" id="6_oldpop"]
[ext_resource type="AnimationLibrary" uid="uid://c3pyopnwibckj" path="res://assets/characters/animations/animation-pack.res" id="7_animlib"]
[sub_resource type="Environment" id="Environment_preview"]
background_mode = 1
background_color = Color(0.06, 0.07, 0.1, 0)
ambient_light_source = 2
ambient_light_color = Color(0.5, 0.55, 0.75, 1)
ambient_light_energy = 0.7
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_header"]
bg_color = Color(0.95, 0.75, 0.1, 1)
corner_radius_top_left = 8
corner_radius_top_right = 8
content_margin_left = 16.0
content_margin_top = 8.0
content_margin_right = 16.0
content_margin_bottom = 8.0
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_content"]
bg_color = Color(0.08, 0.1, 0.2, 0.95)
corner_radius_bottom_left = 8
content_margin_left = 20.0
content_margin_top = 16.0
content_margin_right = 20.0
content_margin_bottom = 16.0
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_back_normal"]
bg_color = Color(0.75, 0.15, 0.15, 1)
corner_radius_top_left = 6
corner_radius_top_right = 6
corner_radius_bottom_right = 6
corner_radius_bottom_left = 6
content_margin_left = 16.0
content_margin_top = 8.0
content_margin_right = 16.0
content_margin_bottom = 8.0
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_back_hover"]
bg_color = Color(0.9, 0.2, 0.2, 1)
corner_radius_top_left = 6
corner_radius_top_right = 6
corner_radius_bottom_right = 6
corner_radius_bottom_left = 6
content_margin_left = 16.0
content_margin_top = 8.0
content_margin_right = 16.0
content_margin_bottom = 8.0
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_back_pressed"]
bg_color = Color(0.6, 0.1, 0.1, 1)
corner_radius_top_left = 6
corner_radius_top_right = 6
corner_radius_bottom_right = 6
corner_radius_bottom_left = 6
content_margin_left = 16.0
content_margin_top = 8.0
content_margin_right = 16.0
content_margin_bottom = 8.0
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_rematch_normal"]
bg_color = Color(0.15, 0.7, 0.15, 1)
corner_radius_top_left = 6
corner_radius_top_right = 6
corner_radius_bottom_right = 6
corner_radius_bottom_left = 6
content_margin_left = 16.0
content_margin_top = 8.0
content_margin_right = 16.0
content_margin_bottom = 8.0
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_rematch_hover"]
bg_color = Color(0.2, 0.85, 0.2, 1)
corner_radius_top_left = 6
corner_radius_top_right = 6
corner_radius_bottom_right = 6
corner_radius_bottom_left = 6
content_margin_left = 16.0
content_margin_top = 8.0
content_margin_right = 16.0
content_margin_bottom = 8.0
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_rematch_pressed"]
bg_color = Color(0.1, 0.55, 0.1, 1)
corner_radius_top_left = 6
corner_radius_top_right = 6
corner_radius_bottom_right = 6
corner_radius_bottom_left = 6
content_margin_left = 16.0
content_margin_top = 8.0
content_margin_right = 16.0
content_margin_bottom = 8.0
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_xp_bg"]
bg_color = Color(0.15, 0.15, 0.15, 1)
corner_radius_top_left = 4
corner_radius_top_right = 4
corner_radius_bottom_right = 4
corner_radius_bottom_left = 4
[node name="GameOverPanel" 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_script")
[node name="Background" type="ColorRect" parent="."]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
color = Color(0.22, 0.22, 0.22, 0.95)
[node name="MainMargin" 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 = 30
theme_override_constants/margin_top = 20
theme_override_constants/margin_right = 30
theme_override_constants/margin_bottom = 20
[node name="MainHBox" type="HBoxContainer" parent="MainMargin"]
layout_mode = 2
theme_override_constants/separation = 20
[node name="LeftSide" type="VBoxContainer" parent="MainMargin/MainHBox"]
layout_mode = 2
size_flags_horizontal = 3
size_flags_stretch_ratio = 1.4
theme_override_constants/separation = 0
[node name="HeaderPanel" type="PanelContainer" parent="MainMargin/MainHBox/LeftSide"]
layout_mode = 2
size_flags_horizontal = 3
theme_override_styles/panel = SubResource("StyleBoxFlat_header")
[node name="HeaderHBox" type="HBoxContainer" parent="MainMargin/MainHBox/LeftSide/HeaderPanel"]
layout_mode = 2
theme_override_constants/separation = 10
[node name="TabTitleLabel" type="Label" parent="MainMargin/MainHBox/LeftSide/HeaderPanel/HeaderHBox"]
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 3
theme_override_colors/font_color = Color(0.15, 0.1, 0, 1)
theme_override_fonts/font = ExtResource("2_font")
theme_override_font_sizes/font_size = 28
text = "RACE RESULT"
[node name="BodyHBox" type="HBoxContainer" parent="MainMargin/MainHBox/LeftSide"]
layout_mode = 2
size_flags_vertical = 3
theme_override_constants/separation = 8
[node name="ContentPanel" type="PanelContainer" parent="MainMargin/MainHBox/LeftSide/BodyHBox"]
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 3
theme_override_styles/panel = SubResource("StyleBoxFlat_content")
[node name="ContentStack" type="Control" parent="MainMargin/MainHBox/LeftSide/BodyHBox/ContentPanel"]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
[node name="RaceResultContent" type="VBoxContainer" parent="MainMargin/MainHBox/LeftSide/BodyHBox/ContentPanel/ContentStack"]
unique_name_in_owner = true
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
theme_override_constants/separation = 12
[node name="PlayerInfoHBox" type="HBoxContainer" parent="MainMargin/MainHBox/LeftSide/BodyHBox/ContentPanel/ContentStack/RaceResultContent"]
layout_mode = 2
theme_override_constants/separation = 12
[node name="PlayerRankLabel" type="Label" parent="MainMargin/MainHBox/LeftSide/BodyHBox/ContentPanel/ContentStack/RaceResultContent/PlayerInfoHBox"]
unique_name_in_owner = true
layout_mode = 2
theme_override_colors/font_color = Color(0.95, 0.75, 0.1, 1)
theme_override_fonts/font = ExtResource("2_font")
theme_override_font_sizes/font_size = 32
text = "1st"
[node name="PlayerNameLabel" type="Label" parent="MainMargin/MainHBox/LeftSide/BodyHBox/ContentPanel/ContentStack/RaceResultContent/PlayerInfoHBox"]
unique_name_in_owner = true
layout_mode = 2
theme_override_colors/font_color = Color(1, 1, 1, 1)
theme_override_fonts/font = ExtResource("2_font")
theme_override_font_sizes/font_size = 32
text = "Player"
[node name="PlayerScoreLabel" type="Label" parent="MainMargin/MainHBox/LeftSide/BodyHBox/ContentPanel/ContentStack/RaceResultContent/PlayerInfoHBox"]
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 3
theme_override_colors/font_color = Color(1, 1, 1, 1)
theme_override_fonts/font = ExtResource("2_font")
theme_override_font_sizes/font_size = 40
text = "0"
horizontal_alignment = 2
[node name="Sep1" type="HSeparator" parent="MainMargin/MainHBox/LeftSide/BodyHBox/ContentPanel/ContentStack/RaceResultContent"]
layout_mode = 2
theme_override_constants/separation = 4
[node name="CompletionRow" type="HBoxContainer" parent="MainMargin/MainHBox/LeftSide/BodyHBox/ContentPanel/ContentStack/RaceResultContent"]
layout_mode = 2
theme_override_constants/separation = 20
[node name="CompletionLabel" type="Label" parent="MainMargin/MainHBox/LeftSide/BodyHBox/ContentPanel/ContentStack/RaceResultContent/CompletionRow"]
layout_mode = 2
size_flags_horizontal = 3
theme_override_colors/font_color = Color(0.8, 0.8, 0.8, 1)
theme_override_fonts/font = ExtResource("2_font")
theme_override_font_sizes/font_size = 24
text = "COMPLETION"
[node name="CompletionValue" type="Label" parent="MainMargin/MainHBox/LeftSide/BodyHBox/ContentPanel/ContentStack/RaceResultContent/CompletionRow"]
unique_name_in_owner = true
layout_mode = 2
theme_override_colors/font_color = Color(1, 1, 1, 1)
theme_override_fonts/font = ExtResource("2_font")
theme_override_font_sizes/font_size = 24
text = "0x"
horizontal_alignment = 2
[node name="ScoreRow" type="HBoxContainer" parent="MainMargin/MainHBox/LeftSide/BodyHBox/ContentPanel/ContentStack/RaceResultContent"]
layout_mode = 2
theme_override_constants/separation = 20
[node name="ScoreLabel" type="Label" parent="MainMargin/MainHBox/LeftSide/BodyHBox/ContentPanel/ContentStack/RaceResultContent/ScoreRow"]
layout_mode = 2
size_flags_horizontal = 3
theme_override_colors/font_color = Color(0.8, 0.8, 0.8, 1)
theme_override_fonts/font = ExtResource("2_font")
theme_override_font_sizes/font_size = 24
text = "SCORE"
[node name="ScoreValue" type="Label" parent="MainMargin/MainHBox/LeftSide/BodyHBox/ContentPanel/ContentStack/RaceResultContent/ScoreRow"]
unique_name_in_owner = true
layout_mode = 2
theme_override_colors/font_color = Color(1, 1, 1, 1)
theme_override_fonts/font = ExtResource("2_font")
theme_override_font_sizes/font_size = 24
text = "0"
horizontal_alignment = 2
[node name="RankRow" type="HBoxContainer" parent="MainMargin/MainHBox/LeftSide/BodyHBox/ContentPanel/ContentStack/RaceResultContent"]
layout_mode = 2
theme_override_constants/separation = 20
[node name="RankLabel" type="Label" parent="MainMargin/MainHBox/LeftSide/BodyHBox/ContentPanel/ContentStack/RaceResultContent/RankRow"]
layout_mode = 2
size_flags_horizontal = 3
theme_override_colors/font_color = Color(0.8, 0.8, 0.8, 1)
theme_override_fonts/font = ExtResource("2_font")
theme_override_font_sizes/font_size = 24
text = "RANK"
[node name="RankValue" type="Label" parent="MainMargin/MainHBox/LeftSide/BodyHBox/ContentPanel/ContentStack/RaceResultContent/RankRow"]
unique_name_in_owner = true
layout_mode = 2
theme_override_colors/font_color = Color(0.95, 0.75, 0.1, 1)
theme_override_fonts/font = ExtResource("2_font")
theme_override_font_sizes/font_size = 52
text = "1st"
horizontal_alignment = 2
[node name="RankListContent" type="VBoxContainer" parent="MainMargin/MainHBox/LeftSide/BodyHBox/ContentPanel/ContentStack"]
unique_name_in_owner = true
visible = false
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
theme_override_constants/separation = 6
[node name="WinnerHBox" type="HBoxContainer" parent="MainMargin/MainHBox/LeftSide/BodyHBox/ContentPanel/ContentStack/RankListContent"]
layout_mode = 2
theme_override_constants/separation = 12
[node name="WinnerRankLabel" type="Label" parent="MainMargin/MainHBox/LeftSide/BodyHBox/ContentPanel/ContentStack/RankListContent/WinnerHBox"]
unique_name_in_owner = true
layout_mode = 2
theme_override_colors/font_color = Color(0.95, 0.75, 0.1, 1)
theme_override_fonts/font = ExtResource("2_font")
theme_override_font_sizes/font_size = 30
text = "1st"
[node name="WinnerNameLabel" type="Label" parent="MainMargin/MainHBox/LeftSide/BodyHBox/ContentPanel/ContentStack/RankListContent/WinnerHBox"]
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 3
theme_override_colors/font_color = Color(1, 1, 1, 1)
theme_override_fonts/font = ExtResource("2_font")
theme_override_font_sizes/font_size = 30
text = "Player"
[node name="WinnerScoreLabel" type="Label" parent="MainMargin/MainHBox/LeftSide/BodyHBox/ContentPanel/ContentStack/RankListContent/WinnerHBox"]
unique_name_in_owner = true
layout_mode = 2
theme_override_colors/font_color = Color(1, 1, 1, 1)
theme_override_fonts/font = ExtResource("2_font")
theme_override_font_sizes/font_size = 38
text = "0"
horizontal_alignment = 2
[node name="Sep2" type="HSeparator" parent="MainMargin/MainHBox/LeftSide/BodyHBox/ContentPanel/ContentStack/RankListContent"]
layout_mode = 2
theme_override_constants/separation = 4
[node name="RankScroll" type="ScrollContainer" parent="MainMargin/MainHBox/LeftSide/BodyHBox/ContentPanel/ContentStack/RankListContent"]
layout_mode = 2
size_flags_vertical = 3
[node name="RankListVBox" type="VBoxContainer" parent="MainMargin/MainHBox/LeftSide/BodyHBox/ContentPanel/ContentStack/RankListContent/RankScroll"]
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 3
theme_override_constants/separation = 4
[node name="TabBtnVBox" type="VBoxContainer" parent="MainMargin/MainHBox/LeftSide/BodyHBox"]
custom_minimum_size = Vector2(90, 0)
layout_mode = 2
theme_override_constants/separation = 8
[node name="TabSpacer" type="Control" parent="MainMargin/MainHBox/LeftSide/BodyHBox/TabBtnVBox"]
custom_minimum_size = Vector2(0, 30)
layout_mode = 2
[node name="RaceResultTabBtn" type="Button" parent="MainMargin/MainHBox/LeftSide/BodyHBox/TabBtnVBox"]
unique_name_in_owner = true
custom_minimum_size = Vector2(85, 50)
layout_mode = 2
theme_override_fonts/font = ExtResource("2_font")
theme_override_font_sizes/font_size = 12
text = "RACE
RESULT"
[node name="RankListTabBtn" type="Button" parent="MainMargin/MainHBox/LeftSide/BodyHBox/TabBtnVBox"]
unique_name_in_owner = true
custom_minimum_size = Vector2(85, 50)
layout_mode = 2
theme_override_fonts/font = ExtResource("2_font")
theme_override_font_sizes/font_size = 12
text = "RANK
LIST"
[node name="BottomBar" type="HBoxContainer" parent="MainMargin/MainHBox/LeftSide"]
custom_minimum_size = Vector2(0, 50)
layout_mode = 2
theme_override_constants/separation = 20
[node name="BackBtn" type="Button" parent="MainMargin/MainHBox/LeftSide/BottomBar"]
unique_name_in_owner = true
custom_minimum_size = Vector2(120, 48)
layout_mode = 2
theme_override_fonts/font = ExtResource("2_font")
theme_override_font_sizes/font_size = 20
theme_override_styles/normal = SubResource("StyleBoxFlat_back_normal")
theme_override_styles/hover = SubResource("StyleBoxFlat_back_hover")
theme_override_styles/pressed = SubResource("StyleBoxFlat_back_pressed")
text = "BACK"
[node name="BottomSpacer" type="Control" parent="MainMargin/MainHBox/LeftSide/BottomBar"]
layout_mode = 2
size_flags_horizontal = 3
[node name="RightSide" type="VBoxContainer" parent="MainMargin/MainHBox"]
layout_mode = 2
size_flags_horizontal = 3
size_flags_stretch_ratio = 1.0
theme_override_constants/separation = 8
alignment = 1
[node name="ViewportContainer" type="SubViewportContainer" parent="MainMargin/MainHBox/RightSide"]
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 3
stretch = true
[node name="PreviewViewport" type="SubViewport" parent="MainMargin/MainHBox/RightSide/ViewportContainer"]
transparent_bg = true
handle_input_locally = false
size = Vector2i(400, 500)
render_target_update_mode = 4
[node name="WorldEnvironment" type="WorldEnvironment" parent="MainMargin/MainHBox/RightSide/ViewportContainer/PreviewViewport"]
environment = SubResource("Environment_preview")
[node name="DirectionalLight3D" type="DirectionalLight3D" parent="MainMargin/MainHBox/RightSide/ViewportContainer/PreviewViewport"]
transform = Transform3D(0.866025, -0.25, 0.433013, 0, 0.866025, 0.5, -0.5, -0.433013, 0.75, 0, 4, 0)
light_energy = 1.4
[node name="FillLight" type="OmniLight3D" parent="MainMargin/MainHBox/RightSide/ViewportContainer/PreviewViewport"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -2, 2, 2)
light_color = Color(0.4, 0.5, 1, 1)
light_energy = 0.5
omni_range = 8.0
[node name="PreviewCamera" type="Camera3D" parent="MainMargin/MainHBox/RightSide/ViewportContainer/PreviewViewport"]
transform = Transform3D(1, 0, 0, 0, 0.9659259, 0.25881898, 0, -0.25881898, 0.9659259, 0, 0.8380414, 3.2)
current = true
fov = 40.0
[node name="CharacterRoot" type="Node3D" parent="MainMargin/MainHBox/RightSide/ViewportContainer/PreviewViewport"]
unique_name_in_owner = true
[node name="Masbro" parent="MainMargin/MainHBox/RightSide/ViewportContainer/PreviewViewport/CharacterRoot" instance=ExtResource("5_masbro")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.485, 0)
visible = false
[node name="Bob" parent="MainMargin/MainHBox/RightSide/ViewportContainer/PreviewViewport/CharacterRoot" instance=ExtResource("3_bob")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.485, 0)
visible = false
[node name="Gatot" parent="MainMargin/MainHBox/RightSide/ViewportContainer/PreviewViewport/CharacterRoot" instance=ExtResource("4_gatot")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.485, 0)
visible = false
[node name="Oldpop" parent="MainMargin/MainHBox/RightSide/ViewportContainer/PreviewViewport/CharacterRoot" instance=ExtResource("6_oldpop")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.485, 0)
[node name="AnimationPlayer" type="AnimationPlayer" parent="MainMargin/MainHBox/RightSide/ViewportContainer/PreviewViewport/CharacterRoot"]
root_node = NodePath("../Oldpop")
libraries/animation-pack = ExtResource("7_animlib")
autoplay = &"animation-pack/idle"
[node name="CharNameLabel" type="Label" parent="MainMargin/MainHBox/RightSide"]
unique_name_in_owner = true
layout_mode = 2
theme_override_colors/font_color = Color(1, 1, 1, 1)
theme_override_fonts/font = ExtResource("2_font")
theme_override_font_sizes/font_size = 26
text = "PLAYER"
horizontal_alignment = 1
[node name="XPBarHBox" type="HBoxContainer" parent="MainMargin/MainHBox/RightSide"]
layout_mode = 2
theme_override_constants/separation = 8
alignment = 1
[node name="XPIcon" type="ColorRect" parent="MainMargin/MainHBox/RightSide/XPBarHBox"]
custom_minimum_size = Vector2(24, 24)
layout_mode = 2
color = Color(0.85, 0.65, 0.1, 1)
[node name="XPBarBg" type="PanelContainer" parent="MainMargin/MainHBox/RightSide/XPBarHBox"]
custom_minimum_size = Vector2(180, 20)
layout_mode = 2
theme_override_styles/panel = SubResource("StyleBoxFlat_xp_bg")
[node name="XPFill" type="ColorRect" parent="MainMargin/MainHBox/RightSide/XPBarHBox/XPBarBg"]
custom_minimum_size = Vector2(120, 16)
layout_mode = 2
color = Color(0.85, 0.65, 0.1, 1)
[node name="RematchHBox" type="HBoxContainer" parent="MainMargin/MainHBox/RightSide"]
layout_mode = 2
theme_override_constants/separation = 10
alignment = 2
[node name="RematchBtn" type="Button" parent="MainMargin/MainHBox/RightSide/RematchHBox"]
unique_name_in_owner = true
custom_minimum_size = Vector2(160, 48)
layout_mode = 2
theme_override_fonts/font = ExtResource("2_font")
theme_override_font_sizes/font_size = 20
theme_override_styles/normal = SubResource("StyleBoxFlat_rematch_normal")
theme_override_styles/hover = SubResource("StyleBoxFlat_rematch_hover")
theme_override_styles/pressed = SubResource("StyleBoxFlat_rematch_pressed")
text = "REMATCH"
[node name="RematchVoteLabel" type="Label" parent="MainMargin/MainHBox/RightSide/RematchHBox"]
unique_name_in_owner = true
layout_mode = 2
theme_override_colors/font_color = Color(0.7, 0.7, 0.7, 1)
theme_override_fonts/font = ExtResource("2_font")
theme_override_font_sizes/font_size = 18