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