From 63dec75688ca8a81becafa8b9805a2bc030e1414 Mon Sep 17 00:00:00 2001 From: tommy-l-ngo Date: Sat, 13 Nov 2021 23:32:19 -0600 Subject: [PATCH] Added Confirmation Dialog for Forfeit --- godot_ship/scenes/Game/Game.tscn | 20 ++++++++++++++++++-- godot_ship/scenes/Main.tscn | 1 + godot_ship/script/game/Gameplay/Game.gd | 3 +++ 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/godot_ship/scenes/Game/Game.tscn b/godot_ship/scenes/Game/Game.tscn index 52cf89f..31dbf81 100644 --- a/godot_ship/scenes/Game/Game.tscn +++ b/godot_ship/scenes/Game/Game.tscn @@ -1,9 +1,7 @@ [gd_scene load_steps=2 format=2] -[ext_resource path="res://assets/backgrounds/Background_Dark.png" type="Texture" id=1] [ext_resource path="res://script/game/Gameplay/Game.gd" type="Script" id=3] - [node name="Game" type="Control"] anchor_right = 1.0 anchor_bottom = 1.0 @@ -31,4 +29,22 @@ margin_right = 53.0 margin_bottom = 20.0 text = "Forfeit" +[node name="ConfirmationDialog" type="ConfirmationDialog" parent="."] +visible = true +anchor_left = 0.5 +anchor_top = 0.5 +anchor_right = 0.5 +anchor_bottom = 0.5 +margin_left = -111.5 +margin_top = -29.0 +margin_right = 111.5 +margin_bottom = 29.0 +rect_min_size = Vector2( 150, 52.5 ) +window_title = "Forfeit Confirmation..." +dialog_text = "Are you sure you want to forfeit?" +__meta__ = { +"_edit_use_anchors_": false, +"_editor_description_": "" +} + [connection signal="pressed" from="Buttons/Forfeit" to="." method="_on_Forfeit_pressed"] diff --git a/godot_ship/scenes/Main.tscn b/godot_ship/scenes/Main.tscn index 056eeb3..c36dcb7 100644 --- a/godot_ship/scenes/Main.tscn +++ b/godot_ship/scenes/Main.tscn @@ -13,6 +13,7 @@ __meta__ = { } [node name="Background" type="TextureRect" parent="."] +visible = false margin_right = 40.0 margin_bottom = 40.0 texture = ExtResource( 1 ) diff --git a/godot_ship/script/game/Gameplay/Game.gd b/godot_ship/script/game/Gameplay/Game.gd index 2830d80..12a8814 100644 --- a/godot_ship/script/game/Gameplay/Game.gd +++ b/godot_ship/script/game/Gameplay/Game.gd @@ -31,6 +31,9 @@ func _ready(): var setup = Setup.instance() setup.connect("game_ready", self, "game_setup") add_child(setup) + + get_node("ConfirmationDialog").get_ok().text = "Yes" + get_node("ConfirmationDialog").get_cancel().text = "No" # TODO: Move Setup into the Player. func game_setup(_ships):