Compare commits
4 Commits
c941024ecf
...
3a67e84072
Author | SHA1 | Date |
---|---|---|
baz | 3a67e84072 | |
baz | d248c90780 | |
baz | 0a302a8efa | |
baz | 82d2c21721 |
Binary file not shown.
BIN
Content/UI/MainMenu/MainMenuUIWidget.uasset (Stored with Git LFS)
BIN
Content/UI/MainMenu/MainMenuUIWidget.uasset (Stored with Git LFS)
Binary file not shown.
|
@ -5,6 +5,7 @@
|
|||
|
||||
#include "Blueprint/WidgetBlueprintLibrary.h"
|
||||
#include "Kismet/GameplayStatics.h"
|
||||
#include "UI/LoadGameUserWidget.h"
|
||||
|
||||
void UMainMenuUIWidget::NativeConstruct()
|
||||
{
|
||||
|
@ -84,7 +85,13 @@ void UMainMenuUIWidget::NewGameButtonOnClicked()
|
|||
|
||||
void UMainMenuUIWidget::LoadGameButtonOnClicked()
|
||||
{
|
||||
// TODO: Implement Functionality
|
||||
if (LoadGameMenuWidget)
|
||||
{
|
||||
currentLoadGameWidget = CreateWidget<ULoadGameUserWidget>(GetWorld(), LoadGameMenuWidget);
|
||||
currentLoadGameWidget->AddToViewport();
|
||||
currentLoadGameWidget->SetReturnScreen(this);
|
||||
this->RemoveFromParent();
|
||||
}
|
||||
}
|
||||
|
||||
void UMainMenuUIWidget::OptionsButtonOnClicked()
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
#include "OptionsUIWidget.h"
|
||||
#include "Blueprint/UserWidget.h"
|
||||
#include "Components/Button.h"
|
||||
#include "UI/LoadGameUserWidget.h"
|
||||
#include "UI/NakatomiInteractiveWidget.h"
|
||||
#include "MainMenuUIWidget.generated.h"
|
||||
|
||||
|
@ -57,7 +58,7 @@ public:
|
|||
private:
|
||||
UUserWidget* currentNewGameWidget;
|
||||
|
||||
UUserWidget* currentLoadGameWidget;
|
||||
ULoadGameUserWidget* currentLoadGameWidget;
|
||||
|
||||
UOptionsUIWidget* currentOptionsMenuWidget;
|
||||
|
||||
|
|
|
@ -109,21 +109,9 @@ void UOptionsUIWidget::NativeConstruct()
|
|||
SetIsFocusable(true);
|
||||
}
|
||||
|
||||
void UOptionsUIWidget::SetReturnScreen(UUserWidget* userWidget)
|
||||
{
|
||||
if (userWidget)
|
||||
{
|
||||
PreviousScreen = userWidget;
|
||||
}
|
||||
}
|
||||
|
||||
void UOptionsUIWidget::BackButtonOnClicked()
|
||||
{
|
||||
// TODO: Implement Functionality
|
||||
GEngine->GameUserSettings->ApplySettings(false);
|
||||
|
||||
this->RemoveFromParent();
|
||||
PreviousScreen->AddToViewport();
|
||||
ReturnToPreviousScreen();
|
||||
}
|
||||
|
||||
void UOptionsUIWidget::ResetToDefaultsButtonOnClicked()
|
||||
|
|
|
@ -51,15 +51,9 @@ public:
|
|||
|
||||
UPROPERTY(BlueprintReadWrite, meta = (BindWidget))
|
||||
UTextBlock* ResetToDefaultsTextBlock;
|
||||
|
||||
private:
|
||||
|
||||
UUserWidget* PreviousScreen;
|
||||
|
||||
public:
|
||||
virtual void NativeConstruct() override;
|
||||
|
||||
void SetReturnScreen(UUserWidget* userWidget);
|
||||
|
||||
private:
|
||||
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
// 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();
|
||||
}
|
|
@ -0,0 +1,41 @@
|
|||
// 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); }
|
||||
};
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
#include "../UI/NakatomiInteractiveWidget.h"
|
||||
|
||||
#include "GameFramework/GameUserSettings.h"
|
||||
#include "Kismet/GameplayStatics.h"
|
||||
|
||||
void UNakatomiInteractiveWidget::PlayHoveredSound()
|
||||
|
@ -38,3 +39,20 @@ 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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,6 +32,14 @@ public:
|
|||
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite)
|
||||
USoundBase* ButtonClickedSound;
|
||||
|
||||
protected:
|
||||
UUserWidget* PreviousScreen;
|
||||
|
||||
public:
|
||||
|
||||
UFUNCTION()
|
||||
void SetReturnScreen(UUserWidget* userWidget);
|
||||
|
||||
protected:
|
||||
UFUNCTION()
|
||||
void PlayHoveredSound();
|
||||
|
@ -47,5 +55,7 @@ protected:
|
|||
|
||||
UFUNCTION()
|
||||
void PlayClickedSound();
|
||||
|
||||
|
||||
UFUNCTION()
|
||||
void ReturnToPreviousScreen();
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue