mirror of
https://github.com/sinbad/StevesUEHelpers.git
synced 2025-02-23 17:45:23 +00:00
Add event for when the run name changes
This commit is contained in:
parent
068810dc61
commit
9aad397561
@ -147,12 +147,19 @@ void UTypewriterTextWidget::PlayNextLetter()
|
||||
return;
|
||||
}
|
||||
|
||||
FString WrappedString = CalculateSegments(&CurrentRunName);
|
||||
FString NewRunName;
|
||||
const FString WrappedString = CalculateSegments(&NewRunName);
|
||||
if (IsValid(LineText))
|
||||
{
|
||||
LineText->SetText(FText::FromString(WrappedString));
|
||||
}
|
||||
|
||||
if (NewRunName != CurrentRunName)
|
||||
{
|
||||
CurrentRunName = NewRunName;
|
||||
OnTypewriterRunNameChanged.Broadcast(this, NewRunName);
|
||||
}
|
||||
|
||||
// TODO: How do we keep indexing of text i18n-friendly?
|
||||
if (CurrentLetterIndex < MaxLetterIndex)
|
||||
{
|
||||
|
@ -18,6 +18,7 @@
|
||||
|
||||
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnTypewriterLineFinished, class UTypewriterTextWidget*, Widget);
|
||||
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnTypewriterLetterAdded, class UTypewriterTextWidget*, Widget);
|
||||
DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnTypewriterRunNameChanged, class UTypewriterTextWidget*, Widget, const FString&, NewRunName);
|
||||
/**
|
||||
* A text block that exposes more information about text layout for typewriter widget.
|
||||
*/
|
||||
@ -62,6 +63,9 @@ public:
|
||||
/// Event called when one or more new letters have been displayed
|
||||
UPROPERTY(BlueprintAssignable)
|
||||
FOnTypewriterLetterAdded OnTypewriterLetterAdded;
|
||||
|
||||
/// Event called when the "run name" of the text changes aka the rich text style markup. Also called when reverts to default.
|
||||
FOnTypewriterRunNameChanged OnTypewriterRunNameChanged;
|
||||
|
||||
UPROPERTY(BlueprintReadOnly, meta = (BindWidget))
|
||||
URichTextBlockForTypewriter* LineText;
|
||||
|
Loading…
x
Reference in New Issue
Block a user