Skip to content

Back handler sound #361

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Mar 12, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
#include "UI/Widgets/GBFActivatableWidget.h"

#include "GameBaseFrameworkGameSettings.h"

#include <Sound/SoundBase.h>

#if WITH_EDITOR
#include <Editor/WidgetCompilerLog.h>
#endif
Expand Down Expand Up @@ -30,6 +34,13 @@ TOptional< FUIInputConfig > UGBFActivatableWidget::GetDesiredInputConfig() const
}
}

bool UGBFActivatableWidget::NativeOnHandleBackAction()
{
const auto sound = GetDefault< UGameBaseFrameworkGameSettings >()->BackHandlerSound.LoadSynchronous();
PlaySound( sound );
return Super::NativeOnHandleBackAction();
}

#if WITH_EDITOR
void UGBFActivatableWidget::ValidateCompiledWidgetTree( const UWidgetTree & blueprint_widget_tree, IWidgetCompilerLog & compile_log ) const
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

#include "GameBaseFrameworkGameSettings.generated.h"

class USoundCue;
class UGBFSaveGame;

UCLASS( config = Game, MinimalAPI, meta = ( DisplayName = "GameBaseFramework - Settings" ) )
Expand All @@ -28,4 +29,7 @@ class UGameBaseFrameworkGameSettings final : public UDeveloperSettingsBackedByCV

UPROPERTY( EditDefaultsOnly, config, Category = "SaveGame" )
FString SaveGameSlotName;

UPROPERTY( BlueprintReadOnly, EditDefaultsOnly, config, Category = "Sounds" )
TSoftObjectPtr< USoundBase > BackHandlerSound;
};
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ class GAMEBASEFRAMEWORK_API UGBFActivatableWidget : public UCommonActivatableWid

public:
TOptional< FUIInputConfig > GetDesiredInputConfig() const override;
bool NativeOnHandleBackAction() override;

#if WITH_EDITOR
void ValidateCompiledWidgetTree( const UWidgetTree & blueprint_widget_tree, class IWidgetCompilerLog & compile_log ) const override;
Expand Down