Browse Source

Sorting saves list by date created, descending

pull/15/head
Ryan Reed 1 month ago
parent
commit
7645b8827e
1 changed files with 5 additions and 0 deletions
  1. +5
    -0
      save_load/autoloads/save_game_manager.gd

+ 5
- 0
save_load/autoloads/save_game_manager.gd View File

@ -76,6 +76,7 @@ func list_saves(include_quick_saves: bool = true, include_auto_saves: bool = tru
save_files.append(_save_resource) save_files.append(_save_resource)
save_files.sort_custom(_custom_save_file_sort)
return save_files return save_files
func quick_save_game() -> void: func quick_save_game() -> void:
@ -94,6 +95,10 @@ func quick_load_game() -> void:
game_loaded.emit() game_loaded.emit()
## Sort the save files list by date created, descending
func _custom_save_file_sort(a: SaveFileDetailsResource, b: SaveFileDetailsResource) -> bool:
return a.date_created > b.date_created
## Find the SaveLevelDataComponent within the level which stores the save paths and filenames ## Find the SaveLevelDataComponent within the level which stores the save paths and filenames
func _load_save_level_data_component() -> bool: func _load_save_level_data_component() -> bool:
_save_level_data_component = get_tree().get_first_node_in_group("save_level_data_component") _save_level_data_component = get_tree().get_first_node_in_group("save_level_data_component")


Loading…
Cancel
Save