Implement save overwrite confirmation (#368)
* Implement save overwrite confirmation + fixed pause game not pausing game execution. * docs: Automatic update of API docs Co-authored-by: StraToN <StraToN@users.noreply.github.com>
This commit is contained in:
12
game/ui/commons/save/overwrite_confirm_popup.gd
Normal file
12
game/ui/commons/save/overwrite_confirm_popup.gd
Normal file
@@ -0,0 +1,12 @@
|
||||
extends PopupDialog
|
||||
|
||||
signal confirm_yes
|
||||
|
||||
func _on_no_pressed():
|
||||
hide()
|
||||
|
||||
|
||||
func _on_yes_pressed():
|
||||
emit_signal("confirm_yes")
|
||||
hide()
|
||||
|
||||
75
game/ui/commons/save/overwrite_confirm_popup.tscn
Normal file
75
game/ui/commons/save/overwrite_confirm_popup.tscn
Normal file
@@ -0,0 +1,75 @@
|
||||
[gd_scene load_steps=3 format=2]
|
||||
|
||||
[ext_resource path="res://game/ui/commons/fonts/caslonantique.tres" type="DynamicFont" id=1]
|
||||
[ext_resource path="res://game/ui/commons/save/overwrite_confirm_popup.gd" type="Script" id=2]
|
||||
|
||||
[node name="overwrite_confirm_popup" type="PopupDialog"]
|
||||
margin_left = 429.0
|
||||
margin_top = 281.0
|
||||
margin_right = 863.0
|
||||
margin_bottom = 442.0
|
||||
script = ExtResource( 2 )
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="MarginContainer" type="MarginContainer" parent="."]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
custom_constants/margin_right = 30
|
||||
custom_constants/margin_top = 30
|
||||
custom_constants/margin_left = 30
|
||||
custom_constants/margin_bottom = 30
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer"]
|
||||
margin_left = 30.0
|
||||
margin_top = 30.0
|
||||
margin_right = 404.0
|
||||
margin_bottom = 131.0
|
||||
|
||||
[node name="Label" type="Label" parent="MarginContainer/VBoxContainer"]
|
||||
margin_right = 374.0
|
||||
margin_bottom = 21.0
|
||||
custom_fonts/font = ExtResource( 1 )
|
||||
text = "CONFIRM_OVERWRITE"
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="."]
|
||||
anchor_left = 1.0
|
||||
anchor_top = 1.0
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
margin_left = -224.0
|
||||
margin_top = -56.0
|
||||
margin_right = -30.0
|
||||
margin_bottom = -20.0
|
||||
custom_constants/separation = 10
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="yes" type="Button" parent="HBoxContainer"]
|
||||
margin_right = 92.0
|
||||
margin_bottom = 36.0
|
||||
size_flags_horizontal = 3
|
||||
custom_fonts/font = ExtResource( 1 )
|
||||
text = "YES"
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="no" type="Button" parent="HBoxContainer"]
|
||||
margin_left = 102.0
|
||||
margin_right = 194.0
|
||||
margin_bottom = 36.0
|
||||
size_flags_horizontal = 3
|
||||
custom_fonts/font = ExtResource( 1 )
|
||||
text = "NO"
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[connection signal="pressed" from="HBoxContainer/yes" to="." method="_on_yes_pressed"]
|
||||
[connection signal="pressed" from="HBoxContainer/no" to="." method="_on_no_pressed"]
|
||||
@@ -13,7 +13,7 @@ func _ready():
|
||||
func _on_slot_pressed(p_slot_n: int):
|
||||
slot_pressed = p_slot_n
|
||||
if escoria.save_manager.save_game_exists(p_slot_n):
|
||||
pass
|
||||
$overwrite_confirm_popup.popup()
|
||||
else:
|
||||
$save_name_popup.popup()
|
||||
|
||||
@@ -56,3 +56,7 @@ func _on_save_name_popup_savegame_name_ok(p_savename: String):
|
||||
|
||||
func _on_save_name_popup_savegame_cancel():
|
||||
pass
|
||||
|
||||
|
||||
func _on_overwrite_confirm_popup_confirm_yes():
|
||||
$save_name_popup.popup()
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
[gd_scene load_steps=5 format=2]
|
||||
[gd_scene load_steps=6 format=2]
|
||||
|
||||
[ext_resource path="res://game/ui/commons/load_save_slot/load_save_slot.tscn" type="PackedScene" id=1]
|
||||
[ext_resource path="res://game/ui/commons/save/save_game.gd" type="Script" id=2]
|
||||
[ext_resource path="res://game/ui/commons/fonts/caslonantique.tres" type="DynamicFont" id=3]
|
||||
[ext_resource path="res://game/ui/commons/save/save_name_popup.tscn" type="PackedScene" id=4]
|
||||
[ext_resource path="res://game/ui/commons/save/overwrite_confirm_popup.tscn" type="PackedScene" id=5]
|
||||
|
||||
[node name="save_game" type="Control"]
|
||||
anchor_right = 1.0
|
||||
@@ -49,6 +50,9 @@ __meta__ = {
|
||||
|
||||
[node name="save_name_popup" parent="." instance=ExtResource( 4 )]
|
||||
|
||||
[node name="overwrite_confirm_popup" parent="." instance=ExtResource( 5 )]
|
||||
|
||||
[connection signal="pressed" from="back" to="." method="_on_back_pressed"]
|
||||
[connection signal="savegame_cancel" from="save_name_popup" to="." method="_on_save_name_popup_savegame_cancel"]
|
||||
[connection signal="savegame_name_ok" from="save_name_popup" to="." method="_on_save_name_popup_savegame_name_ok"]
|
||||
[connection signal="confirm_yes" from="overwrite_confirm_popup" to="." method="_on_overwrite_confirm_popup_confirm_yes"]
|
||||
|
||||
Reference in New Issue
Block a user