v3.9.1 Documentation
Fungus.Writer Class Reference

Writes text using a typewriter effect to a UI text object. More...

Inheritance diagram for Fungus.Writer:
Fungus.IDialogInputListener

Public Member Functions

virtual void Stop ()
 Stop writing text. More...
 
virtual IEnumerator Write (string content, bool clear, bool waitForInput, bool stopAudio, bool waitForVO, AudioClip audioClip, Action onComplete)
 Writes text using a typewriter effect to a UI text object. More...
 
virtual void SetTextColor (Color textColor)
 Sets the color property of the text UI object. More...
 
virtual void SetTextAlpha (float textAlpha)
 Sets the alpha component of the color property of the text UI object. More...
 
virtual bool HasTextObject ()
 Returns true if there is a supported text object attached to this writer. More...
 
virtual bool SupportsRichText ()
 Returns true if the text object has rich text support. More...
 
virtual void OnNextLineEvent ()
 

Protected Member Functions

virtual void Awake ()
 
virtual void CacheHiddenColorStrings ()
 
virtual void Start ()
 
virtual void UpdateOpenMarkup ()
 
virtual void UpdateCloseMarkup ()
 
virtual bool CheckParamCount (List< string > paramList, int count)
 
virtual bool TryGetSingleParam (List< string > paramList, int index, float defaultValue, out float value)
 
virtual IEnumerator ProcessTokens (List< TextTagToken > tokens, bool stopAudio, Action onComplete)
 
virtual IEnumerator DoWords (List< string > paramList, TokenType previousTokenType)
 
virtual void PartitionString (bool wholeWords, string inputString, int i)
 
virtual void ConcatenateString (string startText)
 
virtual IEnumerator DoWait (List< string > paramList)
 
virtual IEnumerator DoWaitVO ()
 
virtual IEnumerator DoWait (float duration)
 
virtual IEnumerator DoWaitForInput (bool clear)
 
virtual bool IsPunctuation (char character)
 
virtual void Punch (Vector3 axis, float time)
 
virtual void Flash (float duration)
 
virtual AudioSource FindAudio (string audioObjectName)
 
virtual void NotifyInput ()
 
virtual void NotifyStart (AudioClip audioClip)
 
virtual void NotifyPause ()
 
virtual void NotifyResume ()
 
virtual void NotifyEnd (bool stopAudio)
 
virtual void NotifyGlyph ()
 

Protected Attributes

GameObject targetTextObject
 
GameObject punchObject
 
float writingSpeed = 60
 
float punctuationPause = 0.25f
 
Color hiddenTextColor = new Color(1,1,1,0)
 
bool writeWholeWords = false
 
bool forceRichText = true
 
bool instantComplete = true
 
bool isWaitingForInput
 
bool isWriting
 
float currentWritingSpeed
 
float currentPunctuationPause
 
Text textUI
 
InputField inputField
 
TextMesh textMesh
 
Component textComponent
 
PropertyInfo textProperty
 
bool boldActive = false
 
bool italicActive = false
 
bool colorActive = false
 
string colorText = ""
 
bool sizeActive = false
 
float sizeValue = 16f
 
bool inputFlag
 
bool exitFlag
 
List< IWriterListenerwriterListeners = new List<IWriterListener>()
 
StringBuilder openString = new StringBuilder(256)
 
StringBuilder closeString = new StringBuilder(256)
 
StringBuilder leftString = new StringBuilder(1024)
 
StringBuilder rightString = new StringBuilder(1024)
 
StringBuilder outputString = new StringBuilder(1024)
 
StringBuilder readAheadString = new StringBuilder(1024)
 
string hiddenColorOpen = ""
 
string hiddenColorClose = ""
 
int visibleCharacterCount = 0
 

Properties

WriterAudio AttachedWriterAudio [get, set]
 
virtual string Text [get, set]
 Gets or sets the text property of the attached text object. More...
 
virtual bool IsWriting [get]
 This property is true when the writer is writing text or waiting (i.e. More...
 
virtual bool IsWaitingForInput [get]
 This property is true when the writer is waiting for user input to continue. More...
 
virtual bool Paused [get, set]
 Pauses the writer. More...
 

Detailed Description

Writes text using a typewriter effect to a UI text object.

Definition at line 34 of file Writer.cs.

Member Function Documentation

◆ Awake()

virtual void Fungus.Writer.Awake ( )
protectedvirtual

Definition at line 98 of file Writer.cs.

◆ CacheHiddenColorStrings()

virtual void Fungus.Writer.CacheHiddenColorStrings ( )
protectedvirtual

Definition at line 141 of file Writer.cs.

◆ CheckParamCount()

virtual bool Fungus.Writer.CheckParamCount ( List< string >  paramList,
int  count 
)
protectedvirtual

Definition at line 221 of file Writer.cs.

◆ ConcatenateString()

virtual void Fungus.Writer.ConcatenateString ( string  startText)
protectedvirtual

Definition at line 614 of file Writer.cs.

◆ DoWait() [1/2]

virtual IEnumerator Fungus.Writer.DoWait ( List< string >  paramList)
protectedvirtual

Definition at line 645 of file Writer.cs.

◆ DoWait() [2/2]

virtual IEnumerator Fungus.Writer.DoWait ( float  duration)
protectedvirtual

Definition at line 674 of file Writer.cs.

◆ DoWaitForInput()

virtual IEnumerator Fungus.Writer.DoWaitForInput ( bool  clear)
protectedvirtual

Definition at line 693 of file Writer.cs.

◆ DoWaitVO()

virtual IEnumerator Fungus.Writer.DoWaitVO ( )
protectedvirtual

Definition at line 662 of file Writer.cs.

◆ DoWords()

virtual IEnumerator Fungus.Writer.DoWords ( List< string >  paramList,
TokenType  previousTokenType 
)
protectedvirtual

Definition at line 502 of file Writer.cs.

◆ FindAudio()

virtual AudioSource Fungus.Writer.FindAudio ( string  audioObjectName)
protectedvirtual

Definition at line 752 of file Writer.cs.

◆ Flash()

virtual void Fungus.Writer.Flash ( float  duration)
protectedvirtual

Definition at line 741 of file Writer.cs.

◆ HasTextObject()

virtual bool Fungus.Writer.HasTextObject ( )
virtual

Returns true if there is a supported text object attached to this writer.

Definition at line 1004 of file Writer.cs.

◆ IsPunctuation()

virtual bool Fungus.Writer.IsPunctuation ( char  character)
protectedvirtual

Definition at line 716 of file Writer.cs.

◆ NotifyEnd()

virtual void Fungus.Writer.NotifyEnd ( bool  stopAudio)
protectedvirtual

Definition at line 807 of file Writer.cs.

◆ NotifyGlyph()

virtual void Fungus.Writer.NotifyGlyph ( )
protectedvirtual

Definition at line 818 of file Writer.cs.

◆ NotifyInput()

virtual void Fungus.Writer.NotifyInput ( )
protectedvirtual

Definition at line 763 of file Writer.cs.

◆ NotifyPause()

virtual void Fungus.Writer.NotifyPause ( )
protectedvirtual

Definition at line 785 of file Writer.cs.

◆ NotifyResume()

virtual void Fungus.Writer.NotifyResume ( )
protectedvirtual

Definition at line 796 of file Writer.cs.

◆ NotifyStart()

virtual void Fungus.Writer.NotifyStart ( AudioClip  audioClip)
protectedvirtual

Definition at line 774 of file Writer.cs.

◆ OnNextLineEvent()

virtual void Fungus.Writer.OnNextLineEvent ( )
virtual

Implements Fungus.IDialogInputListener.

Definition at line 1033 of file Writer.cs.

◆ PartitionString()

virtual void Fungus.Writer.PartitionString ( bool  wholeWords,
string  inputString,
int  i 
)
protectedvirtual

Definition at line 580 of file Writer.cs.

◆ ProcessTokens()

virtual IEnumerator Fungus.Writer.ProcessTokens ( List< TextTagToken tokens,
bool  stopAudio,
Action  onComplete 
)
protectedvirtual

Definition at line 247 of file Writer.cs.

◆ Punch()

virtual void Fungus.Writer.Punch ( Vector3  axis,
float  time 
)
protectedvirtual

Definition at line 727 of file Writer.cs.

◆ SetTextAlpha()

virtual void Fungus.Writer.SetTextAlpha ( float  textAlpha)
virtual

Sets the alpha component of the color property of the text UI object.

Definition at line 976 of file Writer.cs.

◆ SetTextColor()

virtual void Fungus.Writer.SetTextColor ( Color  textColor)
virtual

Sets the color property of the text UI object.

Definition at line 954 of file Writer.cs.

◆ Start()

virtual void Fungus.Writer.Start ( )
protectedvirtual

Definition at line 149 of file Writer.cs.

◆ Stop()

virtual void Fungus.Writer.Stop ( )
virtual

Stop writing text.

Definition at line 897 of file Writer.cs.

◆ SupportsRichText()

virtual bool Fungus.Writer.SupportsRichText ( )
virtual

Returns true if the text object has rich text support.

Definition at line 1012 of file Writer.cs.

◆ TryGetSingleParam()

virtual bool Fungus.Writer.TryGetSingleParam ( List< string >  paramList,
int  index,
float  defaultValue,
out float  value 
)
protectedvirtual

Definition at line 236 of file Writer.cs.

◆ UpdateCloseMarkup()

virtual void Fungus.Writer.UpdateCloseMarkup ( )
protectedvirtual

Definition at line 196 of file Writer.cs.

◆ UpdateOpenMarkup()

virtual void Fungus.Writer.UpdateOpenMarkup ( )
protectedvirtual

Definition at line 167 of file Writer.cs.

◆ Write()

virtual IEnumerator Fungus.Writer.Write ( string  content,
bool  clear,
bool  waitForInput,
bool  stopAudio,
bool  waitForVO,
AudioClip  audioClip,
Action  onComplete 
)
virtual

Writes text using a typewriter effect to a UI text object.

Parameters
contentText to be written
clearIf true clears the previous text.
waitForInputWrites the text and then waits for player input before calling onComplete.
stopAudioStops any currently playing audioclip.
waitForVOWait for the Voice over to complete before proceeding
audioClipAudio clip to play when text starts writing.
onCompleteCallback to call when writing is finished.

Definition at line 915 of file Writer.cs.

Member Data Documentation

◆ boldActive

bool Fungus.Writer.boldActive = false
protected

Definition at line 74 of file Writer.cs.

◆ closeString

StringBuilder Fungus.Writer.closeString = new StringBuilder(256)
protected

Definition at line 86 of file Writer.cs.

◆ colorActive

bool Fungus.Writer.colorActive = false
protected

Definition at line 76 of file Writer.cs.

◆ colorText

string Fungus.Writer.colorText = ""
protected

Definition at line 77 of file Writer.cs.

◆ currentPunctuationPause

float Fungus.Writer.currentPunctuationPause
protected

Definition at line 67 of file Writer.cs.

◆ currentWritingSpeed

float Fungus.Writer.currentWritingSpeed
protected

Definition at line 66 of file Writer.cs.

◆ exitFlag

bool Fungus.Writer.exitFlag
protected

Definition at line 81 of file Writer.cs.

◆ forceRichText

bool Fungus.Writer.forceRichText = true
protected

Definition at line 55 of file Writer.cs.

◆ hiddenColorClose

string Fungus.Writer.hiddenColorClose = ""
protected

Definition at line 93 of file Writer.cs.

◆ hiddenColorOpen

string Fungus.Writer.hiddenColorOpen = ""
protected

Definition at line 92 of file Writer.cs.

◆ hiddenTextColor

Color Fungus.Writer.hiddenTextColor = new Color(1,1,1,0)
protected

Definition at line 49 of file Writer.cs.

◆ inputField

InputField Fungus.Writer.inputField
protected

Definition at line 69 of file Writer.cs.

◆ inputFlag

bool Fungus.Writer.inputFlag
protected

Definition at line 80 of file Writer.cs.

◆ instantComplete

bool Fungus.Writer.instantComplete = true
protected

Definition at line 58 of file Writer.cs.

◆ isWaitingForInput

bool Fungus.Writer.isWaitingForInput
protected

Definition at line 61 of file Writer.cs.

◆ isWriting

bool Fungus.Writer.isWriting
protected

Definition at line 64 of file Writer.cs.

◆ italicActive

bool Fungus.Writer.italicActive = false
protected

Definition at line 75 of file Writer.cs.

◆ leftString

StringBuilder Fungus.Writer.leftString = new StringBuilder(1024)
protected

Definition at line 87 of file Writer.cs.

◆ openString

StringBuilder Fungus.Writer.openString = new StringBuilder(256)
protected

Definition at line 85 of file Writer.cs.

◆ outputString

StringBuilder Fungus.Writer.outputString = new StringBuilder(1024)
protected

Definition at line 89 of file Writer.cs.

◆ punchObject

GameObject Fungus.Writer.punchObject
protected

Definition at line 40 of file Writer.cs.

◆ punctuationPause

float Fungus.Writer.punctuationPause = 0.25f
protected

Definition at line 46 of file Writer.cs.

◆ readAheadString

StringBuilder Fungus.Writer.readAheadString = new StringBuilder(1024)
protected

Definition at line 90 of file Writer.cs.

◆ rightString

StringBuilder Fungus.Writer.rightString = new StringBuilder(1024)
protected

Definition at line 88 of file Writer.cs.

◆ sizeActive

bool Fungus.Writer.sizeActive = false
protected

Definition at line 78 of file Writer.cs.

◆ sizeValue

float Fungus.Writer.sizeValue = 16f
protected

Definition at line 79 of file Writer.cs.

◆ targetTextObject

GameObject Fungus.Writer.targetTextObject
protected

Definition at line 37 of file Writer.cs.

◆ textComponent

Component Fungus.Writer.textComponent
protected

Definition at line 71 of file Writer.cs.

◆ textMesh

TextMesh Fungus.Writer.textMesh
protected

Definition at line 70 of file Writer.cs.

◆ textProperty

PropertyInfo Fungus.Writer.textProperty
protected

Definition at line 72 of file Writer.cs.

◆ textUI

Text Fungus.Writer.textUI
protected

Definition at line 68 of file Writer.cs.

◆ visibleCharacterCount

int Fungus.Writer.visibleCharacterCount = 0
protected

Definition at line 95 of file Writer.cs.

◆ writerListeners

List<IWriterListener> Fungus.Writer.writerListeners = new List<IWriterListener>()
protected

Definition at line 83 of file Writer.cs.

◆ writeWholeWords

bool Fungus.Writer.writeWholeWords = false
protected

Definition at line 52 of file Writer.cs.

◆ writingSpeed

float Fungus.Writer.writingSpeed = 60
protected

Definition at line 43 of file Writer.cs.

Property Documentation

◆ AttachedWriterAudio

WriterAudio Fungus.Writer.AttachedWriterAudio
getset

Definition at line 96 of file Writer.cs.

◆ IsWaitingForInput

virtual bool Fungus.Writer.IsWaitingForInput
get

This property is true when the writer is waiting for user input to continue.

Definition at line 887 of file Writer.cs.

◆ IsWriting

virtual bool Fungus.Writer.IsWriting
get

This property is true when the writer is writing text or waiting (i.e.

still processing tokens).

Definition at line 882 of file Writer.cs.

◆ Paused

virtual bool Fungus.Writer.Paused
getset

Pauses the writer.

Definition at line 892 of file Writer.cs.

◆ Text

virtual string Fungus.Writer.Text
getset

Gets or sets the text property of the attached text object.

Definition at line 835 of file Writer.cs.


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