v3.9.1 Documentation
Fungus.SayDialog Class Reference

Display story text in a visual novel style dialog box. More...

Inheritance diagram for Fungus.SayDialog:

Public Member Functions

virtual void SetActive (bool state)
 Sets the active state of the Say Dialog gameobject. More...
 
virtual void SetCharacter (Character character)
 Sets the active speaking character. More...
 
virtual void SetCharacterImage (Sprite image)
 Sets the character image to display on the Say Dialog. More...
 
virtual void SetCharacterName (string name, Color color)
 Sets the character name to display on the Say Dialog. More...
 
virtual void Say (string text, bool clearPrevious, bool waitForInput, bool fadeWhenDone, bool stopVoiceover, bool waitForVO, AudioClip voiceOverClip, Action onComplete)
 Write a line of story text to the Say Dialog. More...
 
virtual IEnumerator DoSay (string text, bool clearPrevious, bool waitForInput, bool fadeWhenDone, bool stopVoiceover, bool waitForVO, AudioClip voiceOverClip, Action onComplete)
 Write a line of story text to the Say Dialog. More...
 
virtual void Stop ()
 Stop the Say Dialog while its writing text. More...
 
virtual void Clear ()
 Stops writing text and clears the Say Dialog. More...
 

Static Public Member Functions

static SayDialog GetSayDialog ()
 Returns a SayDialog by searching for one in the scene or creating one if none exists. More...
 
static void StopPortraitTweens ()
 Stops all active portrait tweens. More...
 

Protected Member Functions

virtual void Awake ()
 
virtual void OnDestroy ()
 
virtual Writer GetWriter ()
 
virtual CanvasGroup GetCanvasGroup ()
 
virtual WriterAudio GetWriterAudio ()
 
virtual void Start ()
 
virtual void LateUpdate ()
 
virtual void UpdateAlpha ()
 
virtual void ClearStoryText ()
 

Protected Attributes

float fadeDuration = 0.25f
 
Button continueButton
 
Canvas dialogCanvas
 
Text nameText
 
Text storyText
 
Image characterImage
 
bool fitTextWithImage = true
 
bool closeOtherDialogs
 
float startStoryTextWidth
 
float startStoryTextInset
 
WriterAudio writerAudio
 
Writer writer
 
CanvasGroup canvasGroup
 
bool fadeWhenDone = true
 
float targetAlpha = 0f
 
float fadeCoolDownTimer = 0f
 
Sprite currentCharacterImage
 
StringSubstituter stringSubstituter = new StringSubstituter()
 

Static Protected Attributes

static Character speakingCharacter
 
static List< SayDialogactiveSayDialogs = new List<SayDialog>()
 

Properties

virtual Text NameText [get]
 
virtual Text StoryText [get]
 
virtual Image CharacterImage [get]
 
Character SpeakingCharacter [get]
 
static SayDialog ActiveSayDialog [get, set]
 Currently active Say Dialog used to display Say text More...
 
virtual bool FadeWhenDone [get, set]
 Tell the Say Dialog to fade out once writing and player input have finished. More...
 

Detailed Description

Display story text in a visual novel style dialog box.

Definition at line 15 of file SayDialog.cs.

Member Function Documentation

◆ Awake()

virtual void Fungus.SayDialog.Awake ( )
protectedvirtual

Definition at line 65 of file SayDialog.cs.

◆ Clear()

virtual void Fungus.SayDialog.Clear ( )
virtual

Stops writing text and clears the Say Dialog.

Definition at line 509 of file SayDialog.cs.

◆ ClearStoryText()

virtual void Fungus.SayDialog.ClearStoryText ( )
protectedvirtual

Definition at line 200 of file SayDialog.cs.

◆ DoSay()

virtual IEnumerator Fungus.SayDialog.DoSay ( string  text,
bool  clearPrevious,
bool  waitForInput,
bool  fadeWhenDone,
bool  stopVoiceover,
bool  waitForVO,
AudioClip  voiceOverClip,
Action  onComplete 
)
virtual

Write a line of story text to the Say Dialog.

Must be started as a coroutine.

Parameters
textThe text to display.
clearPreviousClear any previous text in the Say Dialog.
waitForInputWait for player input before continuing once text is written.
fadeWhenDoneFade out the Say Dialog when writing and player input has finished.
stopVoiceoverStop any existing voiceover audio before writing starts.
voiceOverClipVoice over audio clip to play.
onCompleteCallback to execute when writing and player input have finished.

Definition at line 446 of file SayDialog.cs.

◆ GetCanvasGroup()

virtual CanvasGroup Fungus.SayDialog.GetCanvasGroup ( )
protectedvirtual

Definition at line 94 of file SayDialog.cs.

◆ GetSayDialog()

static SayDialog Fungus.SayDialog.GetSayDialog ( )
static

Returns a SayDialog by searching for one in the scene or creating one if none exists.

Definition at line 220 of file SayDialog.cs.

◆ GetWriter()

virtual Writer Fungus.SayDialog.GetWriter ( )
protectedvirtual

Definition at line 78 of file SayDialog.cs.

◆ GetWriterAudio()

virtual WriterAudio Fungus.SayDialog.GetWriterAudio ( )
protectedvirtual

Definition at line 110 of file SayDialog.cs.

◆ LateUpdate()

virtual void Fungus.SayDialog.LateUpdate ( )
protectedvirtual

Definition at line 153 of file SayDialog.cs.

◆ OnDestroy()

virtual void Fungus.SayDialog.OnDestroy ( )
protectedvirtual

Definition at line 73 of file SayDialog.cs.

◆ Say()

virtual void Fungus.SayDialog.Say ( string  text,
bool  clearPrevious,
bool  waitForInput,
bool  fadeWhenDone,
bool  stopVoiceover,
bool  waitForVO,
AudioClip  voiceOverClip,
Action  onComplete 
)
virtual

Write a line of story text to the Say Dialog.

Starts coroutine automatically.

Parameters
textThe text to display.
clearPreviousClear any previous text in the Say Dialog.
waitForInputWait for player input before continuing once text is written.
fadeWhenDoneFade out the Say Dialog when writing and player input has finished.
stopVoiceoverStop any existing voiceover audio before writing starts.
voiceOverClipVoice over audio clip to play.
onCompleteCallback to execute when writing and player input have finished.

Definition at line 431 of file SayDialog.cs.

◆ SetActive()

virtual void Fungus.SayDialog.SetActive ( bool  state)
virtual

Sets the active state of the Say Dialog gameobject.

Definition at line 286 of file SayDialog.cs.

◆ SetCharacter()

virtual void Fungus.SayDialog.SetCharacter ( Character  character)
virtual

Sets the active speaking character.

Parameters
characterThe active speaking character.

Definition at line 295 of file SayDialog.cs.

◆ SetCharacterImage()

virtual void Fungus.SayDialog.SetCharacterImage ( Sprite  image)
virtual

Sets the character image to display on the Say Dialog.

Definition at line 355 of file SayDialog.cs.

◆ SetCharacterName()

virtual void Fungus.SayDialog.SetCharacterName ( string  name,
Color  color 
)
virtual

Sets the character name to display on the Say Dialog.

Supports variable substitution e.g. John {$surname}

Definition at line 411 of file SayDialog.cs.

◆ Start()

virtual void Fungus.SayDialog.Start ( )
protectedvirtual

Definition at line 126 of file SayDialog.cs.

◆ Stop()

virtual void Fungus.SayDialog.Stop ( )
virtual

Stop the Say Dialog while its writing text.

Definition at line 500 of file SayDialog.cs.

◆ StopPortraitTweens()

static void Fungus.SayDialog.StopPortraitTweens ( )
static

Stops all active portrait tweens.

Definition at line 257 of file SayDialog.cs.

◆ UpdateAlpha()

virtual void Fungus.SayDialog.UpdateAlpha ( )
protectedvirtual

Definition at line 163 of file SayDialog.cs.

Member Data Documentation

◆ activeSayDialogs

List<SayDialog> Fungus.SayDialog.activeSayDialogs = new List<SayDialog>()
staticprotected

Definition at line 63 of file SayDialog.cs.

◆ canvasGroup

CanvasGroup Fungus.SayDialog.canvasGroup
protected

Definition at line 49 of file SayDialog.cs.

◆ characterImage

Image Fungus.SayDialog.characterImage
protected

Definition at line 35 of file SayDialog.cs.

◆ closeOtherDialogs

bool Fungus.SayDialog.closeOtherDialogs
protected

Definition at line 42 of file SayDialog.cs.

◆ continueButton

Button Fungus.SayDialog.continueButton
protected

Definition at line 21 of file SayDialog.cs.

◆ currentCharacterImage

Sprite Fungus.SayDialog.currentCharacterImage
protected

Definition at line 55 of file SayDialog.cs.

◆ dialogCanvas

Canvas Fungus.SayDialog.dialogCanvas
protected

Definition at line 24 of file SayDialog.cs.

◆ fadeCoolDownTimer

float Fungus.SayDialog.fadeCoolDownTimer = 0f
protected

Definition at line 53 of file SayDialog.cs.

◆ fadeDuration

float Fungus.SayDialog.fadeDuration = 0.25f
protected

Definition at line 18 of file SayDialog.cs.

◆ fadeWhenDone

bool Fungus.SayDialog.fadeWhenDone = true
protected

Definition at line 51 of file SayDialog.cs.

◆ fitTextWithImage

bool Fungus.SayDialog.fitTextWithImage = true
protected

Definition at line 39 of file SayDialog.cs.

◆ nameText

Text Fungus.SayDialog.nameText
protected

Definition at line 27 of file SayDialog.cs.

◆ speakingCharacter

Character Fungus.SayDialog.speakingCharacter
staticprotected

Definition at line 58 of file SayDialog.cs.

◆ startStoryTextInset

float Fungus.SayDialog.startStoryTextInset
protected

Definition at line 45 of file SayDialog.cs.

◆ startStoryTextWidth

float Fungus.SayDialog.startStoryTextWidth
protected

Definition at line 44 of file SayDialog.cs.

◆ storyText

Text Fungus.SayDialog.storyText
protected

Definition at line 31 of file SayDialog.cs.

◆ stringSubstituter

StringSubstituter Fungus.SayDialog.stringSubstituter = new StringSubstituter()
protected

Definition at line 60 of file SayDialog.cs.

◆ targetAlpha

float Fungus.SayDialog.targetAlpha = 0f
protected

Definition at line 52 of file SayDialog.cs.

◆ writer

Writer Fungus.SayDialog.writer
protected

Definition at line 48 of file SayDialog.cs.

◆ writerAudio

WriterAudio Fungus.SayDialog.writerAudio
protected

Definition at line 47 of file SayDialog.cs.

Property Documentation

◆ ActiveSayDialog

SayDialog Fungus.SayDialog.ActiveSayDialog
staticgetset

Currently active Say Dialog used to display Say text

Definition at line 215 of file SayDialog.cs.

◆ CharacterImage

virtual Image Fungus.SayDialog.CharacterImage
get

Definition at line 36 of file SayDialog.cs.

◆ FadeWhenDone

virtual bool Fungus.SayDialog.FadeWhenDone
getset

Tell the Say Dialog to fade out once writing and player input have finished.

Definition at line 495 of file SayDialog.cs.

◆ NameText

virtual Text Fungus.SayDialog.NameText
get

Definition at line 28 of file SayDialog.cs.

◆ SpeakingCharacter

Character Fungus.SayDialog.SpeakingCharacter
get

Definition at line 210 of file SayDialog.cs.

◆ StoryText

virtual Text Fungus.SayDialog.StoryText
get

Definition at line 32 of file SayDialog.cs.


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