32 lines
873 B
C++
32 lines
873 B
C++
// © 2025 Naked People Team. All Rights Reserved.
|
|
|
|
|
|
#include "GlobalSaveGameData.h"
|
|
#include "NakedDesire/Global/Constants.h"
|
|
#include "Kismet/GameplayStatics.h"
|
|
|
|
UGlobalSaveGameData* UGlobalSaveGameData::CreateNewSaveGame()
|
|
{
|
|
UGlobalSaveGameData* NewSave = Cast<UGlobalSaveGameData>(UGameplayStatics::CreateSaveGameObject(StaticClass()));
|
|
if (!NewSave)
|
|
return nullptr;
|
|
|
|
NewSave->Money = STARTING_MONEY;
|
|
|
|
return NewSave;
|
|
}
|
|
|
|
UGlobalSaveGameData* UGlobalSaveGameData::LoadGame(const FString& SlotName)
|
|
{
|
|
if (UGameplayStatics::DoesSaveGameExist(SlotName, SLOT_PLAYER))
|
|
{
|
|
return Cast<UGlobalSaveGameData>(UGameplayStatics::LoadGameFromSlot(SlotName, SLOT_PLAYER));
|
|
}
|
|
|
|
return nullptr;
|
|
}
|
|
|
|
bool UGlobalSaveGameData::SaveGame(UGlobalSaveGameData* SaveGameData, const FString& SlotName)
|
|
{
|
|
return UGameplayStatics::SaveGameToSlot(SaveGameData, SlotName, SLOT_PLAYER);
|
|
} |