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);
|
SetIsFocusable(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void UOptionsUIWidget::SetReturnScreen(UUserWidget* userWidget)
|
|
||||||
{
|
|
||||||
if (userWidget)
|
|
||||||
{
|
|
||||||
PreviousScreen = userWidget;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void UOptionsUIWidget::BackButtonOnClicked()
|
void UOptionsUIWidget::BackButtonOnClicked()
|
||||||
{
|
{
|
||||||
// TODO: Implement Functionality
|
ReturnToPreviousScreen();
|
||||||
GEngine->GameUserSettings->ApplySettings(false);
|
|
||||||
|
|
||||||
this->RemoveFromParent();
|
|
||||||
PreviousScreen->AddToViewport();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void UOptionsUIWidget::ResetToDefaultsButtonOnClicked()
|
void UOptionsUIWidget::ResetToDefaultsButtonOnClicked()
|
||||||
|
|
|
@ -51,15 +51,9 @@ public:
|
||||||
|
|
||||||
UPROPERTY(BlueprintReadWrite, meta = (BindWidget))
|
UPROPERTY(BlueprintReadWrite, meta = (BindWidget))
|
||||||
UTextBlock* ResetToDefaultsTextBlock;
|
UTextBlock* ResetToDefaultsTextBlock;
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
UUserWidget* PreviousScreen;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
virtual void NativeConstruct() override;
|
virtual void NativeConstruct() override;
|
||||||
|
|
||||||
void SetReturnScreen(UUserWidget* userWidget);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
|
|
||||||
#include "../UI/NakatomiInteractiveWidget.h"
|
#include "../UI/NakatomiInteractiveWidget.h"
|
||||||
|
|
||||||
|
#include "GameFramework/GameUserSettings.h"
|
||||||
#include "Kismet/GameplayStatics.h"
|
#include "Kismet/GameplayStatics.h"
|
||||||
|
|
||||||
void UNakatomiInteractiveWidget::PlayHoveredSound()
|
void UNakatomiInteractiveWidget::PlayHoveredSound()
|
||||||
|
@ -38,3 +39,20 @@ void UNakatomiInteractiveWidget::PlayClickedSound()
|
||||||
UGameplayStatics::PlaySound2D(GetWorld(), ButtonUnhoveredSound);
|
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)
|
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite)
|
||||||
USoundBase* ButtonClickedSound;
|
USoundBase* ButtonClickedSound;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
UUserWidget* PreviousScreen;
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
UFUNCTION()
|
||||||
|
void SetReturnScreen(UUserWidget* userWidget);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
UFUNCTION()
|
UFUNCTION()
|
||||||
void PlayHoveredSound();
|
void PlayHoveredSound();
|
||||||
|
@ -47,5 +55,7 @@ protected:
|
||||||
|
|
||||||
UFUNCTION()
|
UFUNCTION()
|
||||||
void PlayClickedSound();
|
void PlayClickedSound();
|
||||||
|
|
||||||
|
UFUNCTION()
|
||||||
|
void ReturnToPreviousScreen();
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue