Refactor OptionsUI functionality into NakatomiInteractiveWidget
This commit is contained in:
parent
c941024ecf
commit
82d2c21721
Binary file not shown.
|
@ -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:
|
||||
|
||||
|
|
|
@ -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