diff --git a/game/ui/game_over_window/GameOverWindow.gd b/game/ui/game_over_window/GameOverWindow.gd new file mode 100644 index 0000000..4eacffa --- /dev/null +++ b/game/ui/game_over_window/GameOverWindow.gd @@ -0,0 +1,14 @@ +extends PanelContainer + +var _player : Entity + +func set_player(p_player: Entity) -> void: + if _player != null: + _player.disconnect("diecd", self, "on_died") + + _player = p_player + + _player.connect("diecd", self, "on_died") + +func on_died(p_player: Entity) -> void: + show() diff --git a/game/ui/game_over_window/GameOverWindow.tscn b/game/ui/game_over_window/GameOverWindow.tscn new file mode 100644 index 0000000..63d674a --- /dev/null +++ b/game/ui/game_over_window/GameOverWindow.tscn @@ -0,0 +1,59 @@ +[gd_scene load_steps=4 format=2] + +[ext_resource path="res://ui/theme/ui_theme.tres" type="Theme" id=1] +[ext_resource path="res://ui/game_over_window/QuitButton.gd" type="Script" id=2] +[ext_resource path="res://ui/game_over_window/GameOverWindow.gd" type="Script" id=3] + +[node name="GameOverWindow" type="PanelContainer"] +anchor_right = 1.0 +anchor_bottom = 1.0 +theme = ExtResource( 1 ) +script = ExtResource( 3 ) +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="VBoxContainer" type="VBoxContainer" parent="."] +margin_left = 4.0 +margin_top = 4.0 +margin_right = 1020.0 +margin_bottom = 596.0 + +[node name="Spacer" type="Control" parent="VBoxContainer"] +margin_right = 1016.0 +margin_bottom = 244.0 +size_flags_horizontal = 3 +size_flags_vertical = 3 + +[node name="Label" type="Label" parent="VBoxContainer"] +margin_top = 252.0 +margin_right = 1016.0 +margin_bottom = 292.0 +rect_min_size = Vector2( 0, 40 ) +text = "Game Over" +align = 1 +valign = 1 + +[node name="HBoxContainer" type="HBoxContainer" parent="VBoxContainer"] +margin_top = 300.0 +margin_right = 1016.0 +margin_bottom = 340.0 +alignment = 1 + +[node name="Button" type="Button" parent="VBoxContainer/HBoxContainer"] +margin_left = 468.0 +margin_right = 548.0 +margin_bottom = 40.0 +rect_min_size = Vector2( 80, 40 ) +text = "Quit" +script = ExtResource( 2 ) +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="Spacer2" type="Control" parent="VBoxContainer"] +margin_top = 348.0 +margin_right = 1016.0 +margin_bottom = 592.0 +size_flags_horizontal = 3 +size_flags_vertical = 3 diff --git a/game/ui/game_over_window/QuitButton.gd b/game/ui/game_over_window/QuitButton.gd new file mode 100644 index 0000000..30b800d --- /dev/null +++ b/game/ui/game_over_window/QuitButton.gd @@ -0,0 +1,7 @@ +extends Button + +func _ready(): + connect("pressed", self, "on_click") + +func on_click() -> void: + get_node("/root/Main").switch_scene(Main.StartSceneTypes.MENU) diff --git a/game/ui/player_ui/player_ui.tscn b/game/ui/player_ui/player_ui.tscn index 268b485..26b70de 100644 --- a/game/ui/player_ui/player_ui.tscn +++ b/game/ui/player_ui/player_ui.tscn @@ -1,10 +1,11 @@ -[gd_scene load_steps=25 format=2] +[gd_scene load_steps=26 format=2] [ext_resource path="res://player/GUI.gd" type="Script" id=1] [ext_resource path="res://ui/ingame_menu/IngameMenu.tscn" type="PackedScene" id=2] [ext_resource path="res://player/Unitframes.gd" type="Script" id=3] [ext_resource path="res://ui/errorframe/ErrorFrame.tscn" type="PackedScene" id=4] [ext_resource path="res://ui/auraframe/AuraFrame.tscn" type="PackedScene" id=5] +[ext_resource path="res://ui/game_over_window/GameOverWindow.tscn" type="PackedScene" id=6] [ext_resource path="res://ui/actionbars/Actionbars.gd" type="Script" id=8] [ext_resource path="res://ui/buttons/Buttons.gd" type="Script" id=9] [ext_resource path="res://ui/theme/ui_theme.tres" type="Theme" id=10] @@ -38,7 +39,7 @@ script = ExtResource( 1 ) __meta__ = { "_edit_lock_": true } -child_controls = [ NodePath("Unitframes"), NodePath("Actionbars"), NodePath("Windows/SpellBookWindow"), NodePath("Buttons"), NodePath("Castbar"), NodePath("AuraFrame"), NodePath("Windows/Inventory"), NodePath("Windows/LootWindow"), NodePath("Windows/TalentWindow"), NodePath("Windows/CraftingWindow") ] +child_controls = [ NodePath("Unitframes"), NodePath("Actionbars"), NodePath("Windows/SpellBookWindow"), NodePath("Buttons"), NodePath("Castbar"), NodePath("AuraFrame"), NodePath("Windows/Inventory"), NodePath("Windows/LootWindow"), NodePath("Windows/TalentWindow"), NodePath("Windows/CraftingWindow"), NodePath("Windows/GameOverWindow") ] [node name="Buttons" type="Control" parent="GUI"] anchor_left = 0.5 @@ -275,6 +276,9 @@ margin_top = 85.0 margin_right = 242.0 margin_bottom = 315.0 +[node name="GameOverWindow" parent="GUI/Windows" instance=ExtResource( 6 )] +visible = false + [node name="Unitframes" type="Control" parent="GUI"] anchor_right = 1.0 anchor_bottom = 1.0