Compare commits

..

No commits in common. "3a67e84072fd432af7eaef0baf458e522fc1486e" and "c941024ecf4d603a7086d8b982b6a98e6a42fced" have entirely different histories.

10 changed files with 24 additions and 112 deletions

Binary file not shown.

Binary file not shown.

View File

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

View File

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

View File

@ -109,9 +109,21 @@ void UOptionsUIWidget::NativeConstruct()
SetIsFocusable(true);
}
void UOptionsUIWidget::SetReturnScreen(UUserWidget* userWidget)
{
if (userWidget)
{
PreviousScreen = userWidget;
}
}
void UOptionsUIWidget::BackButtonOnClicked()
{
ReturnToPreviousScreen();
// TODO: Implement Functionality
GEngine->GameUserSettings->ApplySettings(false);
this->RemoveFromParent();
PreviousScreen->AddToViewport();
}
void UOptionsUIWidget::ResetToDefaultsButtonOnClicked()

View File

@ -52,9 +52,15 @@ public:
UPROPERTY(BlueprintReadWrite, meta = (BindWidget))
UTextBlock* ResetToDefaultsTextBlock;
private:
UUserWidget* PreviousScreen;
public:
virtual void NativeConstruct() override;
void SetReturnScreen(UUserWidget* userWidget);
private:
UFUNCTION()

View File

@ -1,26 +0,0 @@
// Fill out your copyright notice in the Description page of Project Settings.
#include "../UI/LoadGameUserWidget.h"
void ULoadGameUserWidget::NativeConstruct()
{
Super::NativeConstruct();
if (CancelButton)
{
CancelButton->OnClicked.AddUniqueDynamic(this, &ULoadGameUserWidget::CancelButtonOnClicked);
CancelButton->OnClicked.AddUniqueDynamic(this, &ULoadGameUserWidget::PlayClickedSound);
CancelButton->OnHovered.AddUniqueDynamic(this, &ULoadGameUserWidget::CancelButtonHoveredDelegate);
CancelButton->OnHovered.AddUniqueDynamic(this, &ULoadGameUserWidget::PlayHoveredSound);
CancelButton->OnUnhovered.AddUniqueDynamic(this, &ULoadGameUserWidget::CancelButtonUnhoveredDelegate);
CancelButton->OnUnhovered.AddUniqueDynamic(this, &ULoadGameUserWidget::PlayUnhoveredSound);
}
}
void ULoadGameUserWidget::CancelButtonOnClicked()
{
ReturnToPreviousScreen();
}

View File

@ -1,41 +0,0 @@
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "NakatomiInteractiveWidget.h"
#include "Components/Button.h"
#include "Components/ScrollBox.h"
#include "LoadGameUserWidget.generated.h"
/**
*
*/
UCLASS()
class NAKATOMI_API ULoadGameUserWidget : public UNakatomiInteractiveWidget
{
GENERATED_BODY()
public:
UPROPERTY(BlueprintReadWrite, meta = (BindWidget))
UButton* CancelButton;
UPROPERTY(BlueprintReadWrite, meta = (BindWidget))
UTextBlock* CancelButtonTextBlock;
UPROPERTY(BlueprintReadWrite, meta = (BindWidget))
UScrollBox* SavedGamesScrollBox;
public:
virtual void NativeConstruct() override;
private:
UFUNCTION()
void CancelButtonOnClicked();
UFUNCTION()
void CancelButtonHoveredDelegate() { SetTextBlockHovered(CancelButtonTextBlock); }
UFUNCTION()
void CancelButtonUnhoveredDelegate() { SetTextBlockUnhovered(CancelButtonTextBlock); }
};

View File

@ -3,7 +3,6 @@
#include "../UI/NakatomiInteractiveWidget.h"
#include "GameFramework/GameUserSettings.h"
#include "Kismet/GameplayStatics.h"
void UNakatomiInteractiveWidget::PlayHoveredSound()
@ -39,20 +38,3 @@ void UNakatomiInteractiveWidget::PlayClickedSound()
UGameplayStatics::PlaySound2D(GetWorld(), ButtonUnhoveredSound);
}
}
void UNakatomiInteractiveWidget::ReturnToPreviousScreen()
{
// TODO: Implement Functionality
GEngine->GameUserSettings->ApplySettings(false);
this->RemoveFromParent();
PreviousScreen->AddToViewport();
}
void UNakatomiInteractiveWidget::SetReturnScreen(UUserWidget* userWidget)
{
if (userWidget)
{
PreviousScreen = userWidget;
}
}

View File

@ -32,14 +32,6 @@ public:
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite)
USoundBase* ButtonClickedSound;
protected:
UUserWidget* PreviousScreen;
public:
UFUNCTION()
void SetReturnScreen(UUserWidget* userWidget);
protected:
UFUNCTION()
void PlayHoveredSound();
@ -56,6 +48,4 @@ protected:
UFUNCTION()
void PlayClickedSound();
UFUNCTION()
void ReturnToPreviousScreen();
};