FLimenStorageSubsystem
Overview
FLimenStorageSubsystem is a core subsystem responsible for managing the storage and retrieval of items, categories, and save data. It provides methods to initialize, deinitialize, add, remove, and retrieve items based on their category or display name. The class also handles saving and loading of data using ULimenSaveSubsystem.
Properties
Type | Name | Access | Description |
|---|---|---|---|
FString | SaveDataName | Protected | Name used for saving the storage data. |
TWeakObjectPtr< ULimenSaveSubsystem > | SaveSubsystem | Private | Weak pointer to the save subsystem. |
TArray<TStrongObjectPtr< ULimenStorageItem >> | StorageItems | Private | Array of strong pointers to stored items. |
TStrongObjectPtr< ULimenStorageSaveData > | CurrentSaveData | Private | Strong pointer to the current save data. |
bool | bHasSavedData | Private | Flag indicating if there is saved data. |
Functions
Return Type | Signature | Description |
|---|---|---|
void | InitializeStorage(ULimenSaveSubsystem* InSaveSubsystem) | Initializes storage with a given save subsystem. |
void | DeinitializeStorage() | Deinitializes storage and saves any changes. |
TArray | GetCategories() const | Returns an array of unique categories from stored items. |
TArray | GetCategoriesInAlphabeticalOrder() const | Returns an array of unique categories sorted alphabetically. |
int32 | GetItemCount() const | Returns the number of items currently stored. |
bool | IsStorageEmpty() const | Checks if the storage is empty. |
GetItemWithDisplayName(TSubclassOf< ULimenStorageItem > ItemClass, const FText& InDisplayName) const | Retrieves an item by its display name. | |
TArray< ULimenStorageItem *> | GetAllItemsOfCategory(TSubclassOf< ULimenStorageItem > ItemClass, const FText& InCategory) const | Retrieves all items of a specific category. |
void | Save() | Saves the current state of storage to persistent data. |
void | Load() | Loads the stored data into the current state of storage. |
bool | HasSavedData() const | Checks if there is any saved data available. |
TArray< ULimenStorageItem *> | GetItems(TSubclassOf< ULimenStorageItem > Class) const | Retrieves all items of a specific class. |
GetItem(const TSubclassOf< ULimenStorageItem >& Class) const | Retrieves the first item of a specific class. |
Usage & Implementation Notes
Threading Constraints: This subsystem is designed to be used on the game thread.
Replication Requirements: None.
Memory Lifetime Management: Items and save data are managed using strong and weak pointers, ensuring proper memory management.
Initialization Dependencies: Requires
ULimenSaveSubsystemfor saving and loading operations.