Class TMPEffectsTextProcessor
- Namespace
- TMPEffects.TextProcessing
Preprocesses the text, removing valid tags.
As part of a post process, also adjusts the indices of the parsed tags to
accomodate for native TextMeshPro tags.
public class TMPEffectsTextProcessor : ITextPreprocessor, ITagProcessorManager, IEnumerable<TagProcessor>, IEnumerable
- Inheritance
-
TMPEffectsTextProcessor
- Implements
Constructors
TMPEffectsTextProcessor(TMP_Text)
public TMPEffectsTextProcessor(TMP_Text text)
Parameters
text
TMP_Text
Properties
TagProcessors
Mapping of prefix to list of TagProcessor.
public ReadOnlyDictionary<char, ReadOnlyCollection<TagProcessor>> TagProcessors { get; }
Property Value
TextComponent
The associated TMP_Text component.
public TMP_Text TextComponent { get; }
Property Value
- TMP_Text
Methods
AddProcessor(char, TagProcessor, int)
Add a processor.
public void AddProcessor(char prefix, TagProcessor processor, int priority = 0)
Parameters
prefix
charPrefix of tags processed by
processor
.processor
TagProcessorThe processor.
priority
intPriority of this processor. Only one processors can process any given tag, so the order that processors are invoked in matters.
Less than zero => last processed
zero => first processed (highest priority)
Greater than zero => priority-th processed
Greater than current amount of processors => last processed
AdjustIndices()
Adjust the indices of the tags parsed in PreprocessText(string) to accomodate for any natively parsed TextMeshPro tags.
public void AdjustIndices()
GetEnumerator()
Returns an enumerator that iterates through the collection.
public IEnumerator<TagProcessor> GetEnumerator()
Returns
- IEnumerator<TagProcessor>
An enumerator that can be used to iterate through the collection.
PreprocessText(string)
Preprocess the text.
- Remove TMPEffects tags from text
- Cache the tags incl. their indices
public string PreprocessText(string text)
Parameters
text
stringThe text to preprocess.
Returns
- string
The preprocessed text.
RemoveProcessor(char, TagProcessor)
Remove a processor.
public bool RemoveProcessor(char prefix, TagProcessor processor)
Parameters
prefix
charPrefix of tags processed by
processor
.processor
TagProcessorThe processor.
Returns
- bool
true if the processors was removed; otherwise false.
Events
BeginAdjustIndices
Raised just before the AdjustIndices routine begins.
public event TMPEffectsTextProcessor.TMPTextProcessorEventHandler BeginAdjustIndices
Event Type
BeginPreProcess
Raised just before the PreProcess routine begins.
public event TMPEffectsTextProcessor.TMPTextProcessorEventHandler BeginPreProcess
Event Type
FinishAdjustIndices
Raised once the AdjustIndices routine finished.
public event TMPEffectsTextProcessor.TMPTextProcessorEventHandler FinishAdjustIndices
Event Type
FinishPreProcess
Raised once the PreProcess routine finished.
public event TMPEffectsTextProcessor.TMPTextProcessorEventHandler FinishPreProcess