diff options
author | Spartan322 <Megacake1234@gmail.com> | 2023-04-23 22:01:49 +0200 |
---|---|---|
committer | Spartan322 <Megacake1234@gmail.com> | 2023-05-12 13:32:21 +0200 |
commit | 8ab166ae0bd784145c3706aba0c3f3326cbbaac1 (patch) | |
tree | e4511c51eb4ceaefd92a7ad8a00f42910eb83811 /game/src/GameSession | |
parent | 398ba6f05ae1bb13e59790436bf0da299e5a399d (diff) |
Add SaveManager autoload singleton
Globally handles save finding, creation, removal, changes, naming, and flushing
Globally handles the session tags for the active save
Add SaveLoadMenu to GameSession
Add Start Date Panel and Save Panel loading to LobbyMenu
Includes session tag filter
Add LobbyPanelButton and SavePanelButton scene and scripts
Add SaveResource to handle saving and loading individual save files
Add localization for SaveLoadMenu
Expand localization for additions to LobbyMenu
Add ButtonContainer variation type to default theme
Fulfill:
UI-82, UI-83, UI-84, UI-85, UI-87, UI-89, UI-90, UI-91, UI-92, UI-94
UIFUN-82, UIFUN-83, UIFUN-84, UIFUN-86, UIFUN-87, UIFUN-89
FS-28
Diffstat (limited to 'game/src/GameSession')
-rw-r--r-- | game/src/GameSession/GameSession.tscn | 14 | ||||
-rw-r--r-- | game/src/GameSession/GameSessionMenu.gd | 10 | ||||
-rw-r--r-- | game/src/GameSession/GameSessionMenu.tscn | 4 |
3 files changed, 26 insertions, 2 deletions
diff --git a/game/src/GameSession/GameSession.tscn b/game/src/GameSession/GameSession.tscn index ce3471f..996891a 100644 --- a/game/src/GameSession/GameSession.tscn +++ b/game/src/GameSession/GameSession.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=9 format=3 uid="uid://bgnupcshe1m7r"] +[gd_scene load_steps=10 format=3 uid="uid://bgnupcshe1m7r"] [ext_resource type="Script" path="res://src/GameSession/GameSession.gd" id="1_eklvp"] [ext_resource type="PackedScene" uid="uid://cvl76duuym1wq" path="res://src/MusicConductor/MusicPlayer.tscn" id="2_kt6aa"] @@ -8,6 +8,7 @@ [ext_resource type="PackedScene" uid="uid://byq323jbel48u" path="res://src/GameSession/ProvinceOverviewPanel/ProvinceOverviewPanel.tscn" id="5_osjnn"] [ext_resource type="PackedScene" uid="uid://cnbfxjy1m6wja" path="res://src/OptionMenu/OptionsMenu.tscn" id="6_p5mnx"] [ext_resource type="PackedScene" uid="uid://dd8k3p7r3huwc" path="res://src/GameSession/GameSpeedPanel.tscn" id="7_myy4q"] +[ext_resource type="PackedScene" uid="uid://dayy28gn8kq34" path="res://src/SaveLoadMenu/SaveLoadMenu.tscn" id="8_4g7ko"] [node name="GameSession" type="Control" node_paths=PackedStringArray("_game_session_menu")] editor_description = "SS-102, UI-546" @@ -56,6 +57,15 @@ offset_bottom = 31.0 visible = false layout_mode = 1 +[node name="SaveLoadMenu" parent="." instance=ExtResource("8_4g7ko")] +visible = false +layout_mode = 1 +anchors_preset = -1 +anchor_left = 0.5 +anchor_right = 0.5 +offset_left = -640.0 +offset_right = 640.0 + [node name="MusicPlayer" parent="." instance=ExtResource("2_kt6aa")] layout_mode = 1 anchors_preset = 1 @@ -66,7 +76,9 @@ offset_right = 0.0 grow_horizontal = 0 [connection signal="map_view_camera_changed" from="MapView" to="MapControlPanel" method="_on_map_view_camera_changed"] +[connection signal="load_button_pressed" from="GameSessionMenu" to="SaveLoadMenu" method="show_for_load"] [connection signal="options_button_pressed" from="GameSessionMenu" to="OptionsMenu" method="show"] +[connection signal="save_button_pressed" from="GameSessionMenu" to="SaveLoadMenu" method="show_for_save"] [connection signal="game_session_menu_button_pressed" from="MapControlPanel" to="." method="_on_game_session_menu_button_pressed"] [connection signal="minimap_clicked" from="MapControlPanel" to="MapView" method="_on_minimap_clicked"] [connection signal="mouse_entered" from="MapControlPanel" to="MapView" method="_on_mouse_exited_viewport"] diff --git a/game/src/GameSession/GameSessionMenu.gd b/game/src/GameSession/GameSessionMenu.gd index 6f373d7..23ef2ef 100644 --- a/game/src/GameSession/GameSessionMenu.gd +++ b/game/src/GameSession/GameSessionMenu.gd @@ -10,6 +10,8 @@ var _main_menu_save_separator : Control var _quit_save_button : Button var _quit_save_separator : Control +signal save_button_pressed +signal load_button_pressed signal options_button_pressed func _ready() -> void: @@ -45,6 +47,8 @@ func show_save_dialog_button() -> void: # * SS-47 # * UIFUN-69 func _on_main_menu_confirmed() -> void: + SaveManager.current_session_tag = "" + SaveManager.current_save = null get_tree().change_scene_to_packed(_main_menu_scene) # REQUIREMENTS: @@ -68,3 +72,9 @@ func _on_quit_dialog_custom_action(action : StringName) -> void: match action: &"save_and_quit": _on_quit_confirmed() + +func _on_save_button_pressed(): + save_button_pressed.emit() + +func _on_load_button_pressed(): + load_button_pressed.emit() diff --git a/game/src/GameSession/GameSessionMenu.tscn b/game/src/GameSession/GameSessionMenu.tscn index 99f38df..025ef3b 100644 --- a/game/src/GameSession/GameSessionMenu.tscn +++ b/game/src/GameSession/GameSessionMenu.tscn @@ -1,6 +1,6 @@ [gd_scene load_steps=4 format=3 uid="uid://dvdynl6eir40o"] -[ext_resource type="Theme" uid="uid://dndova5cw036e" path="res://theme/game_session_menu.tres" id="1_2onog"] +[ext_resource type="Theme" uid="uid://cqrfmjt5yeti7" path="res://theme/game_session_menu.tres" id="1_2onog"] [ext_resource type="Script" path="res://src/GameSession/GameSessionMenu.gd" id="1_usq6o"] [ext_resource type="PackedScene" uid="uid://o4u142w4qkln" path="res://src/GameMenu.tscn" id="2_xi6a4"] @@ -79,6 +79,8 @@ ok_button_text = "DIALOG_OK" dialog_text = "GAMESESSIONMENU_QUIT_DIALOG_TEXT" cancel_button_text = "DIALOG_CANCEL" +[connection signal="pressed" from="ButtonListMargin/ButtonList/SaveButton" to="." method="_on_save_button_pressed"] +[connection signal="pressed" from="ButtonListMargin/ButtonList/LoadButton" to="." method="_on_load_button_pressed"] [connection signal="pressed" from="ButtonListMargin/ButtonList/OptionsButton" to="." method="_on_options_button_pressed"] [connection signal="pressed" from="ButtonListMargin/ButtonList/MainMenuButton" to="MainMenuDialog" method="popup_centered"] [connection signal="pressed" from="ButtonListMargin/ButtonList/QuitButton" to="QuitDialog" method="popup_centered"] |