#
TypewriterLabel
A TypewriterLabel is a Label that shows its text one glyph at a time, as in the dialogue box of a game. The Dialogue example uses it.
<UIToolbox.TypewriterLabel characters-per-second="45" />
line.Finished += ShowChoices;
line.text = "Welcome, <b>traveler</b>!"; // types from the first glyph
line.Complete(); // shows all of it, for a key press during typing
| Member |
Description |
text |
A new text types from the first glyph. The same text again does not type again. |
CharactersPerSecond (characters-per-second) |
The speed in glyphs per second (40). Zero or less shows the text at once. |
IsTyping |
True while glyphs are still to appear. |
VisibleGlyphs |
The number of glyphs that show now. A space counts as a glyph, except where the line wraps; a rich text tag does not. |
Complete() |
Shows all of the text at once. |
Restart() |
Hides the text and types it again. |
Finished |
Raised once when the last glyph shows, after typing or after Complete. A text with nothing to type (an empty text or a speed of zero) also raises it, so a dialogue can wait for it on every line. |
- The label lays out the full text at once and makes the hidden glyphs transparent through
PostProcessTextVertices. The words do not jump to the next line while they appear, and rich text tags work.
- Each glyph fades in over one glyph time.
- The typing runs on the element scheduler, so it stops when the label leaves the panel.
#Styling
| Class |
Element |
tb-typewriter-label |
The label: --tb-color-text, and the text wraps. The hidden glyphs are transparent; they take no style. |
tb-typewriter-label--typing |
On the label while glyphs are still to appear. |