diff --git a/Content/UI/Options/OptionsMenu.uasset b/Content/UI/Options/OptionsMenu.uasset index 2d0605f..e0fccb3 100644 --- a/Content/UI/Options/OptionsMenu.uasset +++ b/Content/UI/Options/OptionsMenu.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:65261cbbd0cc594f48a7319f3dd328392eec5fc7be90a0fb60166ddcc4e5a685 -size 57948 +oid sha256:96cea5c0cf0ee7d5d1fc7641ca49bd2581a99d9149d1fdfbb46be68149c5f45a +size 58150 diff --git a/Source/Nakatomi/OptionsUIWidget.cpp b/Source/Nakatomi/OptionsUIWidget.cpp index c0e84ca..87f8301 100644 --- a/Source/Nakatomi/OptionsUIWidget.cpp +++ b/Source/Nakatomi/OptionsUIWidget.cpp @@ -21,6 +21,7 @@ void UOptionsUIWidget::NativeConstruct() } ResolutionButton->OnClicked.AddUniqueDynamic(this, &UOptionsUIWidget::OnResolutionSelectorChanged); + ResolutionButton->OnHovered.AddUniqueDynamic(this, &UOptionsUIWidget::PlayHoveredSound); } if (FullscreenCheckBox) @@ -41,6 +42,7 @@ void UOptionsUIWidget::NativeConstruct() } RefreshRateButton->OnClicked.AddUniqueDynamic(this, &UOptionsUIWidget::OnRefreshRateSelectorChanged); + RefreshRateButton->OnHovered.AddUniqueDynamic(this, &UOptionsUIWidget::PlayHoveredSound); } if (VsyncCheckBox) @@ -65,11 +67,13 @@ void UOptionsUIWidget::NativeConstruct() if (BackButton) { BackButton->OnClicked.AddUniqueDynamic(this, &UOptionsUIWidget::BackButtonOnClicked); + BackButton->OnHovered.AddUniqueDynamic(this, &UOptionsUIWidget::PlayHoveredSound); } if (ResetToDefaultsButton) { ResetToDefaultsButton->OnClicked.AddUniqueDynamic(this, &UOptionsUIWidget::ResetToDefaultsButtonOnClicked); + ResetToDefaultsButton->OnHovered.AddUniqueDynamic(this, &UOptionsUIWidget::PlayHoveredSound); } if (APlayerController* PlayerController = UGameplayStatics::GetPlayerController(GetWorld(), 0)) @@ -156,6 +160,7 @@ void UOptionsUIWidget::OnFullscreenCheckboxChanged(bool bIsChecked) } GEngine->GameUserSettings->ApplySettings(true); + this->PlayHoveredSound(); } void UOptionsUIWidget::OnRefreshRateSelectorChanged() @@ -186,10 +191,20 @@ void UOptionsUIWidget::OnVsyncCheckboxChanged(bool bIsChecked) { GEngine->GameUserSettings->SetVSyncEnabled(bIsChecked); GEngine->GameUserSettings->ApplySettings(true); + this->PlayHoveredSound(); } void UOptionsUIWidget::OnDynamicResolutionCheckboxChanged(bool bIsChecked) { GEngine->GameUserSettings->SetDynamicResolutionEnabled(bIsChecked); GEngine->GameUserSettings->ApplySettings(true); + this->PlayHoveredSound(); +} + +void UOptionsUIWidget::PlayHoveredSound() +{ + if (ButtonHoveredSound) + { + UGameplayStatics::PlaySound2D(GetWorld(), ButtonHoveredSound); + } } diff --git a/Source/Nakatomi/OptionsUIWidget.h b/Source/Nakatomi/OptionsUIWidget.h index b5fb964..f1f09d1 100644 --- a/Source/Nakatomi/OptionsUIWidget.h +++ b/Source/Nakatomi/OptionsUIWidget.h @@ -45,6 +45,9 @@ public: UPROPERTY(BlueprintReadWrite, meta = (BindWidget)) UButton* ResetToDefaultsButton; + UPROPERTY(EditDefaultsOnly, BlueprintReadWrite) + USoundBase* ButtonHoveredSound; + private: UUserWidget* PreviousScreen; @@ -79,4 +82,7 @@ private: UFUNCTION() void OnDynamicResolutionCheckboxChanged(bool bIsChecked); + + UFUNCTION() + void PlayHoveredSound(); };