Add OnHovered Sound2D in OptionsUIWidget
This commit is contained in:
parent
96c520a793
commit
16efcc8fd7
BIN
Content/UI/Options/OptionsMenu.uasset (Stored with Git LFS)
BIN
Content/UI/Options/OptionsMenu.uasset (Stored with Git LFS)
Binary file not shown.
|
@ -21,6 +21,7 @@ void UOptionsUIWidget::NativeConstruct()
|
||||||
}
|
}
|
||||||
|
|
||||||
ResolutionButton->OnClicked.AddUniqueDynamic(this, &UOptionsUIWidget::OnResolutionSelectorChanged);
|
ResolutionButton->OnClicked.AddUniqueDynamic(this, &UOptionsUIWidget::OnResolutionSelectorChanged);
|
||||||
|
ResolutionButton->OnHovered.AddUniqueDynamic(this, &UOptionsUIWidget::PlayHoveredSound);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (FullscreenCheckBox)
|
if (FullscreenCheckBox)
|
||||||
|
@ -41,6 +42,7 @@ void UOptionsUIWidget::NativeConstruct()
|
||||||
}
|
}
|
||||||
|
|
||||||
RefreshRateButton->OnClicked.AddUniqueDynamic(this, &UOptionsUIWidget::OnRefreshRateSelectorChanged);
|
RefreshRateButton->OnClicked.AddUniqueDynamic(this, &UOptionsUIWidget::OnRefreshRateSelectorChanged);
|
||||||
|
RefreshRateButton->OnHovered.AddUniqueDynamic(this, &UOptionsUIWidget::PlayHoveredSound);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (VsyncCheckBox)
|
if (VsyncCheckBox)
|
||||||
|
@ -65,11 +67,13 @@ void UOptionsUIWidget::NativeConstruct()
|
||||||
if (BackButton)
|
if (BackButton)
|
||||||
{
|
{
|
||||||
BackButton->OnClicked.AddUniqueDynamic(this, &UOptionsUIWidget::BackButtonOnClicked);
|
BackButton->OnClicked.AddUniqueDynamic(this, &UOptionsUIWidget::BackButtonOnClicked);
|
||||||
|
BackButton->OnHovered.AddUniqueDynamic(this, &UOptionsUIWidget::PlayHoveredSound);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ResetToDefaultsButton)
|
if (ResetToDefaultsButton)
|
||||||
{
|
{
|
||||||
ResetToDefaultsButton->OnClicked.AddUniqueDynamic(this, &UOptionsUIWidget::ResetToDefaultsButtonOnClicked);
|
ResetToDefaultsButton->OnClicked.AddUniqueDynamic(this, &UOptionsUIWidget::ResetToDefaultsButtonOnClicked);
|
||||||
|
ResetToDefaultsButton->OnHovered.AddUniqueDynamic(this, &UOptionsUIWidget::PlayHoveredSound);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (APlayerController* PlayerController = UGameplayStatics::GetPlayerController(GetWorld(), 0))
|
if (APlayerController* PlayerController = UGameplayStatics::GetPlayerController(GetWorld(), 0))
|
||||||
|
@ -156,6 +160,7 @@ void UOptionsUIWidget::OnFullscreenCheckboxChanged(bool bIsChecked)
|
||||||
}
|
}
|
||||||
|
|
||||||
GEngine->GameUserSettings->ApplySettings(true);
|
GEngine->GameUserSettings->ApplySettings(true);
|
||||||
|
this->PlayHoveredSound();
|
||||||
}
|
}
|
||||||
|
|
||||||
void UOptionsUIWidget::OnRefreshRateSelectorChanged()
|
void UOptionsUIWidget::OnRefreshRateSelectorChanged()
|
||||||
|
@ -186,10 +191,20 @@ void UOptionsUIWidget::OnVsyncCheckboxChanged(bool bIsChecked)
|
||||||
{
|
{
|
||||||
GEngine->GameUserSettings->SetVSyncEnabled(bIsChecked);
|
GEngine->GameUserSettings->SetVSyncEnabled(bIsChecked);
|
||||||
GEngine->GameUserSettings->ApplySettings(true);
|
GEngine->GameUserSettings->ApplySettings(true);
|
||||||
|
this->PlayHoveredSound();
|
||||||
}
|
}
|
||||||
|
|
||||||
void UOptionsUIWidget::OnDynamicResolutionCheckboxChanged(bool bIsChecked)
|
void UOptionsUIWidget::OnDynamicResolutionCheckboxChanged(bool bIsChecked)
|
||||||
{
|
{
|
||||||
GEngine->GameUserSettings->SetDynamicResolutionEnabled(bIsChecked);
|
GEngine->GameUserSettings->SetDynamicResolutionEnabled(bIsChecked);
|
||||||
GEngine->GameUserSettings->ApplySettings(true);
|
GEngine->GameUserSettings->ApplySettings(true);
|
||||||
|
this->PlayHoveredSound();
|
||||||
|
}
|
||||||
|
|
||||||
|
void UOptionsUIWidget::PlayHoveredSound()
|
||||||
|
{
|
||||||
|
if (ButtonHoveredSound)
|
||||||
|
{
|
||||||
|
UGameplayStatics::PlaySound2D(GetWorld(), ButtonHoveredSound);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,6 +45,9 @@ public:
|
||||||
UPROPERTY(BlueprintReadWrite, meta = (BindWidget))
|
UPROPERTY(BlueprintReadWrite, meta = (BindWidget))
|
||||||
UButton* ResetToDefaultsButton;
|
UButton* ResetToDefaultsButton;
|
||||||
|
|
||||||
|
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite)
|
||||||
|
USoundBase* ButtonHoveredSound;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
UUserWidget* PreviousScreen;
|
UUserWidget* PreviousScreen;
|
||||||
|
@ -79,4 +82,7 @@ private:
|
||||||
|
|
||||||
UFUNCTION()
|
UFUNCTION()
|
||||||
void OnDynamicResolutionCheckboxChanged(bool bIsChecked);
|
void OnDynamicResolutionCheckboxChanged(bool bIsChecked);
|
||||||
|
|
||||||
|
UFUNCTION()
|
||||||
|
void PlayHoveredSound();
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue