Simplify class
This commit is contained in:
parent
44e6876a8c
commit
a8aeedf7ce
@ -39,25 +39,15 @@ void UOptionsMenuWidget::NativeConstruct()
|
||||
if (ResetToDefaultsButton)
|
||||
{
|
||||
ResetToDefaultsButton->OnClicked.AddUniqueDynamic(this, &UOptionsMenuWidget::ResetToDefaultsOnClicked);
|
||||
ResetToDefaultsButton->OnClicked.AddUniqueDynamic(this, &UOptionsMenuWidget::PlayClickedSound);
|
||||
|
||||
ResetToDefaultsButton->OnHovered.AddUniqueDynamic(this, &UOptionsMenuWidget::PlayHoveredSound);
|
||||
ResetToDefaultsButton->OnHovered.AddUniqueDynamic(this, &UOptionsMenuWidget::ResetToDefaultsTextBlockHoveredDelegate);
|
||||
|
||||
ResetToDefaultsButton->OnUnhovered.AddUniqueDynamic(this, &UOptionsMenuWidget::ResetToDefaultsTextBlockUnhoveredDelegate);
|
||||
ResetToDefaultsButton->OnUnhovered.AddUniqueDynamic(this, &UOptionsMenuWidget::PlayUnhoveredSound);
|
||||
ResetToDefaultsButton->OnHovered.AddUniqueDynamic(this, &UOptionsMenuWidget::ResetToDefaultsButtonOnHovered);
|
||||
ResetToDefaultsButton->OnUnhovered.AddUniqueDynamic(this, &UOptionsMenuWidget::ResetToDefaultsButtonOnUnhovered);
|
||||
}
|
||||
|
||||
if (ReturnButton)
|
||||
{
|
||||
ReturnButton->OnClicked.AddUniqueDynamic(this, &UOptionsMenuWidget::ReturnButtonOnClicked);
|
||||
ReturnButton->OnClicked.AddUniqueDynamic(this, &UOptionsMenuWidget::PlayClickedSound);
|
||||
|
||||
ReturnButton->OnHovered.AddUniqueDynamic(this, &UOptionsMenuWidget::PlayHoveredSound);
|
||||
ReturnButton->OnHovered.AddUniqueDynamic(this, &UOptionsMenuWidget::ReturnTextBlockHoveredDelegate);
|
||||
|
||||
ReturnButton->OnUnhovered.AddUniqueDynamic(this, &UOptionsMenuWidget::ReturnTextBlockUnhoveredDelegate);
|
||||
ReturnButton->OnUnhovered.AddUniqueDynamic(this, &UOptionsMenuWidget::PlayUnhoveredSound);
|
||||
ReturnButton->OnHovered.AddUniqueDynamic(this, &UOptionsMenuWidget::ReturnButtonOnHovered);
|
||||
ReturnButton->OnUnhovered.AddUniqueDynamic(this, &UOptionsMenuWidget::ReturnButtonOnUnhovered);
|
||||
}
|
||||
}
|
||||
|
||||
@ -275,6 +265,8 @@ void UOptionsMenuWidget::OnAudioLeverValueChanged(float Value)
|
||||
|
||||
void UOptionsMenuWidget::ResetToDefaultsOnClicked()
|
||||
{
|
||||
PlayClickedSound();
|
||||
|
||||
// Set Resolution to Monitor Res
|
||||
TArray<FIntPoint> Resolutions;
|
||||
UKismetSystemLibrary::GetSupportedFullscreenResolutions(Resolutions);
|
||||
@ -282,7 +274,8 @@ void UOptionsMenuWidget::ResetToDefaultsOnClicked()
|
||||
if (Resolutions.Num() > 0)
|
||||
{
|
||||
GEngine->GameUserSettings->SetScreenResolution(Resolutions.Last());
|
||||
FString ResolutionString = FString::FromInt(Resolutions.Last().X) + "x" + FString::FromInt(Resolutions.Last().Y);
|
||||
FString ResolutionString = FString::FromInt(Resolutions.Last().X) + "x" +
|
||||
FString::FromInt(Resolutions.Last().Y);
|
||||
ResolutionComboBox->SetSelectedOption(ResolutionString);
|
||||
}
|
||||
else
|
||||
@ -322,6 +315,8 @@ void UOptionsMenuWidget::ResetToDefaultsOnClicked()
|
||||
|
||||
void UOptionsMenuWidget::ReturnButtonOnClicked()
|
||||
{
|
||||
PlayClickedSound();
|
||||
|
||||
if (MainMenuMenuWidget)
|
||||
{
|
||||
RemoveFromParent();
|
||||
@ -336,6 +331,30 @@ void UOptionsMenuWidget::ReturnButtonOnClicked()
|
||||
}
|
||||
}
|
||||
|
||||
void UOptionsMenuWidget::ResetToDefaultsButtonOnHovered()
|
||||
{
|
||||
PlayHoveredSound();
|
||||
SetTextBlockHovered(ResetToDefaultsBlock);
|
||||
}
|
||||
|
||||
void UOptionsMenuWidget::ResetToDefaultsButtonOnUnhovered()
|
||||
{
|
||||
PlayUnhoveredSound();
|
||||
SetTextBlockUnhovered(ResetToDefaultsBlock);
|
||||
}
|
||||
|
||||
void UOptionsMenuWidget::ReturnButtonOnHovered()
|
||||
{
|
||||
PlayHoveredSound();
|
||||
SetTextBlockHovered(ReturnBlock);
|
||||
}
|
||||
|
||||
void UOptionsMenuWidget::ReturnButtonOnUnhovered()
|
||||
{
|
||||
PlayUnhoveredSound();
|
||||
SetTextBlockUnhovered(ReturnBlock);
|
||||
}
|
||||
|
||||
void UOptionsMenuWidget::GetListOfUniqueRefreshRates(TArray<uint32>& RefreshRates)
|
||||
{
|
||||
FScreenResolutionArray ScreenResolutions;
|
||||
|
@ -59,11 +59,9 @@ class VAMPIRES_API UOptionsMenuWidget : public UVampireInteractiveWidget
|
||||
UPROPERTY(EditDefaultsOnly, Category = "Widget Settings | Sound Settings")
|
||||
TObjectPtr<USoundClass> MasterSoundClass = nullptr;
|
||||
|
||||
protected:
|
||||
UFUNCTION()
|
||||
virtual void NativeConstruct() override;
|
||||
|
||||
private:
|
||||
void GenerateWindowTypeOptions();
|
||||
|
||||
void GenerateResolutionOptions();
|
||||
@ -104,16 +102,16 @@ private:
|
||||
void ReturnButtonOnClicked();
|
||||
|
||||
UFUNCTION()
|
||||
void ResetToDefaultsTextBlockHoveredDelegate() { SetTextBlockHovered(ResetToDefaultsBlock); }
|
||||
void ResetToDefaultsButtonOnHovered();
|
||||
|
||||
UFUNCTION()
|
||||
void ResetToDefaultsTextBlockUnhoveredDelegate() { SetTextBlockUnhovered(ResetToDefaultsBlock); }
|
||||
void ResetToDefaultsButtonOnUnhovered();
|
||||
|
||||
UFUNCTION()
|
||||
void ReturnTextBlockHoveredDelegate() { SetTextBlockHovered(ReturnBlock); }
|
||||
void ReturnButtonOnHovered();
|
||||
|
||||
UFUNCTION()
|
||||
void ReturnTextBlockUnhoveredDelegate() { SetTextBlockUnhovered(ReturnBlock); }
|
||||
void ReturnButtonOnUnhovered();
|
||||
|
||||
void GetListOfUniqueRefreshRates(TArray<uint32>& RefreshRates);
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user