From cf41b2e45611dcb62998041b58ee23327fc8a555 Mon Sep 17 00:00:00 2001 From: baz Date: Thu, 4 Apr 2024 01:36:02 +0100 Subject: [PATCH] Update OptionsMenu widget delegates --- Content/UI/Options/OptionsMenu.uasset | 4 ++-- Source/Nakatomi/OptionsUIWidget.cpp | 24 +++++++++++++++++++++ Source/Nakatomi/OptionsUIWidget.h | 30 +++++++++++++++++++++++++++ 3 files changed, 56 insertions(+), 2 deletions(-) diff --git a/Content/UI/Options/OptionsMenu.uasset b/Content/UI/Options/OptionsMenu.uasset index e0fccb3..e5861c6 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:96cea5c0cf0ee7d5d1fc7641ca49bd2581a99d9149d1fdfbb46be68149c5f45a -size 58150 +oid sha256:22b816febbff423b6b257fd0f57693ba219bb2bcf4a0bc0f7b02f70b3ed826d3 +size 62976 diff --git a/Source/Nakatomi/OptionsUIWidget.cpp b/Source/Nakatomi/OptionsUIWidget.cpp index 27db8d8..ba99401 100644 --- a/Source/Nakatomi/OptionsUIWidget.cpp +++ b/Source/Nakatomi/OptionsUIWidget.cpp @@ -21,7 +21,13 @@ void UOptionsUIWidget::NativeConstruct() } ResolutionButton->OnClicked.AddUniqueDynamic(this, &UOptionsUIWidget::OnResolutionSelectorChanged); + ResolutionButton->OnClicked.AddUniqueDynamic(this, &UOptionsUIWidget::PlayClickedSound); + ResolutionButton->OnHovered.AddUniqueDynamic(this, &UOptionsUIWidget::PlayHoveredSound); + ResolutionButton->OnHovered.AddUniqueDynamic(this, &UOptionsUIWidget::ResolutionTextBlockHoveredDelegate); + + ResolutionButton->OnUnhovered.AddUniqueDynamic(this, &UOptionsUIWidget::PlayUnhoveredSound); + ResolutionButton->OnUnhovered.AddUniqueDynamic(this, &UOptionsUIWidget::ResolutionTextBlockUnhoveredDelegate); } if (FullscreenCheckBox) @@ -42,7 +48,13 @@ void UOptionsUIWidget::NativeConstruct() } RefreshRateButton->OnClicked.AddUniqueDynamic(this, &UOptionsUIWidget::OnRefreshRateSelectorChanged); + RefreshRateButton->OnClicked.AddUniqueDynamic(this, &UOptionsUIWidget::PlayClickedSound); + RefreshRateButton->OnHovered.AddUniqueDynamic(this, &UOptionsUIWidget::PlayHoveredSound); + RefreshRateButton->OnHovered.AddUniqueDynamic(this, &UOptionsUIWidget::RefreshRateTextBlockHoveredDelegate); + + RefreshRateButton->OnUnhovered.AddUniqueDynamic(this, &UOptionsUIWidget::PlayUnhoveredSound); + RefreshRateButton->OnUnhovered.AddUniqueDynamic(this, &UOptionsUIWidget::RefreshRateTextBlockUnhoveredDelegate); } if (VsyncCheckBox) @@ -67,13 +79,25 @@ void UOptionsUIWidget::NativeConstruct() if (BackButton) { BackButton->OnClicked.AddUniqueDynamic(this, &UOptionsUIWidget::BackButtonOnClicked); + BackButton->OnClicked.AddUniqueDynamic(this, &UOptionsUIWidget::PlayClickedSound); + BackButton->OnHovered.AddUniqueDynamic(this, &UOptionsUIWidget::PlayHoveredSound); + BackButton->OnHovered.AddUniqueDynamic(this, &UOptionsUIWidget::BackTextBlockHoveredDelegate); + + BackButton->OnUnhovered.AddUniqueDynamic(this, &UOptionsUIWidget::PlayUnhoveredSound); + BackButton->OnUnhovered.AddUniqueDynamic(this, &UOptionsUIWidget::BackTextBlockUnhoveredDelegate); } if (ResetToDefaultsButton) { ResetToDefaultsButton->OnClicked.AddUniqueDynamic(this, &UOptionsUIWidget::ResetToDefaultsButtonOnClicked); + BackButton->OnClicked.AddUniqueDynamic(this, &UOptionsUIWidget::PlayClickedSound); + ResetToDefaultsButton->OnHovered.AddUniqueDynamic(this, &UOptionsUIWidget::PlayHoveredSound); + ResetToDefaultsButton->OnHovered.AddUniqueDynamic(this, &UOptionsUIWidget::ResetToDefaultsTextBlockHoveredDelegate); + + ResetToDefaultsButton->OnUnhovered.AddUniqueDynamic(this, &UOptionsUIWidget::PlayUnhoveredSound); + ResetToDefaultsButton->OnUnhovered.AddUniqueDynamic(this, &UOptionsUIWidget::ResetToDefaultsTextBlockUnhoveredDelegate); } if (APlayerController* PlayerController = UGameplayStatics::GetPlayerController(GetWorld(), 0)) diff --git a/Source/Nakatomi/OptionsUIWidget.h b/Source/Nakatomi/OptionsUIWidget.h index 751a187..8453436 100644 --- a/Source/Nakatomi/OptionsUIWidget.h +++ b/Source/Nakatomi/OptionsUIWidget.h @@ -42,10 +42,16 @@ public: UPROPERTY(BlueprintReadWrite, meta = (BindWidget)) UButton* BackButton; + + UPROPERTY(BlueprintReadWrite, meta = (BindWidget)) + UTextBlock* BackTextBlock; UPROPERTY(BlueprintReadWrite, meta = (BindWidget)) UButton* ResetToDefaultsButton; + UPROPERTY(BlueprintReadWrite, meta = (BindWidget)) + UTextBlock* ResetToDefaultsTextBlock; + private: UUserWidget* PreviousScreen; @@ -80,4 +86,28 @@ private: UFUNCTION() void OnDynamicResolutionCheckboxChanged(bool bIsChecked); + + UFUNCTION() + void ResolutionTextBlockHoveredDelegate() { SetTextBlockHovered(ResolutionTextBlock); } + + UFUNCTION() + void ResolutionTextBlockUnhoveredDelegate() { SetTextBlockUnhovered(ResolutionTextBlock); } + + UFUNCTION() + void RefreshRateTextBlockHoveredDelegate() { SetTextBlockHovered(RefreshRateTextBlock); } + + UFUNCTION() + void RefreshRateTextBlockUnhoveredDelegate() { SetTextBlockUnhovered(RefreshRateTextBlock); } + + UFUNCTION() + void BackTextBlockHoveredDelegate() { SetTextBlockHovered(BackTextBlock); } + + UFUNCTION() + void BackTextBlockUnhoveredDelegate() { SetTextBlockUnhovered(BackTextBlock); } + + UFUNCTION() + void ResetToDefaultsTextBlockHoveredDelegate() { SetTextBlockHovered(ResetToDefaultsTextBlock); } + + UFUNCTION() + void ResetToDefaultsTextBlockUnhoveredDelegate() { SetTextBlockUnhovered(ResetToDefaultsTextBlock); } };