Compare commits
6 Commits
a90d50afd7
...
0e9a36f1c9
Author | SHA1 | Date |
---|---|---|
baz | 0e9a36f1c9 | |
baz | ee9718e9e3 | |
baz | 3ea7bc2dc4 | |
baz | 6a494261d7 | |
baz | 6e822f88b0 | |
baz | 2e554be13a |
BIN
Content/UI/LoadGame/BP_SaveGameEntryTemplate.uasset (Stored with Git LFS)
BIN
Content/UI/LoadGame/BP_SaveGameEntryTemplate.uasset (Stored with Git LFS)
Binary file not shown.
BIN
Content/UI/Pause/PauseMenu.uasset (Stored with Git LFS)
BIN
Content/UI/Pause/PauseMenu.uasset (Stored with Git LFS)
Binary file not shown.
|
@ -29,6 +29,7 @@ void ALevelKeyPickup::OnOverlapBegin(UPrimitiveComponent* OverlappedComponent, A
|
|||
if (auto gameInstance = Cast<UNakatomiGameInstance>(UGameplayStatics::GetGameInstance(GetWorld())))
|
||||
{
|
||||
gameInstance->GetCurrentLevelManager()->IncrementCollectedLevelKeys();
|
||||
gameInstance->SaveGame();
|
||||
}
|
||||
|
||||
Super::OnOverlapBegin(OverlappedComponent, OtherActor, OtherComp, OtherBodyIndex, bFromSweep, SweepResult);
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
#include "MainMenuUIWidget.h"
|
||||
|
||||
#include "NakatomiGameInstance.h"
|
||||
#include "Blueprint/WidgetBlueprintLibrary.h"
|
||||
#include "Kismet/GameplayStatics.h"
|
||||
#include "UI/LoadGameUserWidget.h"
|
||||
|
@ -68,9 +69,11 @@ void UMainMenuUIWidget::NativeConstruct()
|
|||
|
||||
void UMainMenuUIWidget::NewGameButtonOnClicked()
|
||||
{
|
||||
// TODO: Replace this is a menu to confirm the user wants to start a new game
|
||||
if (!NewGameLevel.IsNull())
|
||||
{
|
||||
UNakatomiGameInstance* gameInstance = Cast<UNakatomiGameInstance>(UGameplayStatics::GetGameInstance(GetWorld()));
|
||||
gameInstance->CreateNewSaveGame("test1");
|
||||
|
||||
UGameplayStatics::OpenLevelBySoftObjectPtr(GetWorld(), NewGameLevel);
|
||||
}
|
||||
|
||||
|
|
|
@ -4,6 +4,8 @@
|
|||
#include "NakatomiCharacter.h"
|
||||
|
||||
#include "NakatomiCMC.h"
|
||||
#include "NakatomiGameInstance.h"
|
||||
#include "Kismet/GameplayStatics.h"
|
||||
|
||||
// Sets default values
|
||||
ANakatomiCharacter::ANakatomiCharacter(const FObjectInitializer& ObjectInitializer) : Super(
|
||||
|
@ -30,6 +32,15 @@ void ANakatomiCharacter::BeginPlay()
|
|||
SetInventoryToDefault();
|
||||
|
||||
NakatomiCMC = Cast<UNakatomiCMC>(GetCharacterMovement());
|
||||
|
||||
if (UNakatomiGameInstance* gameInstance = Cast<UNakatomiGameInstance>(UGameplayStatics::GetGameInstance(GetWorld())))
|
||||
{
|
||||
if (UNakatomiSaveGame* Save = gameInstance->GetSaveGameObject())
|
||||
{
|
||||
//TODO: More loading here
|
||||
GetHealthComponent()->SetCurrentHealth(Save->PlayerHealth);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Called every frame
|
||||
|
|
|
@ -71,7 +71,7 @@ UNakatomiSaveGame* UNakatomiGameInstance::CreateNewSaveGame(FString PlayerName)
|
|||
if (UNakatomiSaveGame* Save = Cast<UNakatomiSaveGame>(
|
||||
UGameplayStatics::CreateSaveGameObject(UNakatomiSaveGame::StaticClass())))
|
||||
{
|
||||
SaveGameObject->PlayerName = PlayerName;
|
||||
Save->PlayerName = PlayerName;
|
||||
|
||||
if (UGameplayStatics::SaveGameToSlot(Save, PlayerName, 0))
|
||||
{
|
||||
|
|
|
@ -45,7 +45,7 @@ public:
|
|||
UNakatomiSaveGame* LoadGameFromSlot(FString SaveSlotName);
|
||||
|
||||
UFUNCTION(BlueprintCallable)
|
||||
bool SaveGame(bool ResetDefaults);
|
||||
bool SaveGame(bool ResetDefaults = false);
|
||||
|
||||
UFUNCTION(BlueprintCallable)
|
||||
UNakatomiSaveGame* GetSaveGameObject();
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
#include "PauseUIWidget.h"
|
||||
|
||||
#include "NakatomiGameInstance.h"
|
||||
#include "Blueprint/WidgetBlueprintLibrary.h"
|
||||
#include "Kismet/GameplayStatics.h"
|
||||
|
||||
|
@ -105,7 +106,12 @@ void UPauseUIWidget::OptionsButtonOnClicked()
|
|||
|
||||
void UPauseUIWidget::SaveButtonOnClicked()
|
||||
{
|
||||
// TODO: Implement Functionality
|
||||
UNakatomiGameInstance* gameInstance = Cast<UNakatomiGameInstance>(UGameplayStatics::GetGameInstance(GetWorld()));
|
||||
|
||||
if (gameInstance->SaveGame())
|
||||
{
|
||||
PlayAnimation(SaveConfirmedAnimation, 0.0f, 1, EUMGSequencePlayMode::Forward, 1.0f);
|
||||
}
|
||||
}
|
||||
|
||||
void UPauseUIWidget::QuitButtonOnClicked()
|
||||
|
|
|
@ -36,6 +36,12 @@ public:
|
|||
UPROPERTY(BlueprintReadWrite, meta = (BindWidget))
|
||||
UTextBlock* SaveTextBlock;
|
||||
|
||||
UPROPERTY(BlueprintReadWrite, meta = (BindWidget))
|
||||
UTextBlock* SaveConfirmedTextBlock;
|
||||
|
||||
UPROPERTY(Transient, meta = (BindWidgetAnim))
|
||||
UWidgetAnimation* SaveConfirmedAnimation;
|
||||
|
||||
UPROPERTY(BlueprintReadWrite, meta = (BindWidget))
|
||||
UButton* QuitButton;
|
||||
|
||||
|
|
|
@ -3,6 +3,10 @@
|
|||
|
||||
#include "../UI/SaveGameEntryUserWidget.h"
|
||||
|
||||
#include "Blueprint/WidgetBlueprintLibrary.h"
|
||||
#include "Kismet/GameplayStatics.h"
|
||||
#include "Nakatomi/NakatomiGameInstance.h"
|
||||
|
||||
void USaveGameEntryUserWidget::NativeConstruct()
|
||||
{
|
||||
Super::NativeConstruct();
|
||||
|
@ -30,7 +34,17 @@ void USaveGameEntryUserWidget::SetSaveInfo(FNakatomiSaveFileInfo SaveFile)
|
|||
|
||||
void USaveGameEntryUserWidget::LoadSaveButtonOnClicked()
|
||||
{
|
||||
// TODO: implement loading of stuff
|
||||
UNakatomiGameInstance* gameInstance = Cast<UNakatomiGameInstance>(UGameplayStatics::GetGameInstance(GetWorld()));
|
||||
UNakatomiSaveGame* Save = gameInstance->LoadGameFromSlot(SaveFileInfo.PlayerName);
|
||||
UGameplayStatics::OpenLevel(GetWorld(), FName(Save->LevelName));
|
||||
|
||||
if (APlayerController* PlayerController = UGameplayStatics::GetPlayerController(GetWorld(), 0))
|
||||
{
|
||||
PlayerController->bShowMouseCursor = false;
|
||||
UWidgetBlueprintLibrary::SetInputMode_GameOnly(PlayerController);
|
||||
}
|
||||
|
||||
SetIsFocusable(false);
|
||||
}
|
||||
|
||||
void USaveGameEntryUserWidget::LoadSaveButtonHoveredDelegate()
|
||||
|
|
Loading…
Reference in New Issue