Add SaveGameEntry OnClick functionality

This commit is contained in:
baz 2024-05-27 20:30:23 +01:00
parent a90d50afd7
commit 2e554be13a
1 changed files with 15 additions and 1 deletions

View File

@ -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()