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

An implementation of a dialogue option display which allows each option to be attributes to a specific Vector2 direction. More...

Inherits EasyTalk.Display.OptionDisplay.

Public Member Functions

override void Init ()
 Initializes the option display. This method sets up the option element links to update when the mouse interacts with their corresponding buttons and sets up the actions of the buttons when they are clicked.
 
void SelectOption (int index, bool playSound=true)
 Selects the dialogue option with the specified index from the displayed List of options.
 
void DeselectOption (int index)
 Deselects the option at the specified index (from the List of directional option elements).
 
DirectionalOptionElement GetSelectedOptionElement ()
 Returns the directional option element which is currently selected.
 
Image GetLinkImage (int index)
 Returns the link image at the specified index.
 
DialogueButton GetButton (int index)
 Returns the dialogue button at the specified index.
 
override bool SelectOptionInDirection (Vector2 direction)
 Selected the option corresponding to the specified direction and returns the option index of it. This is typically used for selecting options using a joystick, d-pad, or arrow keys.
Parameters
directionThe direction to get an option for.
Returns
Returns true if an option was selected; false otherwise.

 
override void SetOptions (List< DialogueOption > options)
 
override int GetSelectedOption ()
 
override List< DialogueButtonGetOptionButtons ()
 
override void ActivateButtons ()
 
override void DeactivateButtons ()
 
- Public Member Functions inherited from EasyTalk.Display.OptionDisplay
override void Init ()
 Initializes the panel by storing the original position.
 
void SetOptions (List< DialogueOption > options)
 Setup the display to show the options specified.
 
List< DialogueButtonGetOptionButtons ()
 Returns a List containing all of the options buttons of the option display.
 
virtual bool SelectNextOption ()
 Selects the next option (relative to the currently selected one).
 
virtual bool SelectPreviousOption ()
 Selects the previous option (relative to the currently selected one).
 
int GetSelectedOption ()
 Returns the index of the option currently selected.
 
void ActivateButtons ()
 Activates the buttons used for selecting options.
 
void DeactivateButtons ()
 Deactivates the buttons used for selecting options.
 
virtual void TranslateOptions (DialogueController controller)
 Translates the text of each Dialogue Button in the option display based on the current language set on EasyTalkGameState.Instance.Language.
 
- Public Member Functions inherited from EasyTalk.Display.DialoguePanel
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.
 
virtual void OnExecuteAsyncNode (AsyncNode node)
 
virtual void OnWaitingForNodeEvaluation (Node asyncNode)
 
virtual void OnNodeEvaluationCompleted (Node asyncNode)
 

Protected Member Functions

void HighlightSelectedOption (bool playSound=true)
 Highlight the currently selected option.
 
override void ReadyOptions ()
 Make options available and ready for player interactions, reset the display for each option, and highlight the default/selected option.
 
- Protected Member Functions inherited from EasyTalk.Display.OptionDisplay
void OptionChosen ()
 This method should be called whenever an option is finalized as the choice the player wants to make. It will call the callback methods assigned to the onOptionChosen delegate.
 
virtual void OnOptionsSet (List< DialogueOption > options)
 Calls the OnOptionsSet() method on all Option Display Listeners registered with the Option Display.
 
virtual void OptionSelected (DialogueOption option)
 Calls the OnOptionSelected() method on all Option Display Listeners registered with the Option Display.
 
virtual void OptionChanged (DialogueOption oldOption, DialogueOption newOption)
 Calls the OnOptionChanged() method on all Option Display Listeners registered with the Option Display.
 
- 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.
 

Properties

List< DirectionalOptionElementOptionElements [get]
 Gets the List of DirectionalOptionElements containing the dialogue option buttons and linked images.
 
Transform CenterTransform [get, set]
 Gets or sets the center transform used by the directional option display.
 
List< Image > LinkedImages [get, set]
 Gets or sets the link images used for each option element.
 
bool UseOptionButtonColors [get, set]
 Gets or sets whether the directional option display's option element link images should inherit their colors from the buttons or not.
 
Color LinkNormalColor [get, set]
 Gets or sets the color to use for option element link images when their corresponding button is in 'normal' mode (only applicable when useOptionButtonColors is false).
 
Color LinkHighlightColor [get, set]
 Gets or sets the color to use for option element link images when their corresponding button is in 'highlighted' mode (only applicable when useOptionButtonColors is false).
 
Color LinkDisabledColor [get, set]
 Gets or sets the color to use for option element link images when their corresponding button is in 'disabled' mode (only applicable when useOptionButtonColors is false).
 
Color LinkPressedColor [get, set]
 Gets or sets the color to use for option element link images when their corresponding button is in 'pressed' mode (only applicable when useOptionButtonColors is false).
 
Image MainImage [get, set]
 Gets or sets the main/central image used by the directional option display.
 
- Properties inherited from EasyTalk.Display.OptionDisplay
List< Image > Images [get]
 The list of images used to create the option display panel.
 
- 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 SetUpButtonAction (DirectionalOptionElement optionElement)
 Sets up the dialogue option button associated with the provided DirectionalOptionElement to choose the currently selected option whenever it is clicked.
 
void SetUpLinkHighlight (DirectionalOptionElement optionElement)
 Sets up the link image for the provided DirectionalOptionElement to update its color when the associated option button is hovered over by the mouse.
 
void SetUpLinkExit (DirectionalOptionElement optionElement)
 Sets up the link image for the provided DirectionalOptionElement to update its color when the associated option button is left by the mouse.
 
void SetUpLinkPress (DirectionalOptionElement optionElement)
 Sets up the link image for the provided DirectionalOptionElement to update its color when the associated option button is pressed.
 

Private Attributes

List< DirectionalOptionElementoptionElements
 A List of the directional option elements used by the option display. Each element contains a button and a linked image which is manipulated whenever an interaction with a option button occurs.
 
Transform centerTransform
 The central location of the option display. This location is used to calculate the relative direction to each option unless an option's direction has been overriden.
 
Image mainImage
 The main/central image used in the directional display.
 
bool useOptionButtonColors = true
 If true, the option display's linked images will use the same colors as their corresponding buttons when in normal, pressed, highlighted, and disabled modes.
 
Color linkNormalColor = new Color(0.8f, 0.8f, 0.8f)
 The color to use on a linked image when in normal mode (only used if useOptionButtonColors is set to false).
 
Color linkHighlightColor = new Color(1.0f, 1.0f, 1.0f)
 The color to use on a linked image when in highlighted mode (only used if useOptionButtonColors is set to false).
 
Color linkPressedColor = new Color(0.6f, 0.6f, 0.6f)
 The color to use on a linked image when in pressed mode (only used if useOptionButtonColors is set to false).
 
Color linkDisabledColor = new Color(0.35f, 0.35f, 0.35f)
 The color to use on a linked image when in disabled mode (only used if useOptionButtonColors is set to false).
 
DirectionalOptionElement currentlySelectedOptionElement
 The currently selected option element.
 

Additional Inherited Members

- Public Attributes inherited from EasyTalk.Display.OptionDisplay
UnityEvent onOptionsSet = new UnityEvent()
 An event which is triggered when the presented options are updated.
 
UnityEvent onOptionSelected = new UnityEvent()
 An event which is triggered when the player selects (highlights) an option.
 
UnityEvent onOptionChanged = new UnityEvent()
 An event which is triggered when the player changes the selection from one option to another.
 
- 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.
 
UnityEvent onExecuteAsyncNode = new UnityEvent()
 
UnityEvent onWaitingForNodeCompletion = new UnityEvent()
 
UnityEvent onNodeEvaluationCompleted = new UnityEvent()
 
- Protected Attributes inherited from EasyTalk.Display.OptionDisplay
List< Image > images
 A list of images used to create the option display panel.
 
List< OptionDisplayListeneroptionDisplayListeners
 Listeners for option display events which are triggered whenever the options are displayed or the selected option changes.
 
- 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.
 

Detailed Description

An implementation of a dialogue option display which allows each option to be attributes to a specific Vector2 direction.

Member Function Documentation

◆ ActivateButtons()

override void EasyTalk.Display.DirectionalOptionDisplay.ActivateButtons ( )

◆ DeactivateButtons()

override void EasyTalk.Display.DirectionalOptionDisplay.DeactivateButtons ( )

◆ DeselectOption()

void EasyTalk.Display.DirectionalOptionDisplay.DeselectOption ( int index)

Deselects the option at the specified index (from the List of directional option elements).

Parameters
indexThe index of the option to deselect.

◆ GetButton()

DialogueButton EasyTalk.Display.DirectionalOptionDisplay.GetButton ( int index)

Returns the dialogue button at the specified index.

Parameters
indexThe index of the button to retrieve.
Returns
The dialogue button configured for the directional option element at the specified index.

◆ GetLinkImage()

Image EasyTalk.Display.DirectionalOptionDisplay.GetLinkImage ( int index)

Returns the link image at the specified index.

Parameters
indexThe index of the link image to retrieve.
Returns
The link image configured for the directional option element at the specified index.

◆ GetOptionButtons()

override List< DialogueButton > EasyTalk.Display.DirectionalOptionDisplay.GetOptionButtons ( )

◆ GetSelectedOption()

override int EasyTalk.Display.DirectionalOptionDisplay.GetSelectedOption ( )

◆ GetSelectedOptionElement()

DirectionalOptionElement EasyTalk.Display.DirectionalOptionDisplay.GetSelectedOptionElement ( )

Returns the directional option element which is currently selected.

Returns
The currently selected directional option element.

◆ HighlightSelectedOption()

void EasyTalk.Display.DirectionalOptionDisplay.HighlightSelectedOption ( bool playSound = true)
protected

Highlight the currently selected option.

Parameters
playSoundWhether the selection sound for the option should be played (default true).

◆ Init()

override void EasyTalk.Display.DirectionalOptionDisplay.Init ( )
virtual

Initializes the option display. This method sets up the option element links to update when the mouse interacts with their corresponding buttons and sets up the actions of the buttons when they are clicked.

Reimplemented from EasyTalk.Display.DialoguePanel.

◆ ReadyOptions()

override void EasyTalk.Display.DirectionalOptionDisplay.ReadyOptions ( )
protectedvirtual

Make options available and ready for player interactions, reset the display for each option, and highlight the default/selected option.

Reimplemented from EasyTalk.Display.OptionDisplay.

◆ SelectOption()

void EasyTalk.Display.DirectionalOptionDisplay.SelectOption ( int index,
bool playSound = true )

Selects the dialogue option with the specified index from the displayed List of options.

Parameters
indexThe index of the option to select.
playSoundWhether the button's hover sound should be played.

◆ SelectOptionInDirection()

override bool EasyTalk.Display.DirectionalOptionDisplay.SelectOptionInDirection ( Vector2 direction)
virtual

Selected the option corresponding to the specified direction and returns the option index of it. This is typically used for selecting options using a joystick, d-pad, or arrow keys.

Parameters
directionThe direction to get an option for.
Returns
Returns true if an option was selected; false otherwise.

Reimplemented from EasyTalk.Display.OptionDisplay.

◆ SetOptions()

override void EasyTalk.Display.DirectionalOptionDisplay.SetOptions ( List< DialogueOption > options)

◆ SetUpButtonAction()

void EasyTalk.Display.DirectionalOptionDisplay.SetUpButtonAction ( DirectionalOptionElement optionElement)
private

Sets up the dialogue option button associated with the provided DirectionalOptionElement to choose the currently selected option whenever it is clicked.

Parameters
optionElementThe directional option element to set up.

◆ SetUpLinkExit()

void EasyTalk.Display.DirectionalOptionDisplay.SetUpLinkExit ( DirectionalOptionElement optionElement)
private

Sets up the link image for the provided DirectionalOptionElement to update its color when the associated option button is left by the mouse.

Parameters
optionElementThe directional option element to set up.

◆ SetUpLinkHighlight()

void EasyTalk.Display.DirectionalOptionDisplay.SetUpLinkHighlight ( DirectionalOptionElement optionElement)
private

Sets up the link image for the provided DirectionalOptionElement to update its color when the associated option button is hovered over by the mouse.

Parameters
optionElementThe directional option element to set up.

◆ SetUpLinkPress()

void EasyTalk.Display.DirectionalOptionDisplay.SetUpLinkPress ( DirectionalOptionElement optionElement)
private

Sets up the link image for the provided DirectionalOptionElement to update its color when the associated option button is pressed.

Parameters
optionElementThe directional option element to set up.

Member Data Documentation

◆ centerTransform

Transform EasyTalk.Display.DirectionalOptionDisplay.centerTransform
private

The central location of the option display. This location is used to calculate the relative direction to each option unless an option's direction has been overriden.

◆ currentlySelectedOptionElement

DirectionalOptionElement EasyTalk.Display.DirectionalOptionDisplay.currentlySelectedOptionElement
private

The currently selected option element.

◆ linkDisabledColor

Color EasyTalk.Display.DirectionalOptionDisplay.linkDisabledColor = new Color(0.35f, 0.35f, 0.35f)
private

The color to use on a linked image when in disabled mode (only used if useOptionButtonColors is set to false).

◆ linkHighlightColor

Color EasyTalk.Display.DirectionalOptionDisplay.linkHighlightColor = new Color(1.0f, 1.0f, 1.0f)
private

The color to use on a linked image when in highlighted mode (only used if useOptionButtonColors is set to false).

◆ linkNormalColor

Color EasyTalk.Display.DirectionalOptionDisplay.linkNormalColor = new Color(0.8f, 0.8f, 0.8f)
private

The color to use on a linked image when in normal mode (only used if useOptionButtonColors is set to false).

◆ linkPressedColor

Color EasyTalk.Display.DirectionalOptionDisplay.linkPressedColor = new Color(0.6f, 0.6f, 0.6f)
private

The color to use on a linked image when in pressed mode (only used if useOptionButtonColors is set to false).

◆ mainImage

Image EasyTalk.Display.DirectionalOptionDisplay.mainImage
private

The main/central image used in the directional display.

◆ optionElements

List<DirectionalOptionElement> EasyTalk.Display.DirectionalOptionDisplay.optionElements
private

A List of the directional option elements used by the option display. Each element contains a button and a linked image which is manipulated whenever an interaction with a option button occurs.

◆ useOptionButtonColors

bool EasyTalk.Display.DirectionalOptionDisplay.useOptionButtonColors = true
private

If true, the option display's linked images will use the same colors as their corresponding buttons when in normal, pressed, highlighted, and disabled modes.

Property Documentation

◆ CenterTransform

Transform EasyTalk.Display.DirectionalOptionDisplay.CenterTransform
getset

Gets or sets the center transform used by the directional option display.

◆ LinkDisabledColor

Color EasyTalk.Display.DirectionalOptionDisplay.LinkDisabledColor
getset

Gets or sets the color to use for option element link images when their corresponding button is in 'disabled' mode (only applicable when useOptionButtonColors is false).

◆ LinkedImages

List<Image> EasyTalk.Display.DirectionalOptionDisplay.LinkedImages
getset

Gets or sets the link images used for each option element.

◆ LinkHighlightColor

Color EasyTalk.Display.DirectionalOptionDisplay.LinkHighlightColor
getset

Gets or sets the color to use for option element link images when their corresponding button is in 'highlighted' mode (only applicable when useOptionButtonColors is false).

◆ LinkNormalColor

Color EasyTalk.Display.DirectionalOptionDisplay.LinkNormalColor
getset

Gets or sets the color to use for option element link images when their corresponding button is in 'normal' mode (only applicable when useOptionButtonColors is false).

◆ LinkPressedColor

Color EasyTalk.Display.DirectionalOptionDisplay.LinkPressedColor
getset

Gets or sets the color to use for option element link images when their corresponding button is in 'pressed' mode (only applicable when useOptionButtonColors is false).

◆ MainImage

Image EasyTalk.Display.DirectionalOptionDisplay.MainImage
getset

Gets or sets the main/central image used by the directional option display.

◆ OptionElements

List<DirectionalOptionElement> EasyTalk.Display.DirectionalOptionDisplay.OptionElements
get

Gets the List of DirectionalOptionElements containing the dialogue option buttons and linked images.

◆ UseOptionButtonColors

bool EasyTalk.Display.DirectionalOptionDisplay.UseOptionButtonColors
getset

Gets or sets whether the directional option display's option element link images should inherit their colors from the buttons or not.