EasyTalk API
Loading...
Searching...
No Matches
EasyTalk.Display.ConversationDisplay Class Reference

This is an implementation of a conversation display which is used to display lines of dialogue to a player in addition to the name of the character who is speaking if desired. More...

Inherits EasyTalk.Display.DialoguePanel.

Inherited by EasyTalk.Display.WorldspaceConversationDisplay.

Public Types

enum  TextDisplayMode { FULL , BY_WORD , BY_CHARACTER }
 Defines possible modes for displaying dialogue text. More...
 

Public Member Functions

void ShowConversationText ()
 Activates the conversation text.
 
virtual void HideConversationText ()
 Deactivates the conversation text.
 
void ShowCharacterName ()
 Activates the character name text.
 
virtual void HideCharacterName ()
 Deactivates the character name text.
 
void SetConversationText (string text)
 Sets the value of the conversation display dialogue text element.
 
IEnumerator SetConversationText (ConversationLine line)
 Asynchronously sets the conversation display's dialogue text based on the text display mode to the text of the line of dialogue provided.
 
IEnumerator SetConversationTextAsync (string text, float delay=0.0f)
 Asynchronously sets the displayed dialogue text based on the text display mode set on this conversation display. The delay is used to sync the timing of the text with the total time alloted to the line of dialogue (applies when the dialogue controller is in AUTOPLAY mode).
 
void SetCharacterName (string characterName, string sourceName)
 Sets the character name text to display the provided character name.
 
void Reset ()
 Resets the conversation display by setting the character name and conversation text to blank values.
 
virtual void TranslateText (DialogueController controller)
 Translates the conversation text and character name based on the current language set on EasyTalkGameState.Instance.Language.
 
- Public Member Functions inherited from EasyTalk.Display.DialoguePanel
virtual void Init ()
 Initializes the panel by storing the original position.
 
void Activate ()
 Sets the panel to be active, and recursively sets all parent game objects to be active.
 
void Deactivate ()
 Makes the panel inactive.
 
bool ForceStandardText ()
 
IEnumerator WaitForAnimation ()
 Asynchronously waits for the currently running animation on this panel to complete.
 
virtual void Hide (bool deactivateAfterHide=true)
 Hides the panel.
 
void HideImmediately (bool deactivateAfterHide=true)
 Hides the panel immediately (doesn't use a transition animation).
 
void ShowImmediately ()
 Shows the panel immediately (doesn't use a transition animation).
 
virtual void Show ()
 Shows the panel.
 
- Public Member Functions inherited from EasyTalk.Controller.DialogueListener
virtual void OnContinue ()
 Called whenever the dialogue continues on to the next line.
 
virtual void OnDisplayOptions (List< DialogueOption > options)
 Called whenever dialogue options are to be presented.
 
virtual void OnOptionChosen (DialogueOption option)
 Called whenever an option is chosen from the currently presented list of options.
 
virtual void OnDisplayLine (ConversationLine conversationLine)
 Called when a line of dialogue is to be presented.
 
virtual void OnDialogueEntered (string entryPointName)
 Called whenever a dialogue is entered (when playback begins).
 
virtual void OnDialogueExited (string exitPointName)
 Called whenever a dialogue is exited (when playback ends).
 
virtual void OnExitCompleted ()
 Called at least one frame after a dialogue is exited.
 
virtual void OnStory (string storyText)
 Called whenever a story node is encountered.
 
virtual void OnVariableUpdated (string variableName, object value)
 Called whenever a dialogue variable value is updated.
 
virtual void OnCharacterChanged (string oldCharacterName, string newCharacterName)
 Called whenever a character change is detected.
 
virtual void OnAudioStarted (ConversationLine line)
 Called whenever audio starts playing for a line of dialogue.
 
virtual void OnAudioCompleted (ConversationLine line, bool forceStopped)
 Called whenever audio stops playing for a line of dialogue.
 
virtual void OnActivateKey (string key)
 Called whenever a key tag is present in a line of dialogue.
 
virtual void Wait (float timeInSeconds)
 Called whenever the dialogue encounters a wait node.
 
virtual void OnConversationEnding (ConversationLine line, Node nextNode)
 Called whenever the last line of dialogue in a conversation node is reached.
 
virtual void OnNodeChanged (Node node)
 Called whenever dialogue playback moves to the next node.
 
virtual void OnPause (string signal)
 Called whenever a pause node is reached during dialogue playback.
 

Protected Attributes

UnityEvent onCharacterNameUpdated = new UnityEvent()
 An event which is triggered when the character name is updated.
 
UnityEvent onConversationTextUpdated = new UnityEvent()
 An event which is triggered when the covnersation text is updated.
 
UnityEvent onReset = new UnityEvent()
 An event which is triggered whenever the display is cleared out, meaning the conversation text and character name are set to empty strings.
 
ConversationLine currentLine
 The current line of dialogue being displayed by the conversation display.
 
- Protected Attributes inherited from EasyTalk.Display.DialoguePanel
bool forceStandardText = false
 Whether the Display uses standard Text components rather than TextMeshPro components, even with TextMeshPro installed.
 
Vector3 originalPosition = Vector3.zero
 The original position of the panel.
 
bool isHidden = false
 Whether the panel is currently hidden.
 

Properties

Text StandardCharacterNameText [get, set]
 Gets or sets the standard Unity Text component of the display for the character name.
 
Image CharacterNameBackgroundImage [get]
 Gets the image used for the character name panel.
 
Text StandardConvoText [get, set]
 Gets or sets the standard Unity Text component of the display.
 
List< Image > ConversationPanelImages [get]
 Gets the List of images used for the conversation display panel.
 
TextDisplayMode TextPresentationMode [get, set]
 Gets or sets the display mode used for dialogue text.
 
float WordsPerSecond [get, set]
 Gets or sets the number of words per second to display when displaying dialogue in BY_WORD mode.
 
float CharactersPerSecond [get, set]
 Gets or sets the number of characters per second to display when displaying dialogue in BY_CHARACTER mode.
 
- Properties inherited from EasyTalk.Display.DialoguePanel
string DisplayID [get, set]
 Gets or sets the Display ID of the panel.
 
bool IsHidden [get]
 Gets whether the panel is currently hidden.
 
Vector3 OriginalPosition [get]
 Gets the original position of the panel.
 
UIAnimator.Animation AnimationType [get, set]
 Gets or sets the animation type used for showing and hiding the panel.
 
bool OverrideFontSizes [get, set]
 Gets or sets whether the component should override the default font sizes.
 
LanguageFontOverrides LanguageFontOverrides [get, set]
 Gets or sets the LanguageFontOverrides to use on the component.
 
int MinFontSize [get, set]
 Gets or sets the minimum font size to use on the component.
 
int MaxFontSize [get, set]
 Gets or sets the maximum font size to use on the component.
 
- Properties inherited from EasyTalk.Display.LocalizableComponent

Private Member Functions

void Awake ()
 Initializes the display and hides it on awake.
 
IEnumerator SetConversationTextByWord (string text, float delay)
 Updates the displayed dialogue text by displaying one word at a time, using a specific delay per word.
 
IEnumerator SetConversationTextByCharacter (string text, float delay)
 Updates the displayed dialogue text by displaying one character at a time, using a specific delay per character.
 

Private Attributes

Text characterNameText
 The text element used to display the character name.
 
Image characterNameBackgroundImage
 The background image of the character name display.
 
Text convoText
 The text element used to display lines of dialogue.
 
TextDisplayMode textDisplayMode = TextDisplayMode.FULL
 The display mode of the dialogue text.
 
float wordsPerSecond = 5.0f
 When the text display mode is set to BY_WORD, this value controls how many words are displayed per second.
 
float charactersPerSecond = 20.0f
 When the text display mode is set to BY_CHARACTER, this value controls how many characters are displayed per second.
 
List< Image > conversationPanelImages = new List<Image>()
 The images used to create the conversation display panel.
 
bool hideOnAwake = true
 Whether the conversation display should be hidden on awake.
 
List< ConversationDisplayListenerconversationDisplayListeners = new List<ConversationDisplayListener>()
 Listeners for conversation display events which are triggered whenever the character name is updated or the conversation text is updated.
 

Additional Inherited Members

- Public Attributes inherited from EasyTalk.Display.DialoguePanel
UnityEvent onHideStart = new UnityEvent()
 An event which is triggered whenever the panel starts being hidden.
 
UnityEvent onHideComplete = new UnityEvent()
 An event which is triggered whenever the panel has finished transitioning to a hidden state.
 
UnityEvent onShowStart = new UnityEvent()
 An event which is triggered whenever the panel starts being shown.
 
UnityEvent onShowComplete = new UnityEvent()
 An event which is triggered whenever the panel has finished transitioning to a shown state.
 
- Public Attributes inherited from EasyTalk.Controller.DialogueListener
bool debugEnabled = false
 When set to true, debug logging will be shown for each method called on the listener.
 
UnityEvent onContinue = new UnityEvent()
 An event which is triggered whenever the dialogue continues.
 
UnityEvent onDisplayOptions = new UnityEvent()
 An event which is triggered whenever options are to be displayed to the player.
 
UnityEvent onOptionChosen = new UnityEvent()
 An event which is triggered whenever the player chooses an option.
 
UnityEvent onDisplayLine = new UnityEvent()
 An event which is triggered whenever a line of dialogue is to be displayed.
 
UnityEvent onDialogueEntered = new UnityEvent()
 An event which is triggered whenever dialogue playback begins.
 
UnityEvent onDialogueExited = new UnityEvent()
 An event which is triggered whenever dialogue playback ends.
 
UnityEvent onExitCompleted = new UnityEvent()
 An event which is triggered one frame after dialogue playback ends.
 
UnityEvent onStory = new UnityEvent()
 An event which is triggered whenever a story node is encountered.
 
UnityEvent onVariableUpdated = new UnityEvent()
 An event which is triggered whenever a dialogue variable value is updated.
 
UnityEvent onCharacterChanged = new UnityEvent()
 An event which is triggered whenever a character name change is detected.
 
UnityEvent onAudioStarted = new UnityEvent()
 An event which is triggered whenever dialogue audio starts playing.
 
UnityEvent onAudioCompleted = new UnityEvent()
 An event which is triggered whenever dialogue audio finishes playing.
 
UnityEvent onActivateKey = new UnityEvent()
 An event which is triggered whenever a key is to be processed on a dialogue.
 
UnityEvent onWait = new UnityEvent()
 An event which is triggered whenever a dialogue starts waiting for a certain period of time before continuing.
 
UnityEvent onConversationEnding = new UnityEvent()
 An event which is triggered whenever the last line of dialogue in a conversation node is reached.
 
UnityEvent onNodeChanged = new UnityEvent()
 An event which is triggered whenever a the dialogue flows from one node to another.
 
UnityEvent onPause = new UnityEvent()
 An event which is triggered whenever the dialogue reaches a pause node, pausing and waiting for Continue() to be called.
 
- Protected Member Functions inherited from EasyTalk.Display.DialoguePanel
IEnumerator SlideDisplayOut (bool deactivateAfterSlide=true)
 Asynchronously slides the display out of its Canvas' bounds.
 
IEnumerator SlideDisplayIn ()
 Asynchronously slides the display into its Canvas' bounds. If returnToOriginalPosition is set to true, then the panel will slide to its original position.
 
IEnumerator FadeDisplayIn ()
 Asynchronously fades the display and all of its child text and image components in to their original transparency values.
 
IEnumerator FadeDisplayOut (bool deactivateAfterFade=true)
 Asynchronously fades the display and all of its child text and image components out to be completely transparent.
 

Detailed Description

This is an implementation of a conversation display which is used to display lines of dialogue to a player in addition to the name of the character who is speaking if desired.

Member Enumeration Documentation

◆ TextDisplayMode

Defines possible modes for displaying dialogue text.

Enumerator
FULL 
BY_WORD 
BY_CHARACTER 

Member Function Documentation

◆ Awake()

void EasyTalk.Display.ConversationDisplay.Awake ( )
private

Initializes the display and hides it on awake.

◆ HideCharacterName()

virtual void EasyTalk.Display.ConversationDisplay.HideCharacterName ( )
virtual

Deactivates the character name text.

◆ HideConversationText()

virtual void EasyTalk.Display.ConversationDisplay.HideConversationText ( )
virtual

Deactivates the conversation text.

◆ Reset()

void EasyTalk.Display.ConversationDisplay.Reset ( )

Resets the conversation display by setting the character name and conversation text to blank values.

◆ SetCharacterName()

void EasyTalk.Display.ConversationDisplay.SetCharacterName ( string characterName,
string sourceName )

Sets the character name text to display the provided character name.

Parameters
characterName

◆ SetConversationText() [1/2]

IEnumerator EasyTalk.Display.ConversationDisplay.SetConversationText ( ConversationLine line)

Asynchronously sets the conversation display's dialogue text based on the text display mode to the text of the line of dialogue provided.

Parameters
lineThe line of dialogue to use when setting the displayed dialogue text.
Returns

◆ SetConversationText() [2/2]

void EasyTalk.Display.ConversationDisplay.SetConversationText ( string text)

Sets the value of the conversation display dialogue text element.

Parameters
textThe text to use.

◆ SetConversationTextAsync()

IEnumerator EasyTalk.Display.ConversationDisplay.SetConversationTextAsync ( string text,
float delay = 0::0f )

Asynchronously sets the displayed dialogue text based on the text display mode set on this conversation display. The delay is used to sync the timing of the text with the total time alloted to the line of dialogue (applies when the dialogue controller is in AUTOPLAY mode).

Parameters
textThe text to set.
delayA delay added each time the text is updated when in BY_WORD or BY_CHARACTER mode.
Returns

◆ SetConversationTextByCharacter()

IEnumerator EasyTalk.Display.ConversationDisplay.SetConversationTextByCharacter ( string text,
float delay )
private

Updates the displayed dialogue text by displaying one character at a time, using a specific delay per character.

Parameters
textThe full text to display.
delayThe delay to use between characters.
Returns

◆ SetConversationTextByWord()

IEnumerator EasyTalk.Display.ConversationDisplay.SetConversationTextByWord ( string text,
float delay )
private

Updates the displayed dialogue text by displaying one word at a time, using a specific delay per word.

Parameters
textThe full text to display.
delayThe delay to use between words.
Returns

◆ ShowCharacterName()

void EasyTalk.Display.ConversationDisplay.ShowCharacterName ( )

Activates the character name text.

◆ ShowConversationText()

void EasyTalk.Display.ConversationDisplay.ShowConversationText ( )

Activates the conversation text.

◆ TranslateText()

virtual void EasyTalk.Display.ConversationDisplay.TranslateText ( DialogueController controller)
virtual

Translates the conversation text and character name based on the current language set on EasyTalkGameState.Instance.Language.

Parameters
controllerThe Dialogue Controller being used.

Member Data Documentation

◆ characterNameBackgroundImage

Image EasyTalk.Display.ConversationDisplay.characterNameBackgroundImage
private

The background image of the character name display.

◆ characterNameText

Text EasyTalk.Display.ConversationDisplay.characterNameText
private

The text element used to display the character name.

◆ charactersPerSecond

float EasyTalk.Display.ConversationDisplay.charactersPerSecond = 20.0f
private

When the text display mode is set to BY_CHARACTER, this value controls how many characters are displayed per second.

◆ conversationDisplayListeners

List<ConversationDisplayListener> EasyTalk.Display.ConversationDisplay.conversationDisplayListeners = new List<ConversationDisplayListener>()
private

Listeners for conversation display events which are triggered whenever the character name is updated or the conversation text is updated.

◆ conversationPanelImages

List<Image> EasyTalk.Display.ConversationDisplay.conversationPanelImages = new List<Image>()
private

The images used to create the conversation display panel.

◆ convoText

Text EasyTalk.Display.ConversationDisplay.convoText
private

The text element used to display lines of dialogue.

◆ currentLine

ConversationLine EasyTalk.Display.ConversationDisplay.currentLine
protected

The current line of dialogue being displayed by the conversation display.

◆ hideOnAwake

bool EasyTalk.Display.ConversationDisplay.hideOnAwake = true
private

Whether the conversation display should be hidden on awake.

◆ onCharacterNameUpdated

UnityEvent EasyTalk.Display.ConversationDisplay.onCharacterNameUpdated = new UnityEvent()
protected

An event which is triggered when the character name is updated.

◆ onConversationTextUpdated

UnityEvent EasyTalk.Display.ConversationDisplay.onConversationTextUpdated = new UnityEvent()
protected

An event which is triggered when the covnersation text is updated.

◆ onReset

UnityEvent EasyTalk.Display.ConversationDisplay.onReset = new UnityEvent()
protected

An event which is triggered whenever the display is cleared out, meaning the conversation text and character name are set to empty strings.

◆ textDisplayMode

TextDisplayMode EasyTalk.Display.ConversationDisplay.textDisplayMode = TextDisplayMode.FULL
private

The display mode of the dialogue text.

◆ wordsPerSecond

float EasyTalk.Display.ConversationDisplay.wordsPerSecond = 5.0f
private

When the text display mode is set to BY_WORD, this value controls how many words are displayed per second.

Property Documentation

◆ CharacterNameBackgroundImage

Image EasyTalk.Display.ConversationDisplay.CharacterNameBackgroundImage
get

Gets the image used for the character name panel.

◆ CharactersPerSecond

float EasyTalk.Display.ConversationDisplay.CharactersPerSecond
getset

Gets or sets the number of characters per second to display when displaying dialogue in BY_CHARACTER mode.

◆ ConversationPanelImages

List<Image> EasyTalk.Display.ConversationDisplay.ConversationPanelImages
get

Gets the List of images used for the conversation display panel.

◆ StandardCharacterNameText

Text EasyTalk.Display.ConversationDisplay.StandardCharacterNameText
getset

Gets or sets the standard Unity Text component of the display for the character name.

◆ StandardConvoText

Text EasyTalk.Display.ConversationDisplay.StandardConvoText
getset

Gets or sets the standard Unity Text component of the display.

◆ TextPresentationMode

TextDisplayMode EasyTalk.Display.ConversationDisplay.TextPresentationMode
getset

Gets or sets the display mode used for dialogue text.

◆ WordsPerSecond

float EasyTalk.Display.ConversationDisplay.WordsPerSecond
getset

Gets or sets the number of words per second to display when displaying dialogue in BY_WORD mode.