Compare commits

...

2 Commits

3 changed files with 19 additions and 4 deletions

Binary file not shown.

View File

@ -3,6 +3,8 @@
#include "MainMenuUIWidget.h"
#include "Kismet/GameplayStatics.h"
void UMainMenuUIWidget::NativeConstruct()
{
Super::NativeConstruct();
@ -30,7 +32,11 @@ void UMainMenuUIWidget::NativeConstruct()
void UMainMenuUIWidget::NewGameButtonOnClicked()
{
// TODO: Implement Functionality
// TODO: Replace this is a menu to confirm the user wants to start a new game
if (!NewGameLevel.IsNull())
{
UGameplayStatics::OpenLevelBySoftObjectPtr(GetWorld(), NewGameLevel);
}
}
void UMainMenuUIWidget::LoadGameButtonOnClicked()
@ -40,7 +46,13 @@ void UMainMenuUIWidget::LoadGameButtonOnClicked()
void UMainMenuUIWidget::OptionsButtonOnClicked()
{
// TODO: Implement Functionality
if (OptionsMenuWidget)
{
currentOptionsMenuWidget = CreateWidget<UOptionsUIWidget>(GetWorld(), OptionsMenuWidget);
currentOptionsMenuWidget->AddToViewport();
currentOptionsMenuWidget->SetReturnScreen(this);
this->RemoveFromParent();
}
}
void UMainMenuUIWidget::QuitButtonOnClicked()

View File

@ -38,6 +38,9 @@ public:
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite)
TSubclassOf<class UUserWidget> OptionsMenuWidget;
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite)
TSoftObjectPtr<UWorld> NewGameLevel;
private:
UUserWidget* currentNewGameWidget;