Compare commits

..

No commits in common. "38405ca8e2e4e1bde88f220be2c62891cb1b77df" and "15fdc538e5fcdcfc02a38ec953e6f7993a28ae76" have entirely different histories.

6 changed files with 4 additions and 40 deletions

Binary file not shown.

Binary file not shown.

View File

@ -3,11 +3,6 @@
#include "../UI/LoadGameUserWidget.h" #include "../UI/LoadGameUserWidget.h"
#include "SaveGameEntryUserWidget.h"
#include "Blueprint/WidgetTree.h"
#include "Kismet/GameplayStatics.h"
#include "Nakatomi/NakatomiGameInstance.h"
void ULoadGameUserWidget::NativeConstruct() void ULoadGameUserWidget::NativeConstruct()
{ {
Super::NativeConstruct(); Super::NativeConstruct();
@ -23,22 +18,6 @@ void ULoadGameUserWidget::NativeConstruct()
CancelButton->OnUnhovered.AddUniqueDynamic(this, &ULoadGameUserWidget::CancelButtonUnhoveredDelegate); CancelButton->OnUnhovered.AddUniqueDynamic(this, &ULoadGameUserWidget::CancelButtonUnhoveredDelegate);
CancelButton->OnUnhovered.AddUniqueDynamic(this, &ULoadGameUserWidget::PlayUnhoveredSound); CancelButton->OnUnhovered.AddUniqueDynamic(this, &ULoadGameUserWidget::PlayUnhoveredSound);
} }
UNakatomiGameInstance* gameInstance = Cast<UNakatomiGameInstance>(UGameplayStatics::GetGameInstance(GetWorld()))
if (gameInstance && IsValid(SaveGameEntryWidgetTemplate))
{
TArray<FNakatomiSaveFileInfo> SaveFiles = gameInstance->GetAllSaveFilesFromDisk();
for (FNakatomiSaveFileInfo SaveFile : SaveFiles)
{
USaveGameEntryUserWidget* SaveGameEntry = WidgetTree->ConstructWidget<USaveGameEntryUserWidget>(
SaveGameEntryWidgetTemplate, FName("SaveGameEntry"));
SaveGameEntry->SetSaveInfo(SaveFile);
SavedGamesScrollBox->AddChild(SaveGameEntry);
}
}
} }
void ULoadGameUserWidget::CancelButtonOnClicked() void ULoadGameUserWidget::CancelButtonOnClicked()

View File

@ -26,9 +26,6 @@ public:
UPROPERTY(BlueprintReadWrite, meta = (BindWidget)) UPROPERTY(BlueprintReadWrite, meta = (BindWidget))
UScrollBox* SavedGamesScrollBox; UScrollBox* SavedGamesScrollBox;
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite)
TSubclassOf<class USaveGameEntryUserWidget> SaveGameEntryWidgetTemplate;
public: public:
virtual void NativeConstruct() override; virtual void NativeConstruct() override;

View File

@ -20,17 +20,12 @@ void USaveGameEntryUserWidget::NativeConstruct()
} }
} }
void USaveGameEntryUserWidget::SetSaveInfo(FNakatomiSaveFileInfo SaveFile) void USaveGameEntryUserWidget::SetSaveInfo()
{ {
SaveFileInfo = SaveFile;
PlayerNameTextBlock->SetText(FText::FromString(SaveFileInfo.PlayerName));
CurrentLevelTextBlock->SetText(FText::FromString(SaveFileInfo.CurrentLevel));
DateTimeSavedTextBlock->SetText(FText::FromString(SaveFileInfo.DateTimeSaved));
} }
void USaveGameEntryUserWidget::LoadSaveButtonOnClicked() void USaveGameEntryUserWidget::LoadSaveButtonOnClicked()
{ {
// TODO: implement loading of stuff
} }
void USaveGameEntryUserWidget::LoadSaveButtonHoveredDelegate() void USaveGameEntryUserWidget::LoadSaveButtonHoveredDelegate()

View File

@ -5,7 +5,6 @@
#include "CoreMinimal.h" #include "CoreMinimal.h"
#include "NakatomiInteractiveWidget.h" #include "NakatomiInteractiveWidget.h"
#include "Components/Button.h" #include "Components/Button.h"
#include "Nakatomi/NakatomiSaveFileInfo.h"
#include "SaveGameEntryUserWidget.generated.h" #include "SaveGameEntryUserWidget.generated.h"
/** /**
@ -30,14 +29,11 @@ public:
UPROPERTY(BlueprintReadWrite, meta = (BindWidget)) UPROPERTY(BlueprintReadWrite, meta = (BindWidget))
UTextBlock* DateTimeSavedTextBlock; UTextBlock* DateTimeSavedTextBlock;
private:
FNakatomiSaveFileInfo SaveFileInfo;
public: public:
virtual void NativeConstruct() override; virtual void NativeConstruct() override;
UFUNCTION() UFUNCTION()
void SetSaveInfo(FNakatomiSaveFileInfo SaveFile); void SetSaveInfo();
private: private:
UFUNCTION() UFUNCTION()