Add LoadGameWidget functionality to MainMenuUIWidget

This commit is contained in:
baz 2024-05-23 23:27:38 +01:00
parent 0a302a8efa
commit d248c90780
2 changed files with 10 additions and 2 deletions

View File

@ -5,6 +5,7 @@
#include "Blueprint/WidgetBlueprintLibrary.h" #include "Blueprint/WidgetBlueprintLibrary.h"
#include "Kismet/GameplayStatics.h" #include "Kismet/GameplayStatics.h"
#include "UI/LoadGameUserWidget.h"
void UMainMenuUIWidget::NativeConstruct() void UMainMenuUIWidget::NativeConstruct()
{ {
@ -84,7 +85,13 @@ void UMainMenuUIWidget::NewGameButtonOnClicked()
void UMainMenuUIWidget::LoadGameButtonOnClicked() void UMainMenuUIWidget::LoadGameButtonOnClicked()
{ {
// TODO: Implement Functionality if (LoadGameMenuWidget)
{
currentLoadGameWidget = CreateWidget<ULoadGameUserWidget>(GetWorld(), LoadGameMenuWidget);
currentLoadGameWidget->AddToViewport();
currentLoadGameWidget->SetReturnScreen(this);
this->RemoveFromParent();
}
} }
void UMainMenuUIWidget::OptionsButtonOnClicked() void UMainMenuUIWidget::OptionsButtonOnClicked()

View File

@ -6,6 +6,7 @@
#include "OptionsUIWidget.h" #include "OptionsUIWidget.h"
#include "Blueprint/UserWidget.h" #include "Blueprint/UserWidget.h"
#include "Components/Button.h" #include "Components/Button.h"
#include "UI/LoadGameUserWidget.h"
#include "UI/NakatomiInteractiveWidget.h" #include "UI/NakatomiInteractiveWidget.h"
#include "MainMenuUIWidget.generated.h" #include "MainMenuUIWidget.generated.h"
@ -57,7 +58,7 @@ public:
private: private:
UUserWidget* currentNewGameWidget; UUserWidget* currentNewGameWidget;
UUserWidget* currentLoadGameWidget; ULoadGameUserWidget* currentLoadGameWidget;
UOptionsUIWidget* currentOptionsMenuWidget; UOptionsUIWidget* currentOptionsMenuWidget;