VisualU 1.2.1
Plugin for Unreal Engine 5 that brings core functionality for a widget-based visual novel game
 
Loading...
Searching...
No Matches
UVisualTextBlock Class Reference

A text block that exposes more information about text layout. More...

#include <VisualTextBlock.h>

Inheritance diagram for UVisualTextBlock:

Public Member Functions

 UVisualTextBlock (const FObjectInitializer &ObjectInitializer=FObjectInitializer::Get())
 
void Typewrite ()
 Applies typewriter effect to the current text of the text block.
 
void Pause ()
 Pauses active typewriter effect.
 
void Resume ()
 Resumes active typewriter effect.
 
FORCEINLINE bool HasTypewriterFinished () const
 
void ForceTypewriteToEnd ()
 Unconditionally stops typewriter effect.
 

Public Attributes

float LetterPlayTime
 The amount of time, in seconds, between printing individual letters.
 
float EndHoldTime
 The amount of time, in seconds, to wait after finishing the line before actually marking it completed.
 

Protected Member Functions

void OnPlayLetter ()
 Called when individual letter is typed by typewriter.
 
void OnTypewriterFinished ()
 Called when typewriter effect is finished.
 
virtual TSharedRef< SWidget > RebuildWidget () override
 

Private Member Functions

void PlayNextLetter ()
 Displays next letter during typewriter effect.
 
void CalculateWrappedString ()
 Wraps in advance UVisualTextBlock::CurrentLine before it is typed.
 
FString CalculateSegments ()
 

Private Attributes

TSharedPtr< FSlateTextLayout > TextLayout
 Text layout of this text block.
 
TSharedPtr< FRichTextLayoutMarshaller > TextMarshaller
 Text marshaller for the text layout.
 
FText CurrentLine
 Currently typed text.
 
TArray< FDialogueTextSegmentSegments
 Processed dialog text segments.
 
FString CachedSegmentText
 The section of the text that's already been printed out and won't ever change.
 
int32 CachedLetterIndex
 Index of last letter that already been printed out and won't ever change.
 
int32 CurrentSegmentIndex
 Current position of a segment.
 
int32 CurrentLetterIndex
 Current position of a letter.
 
int32 MaxLetterIndex
 Most reachable position for a letter.
 
uint32 bHasFinishedPlaying: 1
 State of the typewriter effect.
 
FTimerHandle LetterTimer
 Timer used to play letters as in typewriter.
 

Detailed Description

A text block that exposes more information about text layout.

Supports break tag that pauses typewriter when it is encountered in text.

See also
FBreakVisualTextBlockDecorator

Member Function Documentation

◆ CalculateSegments()

FString UVisualTextBlock::CalculateSegments ( )
private
Returns
parsed dialogue segments as string

◆ HasTypewriterFinished()

FORCEINLINE bool UVisualTextBlock::HasTypewriterFinished ( ) const
inline
Returns
true for stopped typewriter
See also
UVisualTextBlock::bHasFinishedPlaying

◆ OnTypewriterFinished()

void UVisualTextBlock::OnTypewriterFinished ( )
protected

Called when typewriter effect is finished.

Note
pausing typewriter will not trigger this event

◆ Pause()

void UVisualTextBlock::Pause ( )

Pauses active typewriter effect.

Note
not threadsafe, has no effect for inactive timer.

◆ RebuildWidget()

TSharedRef< SWidget > UVisualTextBlock::RebuildWidget ( )
overrideprotectedvirtual
Returns
underlying slate widget

◆ Resume()

void UVisualTextBlock::Resume ( )

Resumes active typewriter effect.

Note
not threadsafe, has no effect for active timer.

Member Data Documentation

◆ CachedSegmentText

FString UVisualTextBlock::CachedSegmentText
private

The section of the text that's already been printed out and won't ever change.

This lets us cache some of the work we've already done. We can't cache absolutely everything as the last few characters of a string may change if they're related to a named run that hasn't been completed yet.

◆ EndHoldTime

float UVisualTextBlock::EndHoldTime

The amount of time, in seconds, to wait after finishing the line before actually marking it completed.

This helps prevent accidentally progressing dialogue on short lines.

◆ LetterPlayTime

float UVisualTextBlock::LetterPlayTime

The amount of time, in seconds, between printing individual letters.

during for the typewriter effect. Zero means no typewriter effect.


The documentation for this class was generated from the following files: