more work on the ui theme and changing the hud
This commit is contained in:
20
UI/Menus/GameEndScreen/enemy_row.gd
Normal file
20
UI/Menus/GameEndScreen/enemy_row.gd
Normal file
@@ -0,0 +1,20 @@
|
||||
class_name EnemyBox
|
||||
extends HBoxContainer
|
||||
|
||||
|
||||
func set_wave(wave: int) -> void:
|
||||
$WaveLabel.text = tr("LABEL_WAVE").format({Wave_Number = str(wave)})
|
||||
|
||||
|
||||
func add_enemy_tag(enemy: Enemy, num: int) -> void:
|
||||
for x: int in num:
|
||||
var enemy_tex: TextureRect = TextureRect.new()
|
||||
enemy_tex.texture = enemy.sprite
|
||||
enemy_tex.custom_minimum_size = Vector2(80, 80)
|
||||
add_child(enemy_tex)
|
||||
#var name_label: Label = Label.new()
|
||||
#name_label.text = enemy.title
|
||||
#var num_label: Label = Label.new()
|
||||
#num_label.text = str(num)
|
||||
#add_child(name_label)
|
||||
#add_child(num_label)
|
||||
1
UI/Menus/GameEndScreen/enemy_row.gd.uid
Normal file
1
UI/Menus/GameEndScreen/enemy_row.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://b0h5oewxd48lv
|
||||
10
UI/Menus/GameEndScreen/enemy_row.tscn
Normal file
10
UI/Menus/GameEndScreen/enemy_row.tscn
Normal file
@@ -0,0 +1,10 @@
|
||||
[gd_scene load_steps=2 format=3 uid="uid://b5hp43bm07b8a"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://b0h5oewxd48lv" path="res://UI/Menus/GameEndScreen/enemy_row.gd" id="1_th4b3"]
|
||||
|
||||
[node name="EnemyRow" type="HBoxContainer"]
|
||||
script = ExtResource("1_th4b3")
|
||||
|
||||
[node name="WaveLabel" type="Label" parent="."]
|
||||
layout_mode = 2
|
||||
text = "LABEL_WAVE"
|
||||
51
UI/Menus/GameEndScreen/game_end_screen.gd
Normal file
51
UI/Menus/GameEndScreen/game_end_screen.gd
Normal file
@@ -0,0 +1,51 @@
|
||||
class_name GameEndScreen extends PanelContainer
|
||||
|
||||
@export var box: PackedScene
|
||||
|
||||
@export var outcome_label: Label
|
||||
@export var winrate_label: Label
|
||||
@export var total_games_label: Label
|
||||
@export var total_wins_label: Label
|
||||
@export var total_losses_label: Label
|
||||
@export var undefeated_enemies: VBoxContainer
|
||||
|
||||
var game_manager: GameManager
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
winrate_label.text = str(Data.save_data.winrate) + "%"
|
||||
total_games_label.text = str(Data.save_data.wins + Data.save_data.losses)
|
||||
total_wins_label.text = str(Data.save_data.wins)
|
||||
total_losses_label.text = str(Data.save_data.losses)
|
||||
if game_manager:
|
||||
set_wave()
|
||||
|
||||
|
||||
func set_wave() -> void:
|
||||
for wave_key: int in game_manager.stats.enemies_undefeated:
|
||||
var spawned_box: EnemyBox = box.instantiate() as EnemyBox
|
||||
undefeated_enemies.add_child(spawned_box)
|
||||
spawned_box.set_wave(wave_key)
|
||||
for enemy_key: Enemy in game_manager.stats.enemies_undefeated[wave_key]:
|
||||
spawned_box.add_enemy_tag(enemy_key, game_manager.stats.enemies_undefeated[wave_key][enemy_key])
|
||||
|
||||
|
||||
func set_outcome_message(message: String) -> void:
|
||||
outcome_label.text = message
|
||||
|
||||
|
||||
func _on_quit_button_pressed() -> void:
|
||||
game_manager.scene_switch_main_menu()
|
||||
queue_free()
|
||||
|
||||
|
||||
func _on_play_button_pressed() -> void:
|
||||
if game_manager.gamemode.daily == false and !game_manager.gamemode.seeded:
|
||||
game_manager.gamemode.rng_seed = randi()
|
||||
game_manager.setup()
|
||||
game_manager.start()
|
||||
queue_free()
|
||||
|
||||
|
||||
func _on_button_mouse_entered() -> void:
|
||||
$AudioStreamPlayer.play()
|
||||
1
UI/Menus/GameEndScreen/game_end_screen.gd.uid
Normal file
1
UI/Menus/GameEndScreen/game_end_screen.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://bdknvktw033g3
|
||||
140
UI/Menus/GameEndScreen/game_end_screen.tscn
Normal file
140
UI/Menus/GameEndScreen/game_end_screen.tscn
Normal file
@@ -0,0 +1,140 @@
|
||||
[gd_scene load_steps=5 format=3 uid="uid://ce0m8vbjbng6o"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://bdknvktw033g3" path="res://UI/Menus/GameEndScreen/game_end_screen.gd" id="1_oa7nq"]
|
||||
[ext_resource type="PackedScene" uid="uid://b5hp43bm07b8a" path="res://UI/Menus/GameEndScreen/enemy_row.tscn" id="2_xm8em"]
|
||||
[ext_resource type="AudioStream" uid="uid://cp6ph4ra7u5rk" path="res://UI/drop_003.ogg" id="3_ro1yg"]
|
||||
|
||||
[sub_resource type="AudioStreamRandomizer" id="AudioStreamRandomizer_dram5"]
|
||||
random_pitch = 1.1
|
||||
streams_count = 1
|
||||
stream_0/stream = ExtResource("3_ro1yg")
|
||||
|
||||
[node name="GameEndScreen" type="PanelContainer" node_paths=PackedStringArray("outcome_label", "winrate_label", "total_games_label", "total_wins_label", "total_losses_label", "undefeated_enemies")]
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
offset_left = 150.0
|
||||
offset_top = 100.0
|
||||
offset_right = -150.0
|
||||
offset_bottom = -100.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
script = ExtResource("1_oa7nq")
|
||||
box = ExtResource("2_xm8em")
|
||||
outcome_label = NodePath("VBoxContainer/Labels/OutcomeLabel")
|
||||
winrate_label = NodePath("VBoxContainer/Labels/VBoxContainer/HBoxContainer/WinRateLabel2")
|
||||
total_games_label = NodePath("VBoxContainer/Labels/VBoxContainer/HBoxContainer2/WinRateLabel3")
|
||||
total_wins_label = NodePath("VBoxContainer/Labels/VBoxContainer/HBoxContainer3/WinRateLabel4")
|
||||
total_losses_label = NodePath("VBoxContainer/Labels/VBoxContainer/HBoxContainer4/WinRateLabel5")
|
||||
undefeated_enemies = NodePath("VBoxContainer/UndefeatedEnemies")
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="."]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Labels" type="VBoxContainer" parent="VBoxContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 3
|
||||
alignment = 1
|
||||
|
||||
[node name="OutcomeLabel" type="Label" parent="VBoxContainer/Labels"]
|
||||
layout_mode = 2
|
||||
text = "LABEL_WIN_MESSAGE"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="VBoxContainer/Labels"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 4
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="VBoxContainer/Labels/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="WinRateLabel" type="Label" parent="VBoxContainer/Labels/VBoxContainer/HBoxContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
text = "LABEL_WINRATE"
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="WinRateLabel2" type="Label" parent="VBoxContainer/Labels/VBoxContainer/HBoxContainer"]
|
||||
auto_translate_mode = 2
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
text = "0"
|
||||
horizontal_alignment = 2
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="HBoxContainer2" type="HBoxContainer" parent="VBoxContainer/Labels/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="TotalGamesLabel" type="Label" parent="VBoxContainer/Labels/VBoxContainer/HBoxContainer2"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
text = "LABEL_GAMES"
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="WinRateLabel3" type="Label" parent="VBoxContainer/Labels/VBoxContainer/HBoxContainer2"]
|
||||
auto_translate_mode = 2
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
text = "0"
|
||||
horizontal_alignment = 2
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="HBoxContainer3" type="HBoxContainer" parent="VBoxContainer/Labels/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="TotalWinsLabel" type="Label" parent="VBoxContainer/Labels/VBoxContainer/HBoxContainer3"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
text = "LABEL_WINS"
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="WinRateLabel4" type="Label" parent="VBoxContainer/Labels/VBoxContainer/HBoxContainer3"]
|
||||
auto_translate_mode = 2
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
text = "0"
|
||||
horizontal_alignment = 2
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="HBoxContainer4" type="HBoxContainer" parent="VBoxContainer/Labels/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="TotalLossesLabel" type="Label" parent="VBoxContainer/Labels/VBoxContainer/HBoxContainer4"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
text = "LABEL_LOSSES"
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="WinRateLabel5" type="Label" parent="VBoxContainer/Labels/VBoxContainer/HBoxContainer4"]
|
||||
auto_translate_mode = 2
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
text = "0"
|
||||
horizontal_alignment = 2
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="UndefeatedEnemies" type="VBoxContainer" parent="VBoxContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 3
|
||||
|
||||
[node name="Buttons" type="HBoxContainer" parent="VBoxContainer"]
|
||||
layout_mode = 2
|
||||
alignment = 2
|
||||
|
||||
[node name="PlayButton" type="Button" parent="VBoxContainer/Buttons"]
|
||||
layout_mode = 2
|
||||
text = "BUTTON_RESTART"
|
||||
|
||||
[node name="QuitButton" type="Button" parent="VBoxContainer/Buttons"]
|
||||
layout_mode = 2
|
||||
text = "BUTTON_MAIN_MENU"
|
||||
|
||||
[node name="AudioStreamPlayer" type="AudioStreamPlayer" parent="."]
|
||||
stream = SubResource("AudioStreamRandomizer_dram5")
|
||||
bus = &"SFX"
|
||||
|
||||
[connection signal="mouse_entered" from="VBoxContainer/Buttons/PlayButton" to="." method="_on_button_mouse_entered"]
|
||||
[connection signal="pressed" from="VBoxContainer/Buttons/PlayButton" to="." method="_on_play_button_pressed"]
|
||||
[connection signal="mouse_entered" from="VBoxContainer/Buttons/QuitButton" to="." method="_on_button_mouse_entered"]
|
||||
[connection signal="pressed" from="VBoxContainer/Buttons/QuitButton" to="." method="_on_quit_button_pressed"]
|
||||
Reference in New Issue
Block a user