Compare commits

..

No commits in common. "0e9a36f1c900dea9a6009eb21dd0bc4aae220767" and "a90d50afd7a41fe62d696646cf78b840aa21b112" have entirely different histories.

10 changed files with 9 additions and 50 deletions

Binary file not shown.

BIN
Content/UI/Pause/PauseMenu.uasset (Stored with Git LFS)

Binary file not shown.

View File

@ -29,7 +29,6 @@ void ALevelKeyPickup::OnOverlapBegin(UPrimitiveComponent* OverlappedComponent, A
if (auto gameInstance = Cast<UNakatomiGameInstance>(UGameplayStatics::GetGameInstance(GetWorld()))) if (auto gameInstance = Cast<UNakatomiGameInstance>(UGameplayStatics::GetGameInstance(GetWorld())))
{ {
gameInstance->GetCurrentLevelManager()->IncrementCollectedLevelKeys(); gameInstance->GetCurrentLevelManager()->IncrementCollectedLevelKeys();
gameInstance->SaveGame();
} }
Super::OnOverlapBegin(OverlappedComponent, OtherActor, OtherComp, OtherBodyIndex, bFromSweep, SweepResult); Super::OnOverlapBegin(OverlappedComponent, OtherActor, OtherComp, OtherBodyIndex, bFromSweep, SweepResult);

View File

@ -3,7 +3,6 @@
#include "MainMenuUIWidget.h" #include "MainMenuUIWidget.h"
#include "NakatomiGameInstance.h"
#include "Blueprint/WidgetBlueprintLibrary.h" #include "Blueprint/WidgetBlueprintLibrary.h"
#include "Kismet/GameplayStatics.h" #include "Kismet/GameplayStatics.h"
#include "UI/LoadGameUserWidget.h" #include "UI/LoadGameUserWidget.h"
@ -69,11 +68,9 @@ void UMainMenuUIWidget::NativeConstruct()
void UMainMenuUIWidget::NewGameButtonOnClicked() void UMainMenuUIWidget::NewGameButtonOnClicked()
{ {
// TODO: Replace this is a menu to confirm the user wants to start a new game
if (!NewGameLevel.IsNull()) if (!NewGameLevel.IsNull())
{ {
UNakatomiGameInstance* gameInstance = Cast<UNakatomiGameInstance>(UGameplayStatics::GetGameInstance(GetWorld()));
gameInstance->CreateNewSaveGame("test1");
UGameplayStatics::OpenLevelBySoftObjectPtr(GetWorld(), NewGameLevel); UGameplayStatics::OpenLevelBySoftObjectPtr(GetWorld(), NewGameLevel);
} }

View File

@ -4,8 +4,6 @@
#include "NakatomiCharacter.h" #include "NakatomiCharacter.h"
#include "NakatomiCMC.h" #include "NakatomiCMC.h"
#include "NakatomiGameInstance.h"
#include "Kismet/GameplayStatics.h"
// Sets default values // Sets default values
ANakatomiCharacter::ANakatomiCharacter(const FObjectInitializer& ObjectInitializer) : Super( ANakatomiCharacter::ANakatomiCharacter(const FObjectInitializer& ObjectInitializer) : Super(
@ -32,15 +30,6 @@ void ANakatomiCharacter::BeginPlay()
SetInventoryToDefault(); SetInventoryToDefault();
NakatomiCMC = Cast<UNakatomiCMC>(GetCharacterMovement()); 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 // Called every frame

View File

@ -71,7 +71,7 @@ UNakatomiSaveGame* UNakatomiGameInstance::CreateNewSaveGame(FString PlayerName)
if (UNakatomiSaveGame* Save = Cast<UNakatomiSaveGame>( if (UNakatomiSaveGame* Save = Cast<UNakatomiSaveGame>(
UGameplayStatics::CreateSaveGameObject(UNakatomiSaveGame::StaticClass()))) UGameplayStatics::CreateSaveGameObject(UNakatomiSaveGame::StaticClass())))
{ {
Save->PlayerName = PlayerName; SaveGameObject->PlayerName = PlayerName;
if (UGameplayStatics::SaveGameToSlot(Save, PlayerName, 0)) if (UGameplayStatics::SaveGameToSlot(Save, PlayerName, 0))
{ {

View File

@ -45,7 +45,7 @@ public:
UNakatomiSaveGame* LoadGameFromSlot(FString SaveSlotName); UNakatomiSaveGame* LoadGameFromSlot(FString SaveSlotName);
UFUNCTION(BlueprintCallable) UFUNCTION(BlueprintCallable)
bool SaveGame(bool ResetDefaults = false); bool SaveGame(bool ResetDefaults);
UFUNCTION(BlueprintCallable) UFUNCTION(BlueprintCallable)
UNakatomiSaveGame* GetSaveGameObject(); UNakatomiSaveGame* GetSaveGameObject();

View File

@ -3,7 +3,6 @@
#include "PauseUIWidget.h" #include "PauseUIWidget.h"
#include "NakatomiGameInstance.h"
#include "Blueprint/WidgetBlueprintLibrary.h" #include "Blueprint/WidgetBlueprintLibrary.h"
#include "Kismet/GameplayStatics.h" #include "Kismet/GameplayStatics.h"
@ -106,12 +105,7 @@ void UPauseUIWidget::OptionsButtonOnClicked()
void UPauseUIWidget::SaveButtonOnClicked() void UPauseUIWidget::SaveButtonOnClicked()
{ {
UNakatomiGameInstance* gameInstance = Cast<UNakatomiGameInstance>(UGameplayStatics::GetGameInstance(GetWorld())); // TODO: Implement Functionality
if (gameInstance->SaveGame())
{
PlayAnimation(SaveConfirmedAnimation, 0.0f, 1, EUMGSequencePlayMode::Forward, 1.0f);
}
} }
void UPauseUIWidget::QuitButtonOnClicked() void UPauseUIWidget::QuitButtonOnClicked()

View File

@ -36,12 +36,6 @@ public:
UPROPERTY(BlueprintReadWrite, meta = (BindWidget)) UPROPERTY(BlueprintReadWrite, meta = (BindWidget))
UTextBlock* SaveTextBlock; UTextBlock* SaveTextBlock;
UPROPERTY(BlueprintReadWrite, meta = (BindWidget))
UTextBlock* SaveConfirmedTextBlock;
UPROPERTY(Transient, meta = (BindWidgetAnim))
UWidgetAnimation* SaveConfirmedAnimation;
UPROPERTY(BlueprintReadWrite, meta = (BindWidget)) UPROPERTY(BlueprintReadWrite, meta = (BindWidget))
UButton* QuitButton; UButton* QuitButton;

View File

@ -3,10 +3,6 @@
#include "../UI/SaveGameEntryUserWidget.h" #include "../UI/SaveGameEntryUserWidget.h"
#include "Blueprint/WidgetBlueprintLibrary.h"
#include "Kismet/GameplayStatics.h"
#include "Nakatomi/NakatomiGameInstance.h"
void USaveGameEntryUserWidget::NativeConstruct() void USaveGameEntryUserWidget::NativeConstruct()
{ {
Super::NativeConstruct(); Super::NativeConstruct();
@ -34,17 +30,7 @@ void USaveGameEntryUserWidget::SetSaveInfo(FNakatomiSaveFileInfo SaveFile)
void USaveGameEntryUserWidget::LoadSaveButtonOnClicked() void USaveGameEntryUserWidget::LoadSaveButtonOnClicked()
{ {
UNakatomiGameInstance* gameInstance = Cast<UNakatomiGameInstance>(UGameplayStatics::GetGameInstance(GetWorld())); // TODO: implement loading of stuff
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() void USaveGameEntryUserWidget::LoadSaveButtonHoveredDelegate()