From 3052c61e6cdd68d98c516c51428dd3044e999cc8 Mon Sep 17 00:00:00 2001 From: Thibaut Spreux Date: Wed, 19 Feb 2025 15:30:52 +0100 Subject: [PATCH] add blueprint events --- .../Private/UI/Widgets/GBFCommonTextTyper.cpp | 2 ++ .../Public/UI/Widgets/GBFCommonTextTyper.h | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/Source/GameBaseFramework/Private/UI/Widgets/GBFCommonTextTyper.cpp b/Source/GameBaseFramework/Private/UI/Widgets/GBFCommonTextTyper.cpp index 4433771e..79ebb639 100644 --- a/Source/GameBaseFramework/Private/UI/Widgets/GBFCommonTextTyper.cpp +++ b/Source/GameBaseFramework/Private/UI/Widgets/GBFCommonTextTyper.cpp @@ -22,6 +22,7 @@ void UGBFCommonTextTyper::CompleteTextWritingInstantly() { AnimatedTextBlock->SetText( EntireText ); bIsFullyDisplayed = true; + OnCompleteTextWriting(); } void UGBFCommonTextTyper::NativeTick( const FGeometry & my_geometry, float delta_time ) @@ -51,6 +52,7 @@ void UGBFCommonTextTyper::NativeTick( const FGeometry & my_geometry, float delta AnimatedTextBlock->SetText( FText::FromString( visible_text ) ); CurrentCharIndex++; ElapsedTimeSinceLastCharWritten = 0.0f; + OnTextWriting(); } else { diff --git a/Source/GameBaseFramework/Public/UI/Widgets/GBFCommonTextTyper.h b/Source/GameBaseFramework/Public/UI/Widgets/GBFCommonTextTyper.h index 296c86a4..861eeb1b 100644 --- a/Source/GameBaseFramework/Public/UI/Widgets/GBFCommonTextTyper.h +++ b/Source/GameBaseFramework/Public/UI/Widgets/GBFCommonTextTyper.h @@ -24,6 +24,12 @@ class GAMEBASEFRAMEWORK_API UGBFCommonTextTyper final : public UUserWidget UFUNCTION( BlueprintCallable, BlueprintPure = false, meta = ( ExpandBoolAsExecs = "ReturnValue" ) ) bool IsTextFullyDisplayed() const; + UFUNCTION( BlueprintImplementableEvent ) + void OnTextWriting(); + + UFUNCTION( BlueprintImplementableEvent ) + void OnCompleteTextWriting(); + virtual void NativeTick( const FGeometry & my_geometry, float delta_time ) override; private: