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/SaveLoadMenu/SavePanelButton.gd | |
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/SaveLoadMenu/SavePanelButton.gd')
-rw-r--r-- | game/src/SaveLoadMenu/SavePanelButton.gd | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/game/src/SaveLoadMenu/SavePanelButton.gd b/game/src/SaveLoadMenu/SavePanelButton.gd new file mode 100644 index 0000000..5fe4917 --- /dev/null +++ b/game/src/SaveLoadMenu/SavePanelButton.gd @@ -0,0 +1,41 @@ +@tool +extends LobbyPanelButton + +signal request_to_delete + +@export_group("Nodes") +@export var country_flag : TextureRect +@export var date_label : Label +@export var delete_button : BaseButton + +var resource : SaveResource: + get: + return resource + set(value): + if resource != null: + resource.changed.disconnect(_resource_changed) + resource = value + if resource != null: + resource.changed.connect(_resource_changed) + _resource_changed() + +func get_text() -> StringName: + return resource.save_name + +func set_text(value : StringName) -> void: + if resource != null: + resource.save_name = value + +func _ready(): + _resource_changed() + +func _is_start_date() -> bool: + return false + +func _resource_changed() -> void: + if resource == null: return + name_label.text = resource.save_name + date_label.text = Time.get_datetime_string_from_unix_time(resource.get_save_file_time(), true) + +func _on_delete_button_pressed() -> void: + request_to_delete.emit() |