mirror of
https://github.com/sinbad/StevesUEHelpers.git
synced 2025-02-23 09:35:25 +00:00
Implemented line chopping
This commit is contained in:
parent
f0bd405cb2
commit
7aac7d9d75
@ -42,7 +42,6 @@ TSharedRef<SWidget> URichTextBlockForTypewriter::RebuildWidget()
|
||||
UTypewriterTextWidget::UTypewriterTextWidget(const FObjectInitializer& ObjectInitializer)
|
||||
: Super(ObjectInitializer)
|
||||
{
|
||||
bHasMoreLineParts = false;
|
||||
bHasFinishedPlaying = true;
|
||||
}
|
||||
|
||||
@ -55,7 +54,6 @@ void UTypewriterTextWidget::SetText(const FText& InText)
|
||||
|
||||
LineText->SetText(InText);
|
||||
|
||||
bHasMoreLineParts = false;
|
||||
bHasFinishedPlaying = true;
|
||||
}
|
||||
}
|
||||
@ -102,7 +100,6 @@ void UTypewriterTextWidget::PlayNextLinePart(float Speed)
|
||||
LineText->SetText(FText::GetEmpty());
|
||||
}
|
||||
|
||||
bHasMoreLineParts = false;
|
||||
bHasFinishedPlaying = true;
|
||||
OnTypewriterLineFinished.Broadcast(this);
|
||||
OnLineFinishedPlaying();
|
||||
@ -165,7 +162,7 @@ void UTypewriterTextWidget::PlayNextLinePart(float Speed)
|
||||
|
||||
CalculateWrappedString(shortenedString);
|
||||
|
||||
RemainingLinePart.RightInline(count);
|
||||
RemainingLinePart.RightChopInline(count);
|
||||
bHasMoreLineParts = true;
|
||||
}
|
||||
}
|
||||
@ -190,16 +187,9 @@ void UTypewriterTextWidget::SkipToLineEnd()
|
||||
LineText->SetText(FText::FromString(CalculateSegments(nullptr)));
|
||||
}
|
||||
|
||||
if (bHasMoreLineParts)
|
||||
{
|
||||
OnTypewriterLinePartFinished.Broadcast(this);
|
||||
}
|
||||
else
|
||||
{
|
||||
bHasFinishedPlaying = true;
|
||||
OnTypewriterLineFinished.Broadcast(this);
|
||||
OnLineFinishedPlaying();
|
||||
}
|
||||
bHasFinishedPlaying = true;
|
||||
OnTypewriterLineFinished.Broadcast(this);
|
||||
OnLineFinishedPlaying();
|
||||
}
|
||||
|
||||
void UTypewriterTextWidget::PlayNextLetter()
|
||||
|
@ -56,10 +56,6 @@ class STEVESUEHELPERS_API UTypewriterTextWidget : public UUserWidget
|
||||
public:
|
||||
UTypewriterTextWidget(const FObjectInitializer& ObjectInitializer);
|
||||
|
||||
/// Event called when a line part has finished playing, whether on its own or when skipped to end
|
||||
UPROPERTY(BlueprintAssignable)
|
||||
FOnTypewriterLineFinished OnTypewriterLinePartFinished;
|
||||
|
||||
/// Event called when a line has finished playing, whether on its own or when skipped to end
|
||||
UPROPERTY(BlueprintAssignable)
|
||||
FOnTypewriterLineFinished OnTypewriterLineFinished;
|
||||
@ -106,6 +102,9 @@ public:
|
||||
UFUNCTION(BlueprintCallable, Category = "Typewriter")
|
||||
bool HasFinishedPlayingLine() const { return bHasFinishedPlaying; }
|
||||
|
||||
UFUNCTION(BlueprintCallable, Category = "Typewriter")
|
||||
bool HasMoreLineParts() const { return bHasMoreLineParts; }
|
||||
|
||||
UFUNCTION(BlueprintCallable, Category = "Typewriter")
|
||||
void PlayNextLinePart(float Speed = 1.0f);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user