Save and load game fixes (and some other small fixes) (#466)

This commit is contained in:
Julian Murgia
2021-11-29 14:21:29 +01:00
committed by GitHub
parent dcb9db488d
commit b031d69cd9
19 changed files with 177 additions and 79 deletions

View File

@@ -12,6 +12,13 @@ __meta__ = {
}
slot_ui_scene = ExtResource( 2 )
[node name="Panel" type="Panel" parent="."]
anchor_right = 1.0
anchor_bottom = 1.0
__meta__ = {
"_editor_description_": ""
}
[node name="VBoxContainer" type="VBoxContainer" parent="."]
anchor_left = 0.3
anchor_top = 0.3

View File

@@ -14,6 +14,15 @@ __meta__ = {
}
slot_ui_scene = ExtResource( 1 )
[node name="Panel" type="Panel" parent="."]
anchor_right = 1.0
anchor_bottom = 1.0
margin_top = -1.0
margin_bottom = -1.0
__meta__ = {
"_editor_description_": ""
}
[node name="save_name_popup" parent="." instance=ExtResource( 4 )]
visible = false

View File

@@ -27,11 +27,16 @@ func _on_quit_pressed():
# Hide the options panel again
func _on_options_back_button_pressed():
$options.hide()
$main.show()
reset()
# Hide the load panel
func _on_load_game_back_button_pressed():
reset()
# Resets the UI to initial state
func reset():
$load_game.hide()
$options.hide()
$main.show()

View File

@@ -11,6 +11,13 @@ __meta__ = {
"_edit_use_anchors_": false
}
[node name="Panel" type="Panel" parent="."]
anchor_right = 1.0
anchor_bottom = 1.0
__meta__ = {
"_editor_description_": ""
}
[node name="VBoxContainer" type="VBoxContainer" parent="."]
anchor_right = 1.0
anchor_bottom = 1.0

View File

@@ -31,21 +31,26 @@ func _on_quit_pressed():
escoria.quit()
# Hide the save slots again
# Hide the save slots after clicking back button
func _on_save_game_back_button_pressed():
$VBoxContainer.show()
$save_game.hide()
reset()
# Hide the load slots again
# Hide the load slots after clicking back button
func _on_load_game_back_button_pressed():
$VBoxContainer.show()
$load_game.hide()
reset()
# Set wether saving is enabled currently
# Set whether saving is enabled currently
#
# #### Parameters
# - p_enabled: Enable or disable saving
func set_save_enabled(p_enabled: bool):
$VBoxContainer/menuitems/save_game.disabled = !p_enabled
# Resets the UI to initial state
func reset():
$save_game.hide()
$load_game.hide()
$VBoxContainer.show()