added main and pause menus
This commit is contained in:
@@ -9,6 +9,7 @@
|
||||
#include "NakedDesire/Items/ItemDefinition.h"
|
||||
#include "NakedDesire/Items/ItemInstance.h"
|
||||
#include "NakedDesire/Global/NakedDesireGameInstance.h"
|
||||
#include "Kismet/GameplayStatics.h"
|
||||
|
||||
void USaveSubsystem::LoadGame(const FString& SlotName)
|
||||
{
|
||||
@@ -27,6 +28,20 @@ void USaveSubsystem::Initialize(FSubsystemCollectionBase& Collection)
|
||||
LoadGame();
|
||||
}
|
||||
|
||||
bool USaveSubsystem::DoesSaveExist() const
|
||||
{
|
||||
return UGameplayStatics::DoesSaveGameExist(ActiveSlotName, SLOT_PLAYER);
|
||||
}
|
||||
|
||||
void USaveSubsystem::StartNewGame()
|
||||
{
|
||||
UGameplayStatics::DeleteGameInSlot(ActiveSlotName, SLOT_PLAYER);
|
||||
|
||||
CurrentSave = UGlobalSaveGameData::CreateNewSaveGame();
|
||||
PopulateStartingData(CurrentSave);
|
||||
UGlobalSaveGameData::SaveGame(CurrentSave, ActiveSlotName);
|
||||
}
|
||||
|
||||
UGlobalSaveGameData* USaveSubsystem::GetCurrentSave()
|
||||
{
|
||||
if (!CurrentSave)
|
||||
|
||||
@@ -22,11 +22,22 @@ public:
|
||||
virtual void Initialize(FSubsystemCollectionBase& Collection) override;
|
||||
|
||||
UGlobalSaveGameData* GetCurrentSave();
|
||||
|
||||
|
||||
// True when a persisted save exists in the active slot — drives the main-menu
|
||||
// Continue button's enabled state.
|
||||
UFUNCTION(BlueprintPure, Category = "Save")
|
||||
bool DoesSaveExist() const;
|
||||
|
||||
// Wipes the active slot and reseeds a fresh save from StartingSaveData, replacing
|
||||
// the cached CurrentSave so the next GetCurrentSave returns the new game. Call before
|
||||
// opening the gameplay level from the main-menu "New Game" flow.
|
||||
UFUNCTION(BlueprintCallable, Category = "Save")
|
||||
void StartNewGame();
|
||||
|
||||
protected:
|
||||
UFUNCTION(BlueprintCallable)
|
||||
void BP_LoadGame();
|
||||
|
||||
|
||||
UFUNCTION(BlueprintCallable)
|
||||
void BP_SaveGame();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user