EasyTalk API
Loading...
Searching...
No Matches
EasyTalk.Controller.NodeHandler Class Reference

This class is used to process a collection of linked nodes, such as a dialogue and handles all of the logic for moving from one node to the next, evaluating variable values, and sending messages (via callbacks) about what is happening in a dialogue as it is processed. More...

Public Member Functions

 NodeHandler (GameObject owner)
 Creates a new NodeHandler.
 
void Update ()
 Called by Dialogue Controllers to run queued up Tasks.
 
void AddTask (Task task)
 Adds a task to the current queue.
 
void ExecutionCompleted (AsyncNode asyncNode)
 Creates a Task to call AsyncExecutionCompleted on the main thread.
 
void DisplayLine (ConversationLine line)
 Queues up a Task to call OnDisplayLine on the node handler's Dialogue Listener. Normally, this will cause a line of dialogue to be displayed.
 
void Initialize (Dialogue dialogue)
 Initializes the NodeHandler by setting the dialogue, clearing various mappings, determining the default 'entry' node, and creating variables.
 
void ForceExit ()
 Forces an exit to be triggered immediately on the Dialogue.
 
IEnumerator JumpToNodeAfterDelay (float delay, Node node)
 Jumps to the specified node after a certain amount of time.
 
void ChooseOption (int optionIdx)
 Chooses the option, and thus continues down the corresponding path, of the option specified.
 
void ProcessNode (Node node)
 Processes the node specified according to its type.
 
void HandleWaitNode ()
 Waits for the configured duration of the wait node currently being processed before continuing.
 
void HandlePauseNode ()
 Triggers the OnPause() callback on the Dialogue Listener and waits for a continue.
 
void HandleStoryNode ()
 Triggers the OnStory() callback on the Dialogue Listener and waits for a continue.
 
void ProcessCurrentNode ()
 Processes the current node, determining any dependent values used by the node and setting values as necessary on outputs. Once the node is processed, the next node will be determined and processed.
 
void HandleJump ()
 Handles the 'jump out' node by finding the associated 'jump in' node and moving to the next node after the 'jump in'.
 
void HandleConversation ()
 Handles the current 'conversation' node, sending a signal via the onDisplayConversationLine callback to display the first line in the 'conversation' node. If the 'conversation' node only has 1 line, the atConversationNodeEnding callback will also be triggered.
 
Node GetNextNode ()
 Returns the next node along the Dialogue flow path.
 
void HandlePathSelectorNode ()
 Evaluates the current 'path select' node to determine which path to continue down and the moves along that path.
 
void HandleOptionNode ()
 Builds a List of DialogueOptions to present to the player based on the current 'option' node. This method handles 'option modifier' nodes and also deals with variable injection, translation, and tag extraction. Once the List of DialogueOptions is created, this method calls the onDisplayOptions callback so that the options can be used by anything registered with the delegate.
 
string Translate (string text)
 Performs a lookup in the active Translation Library for the text provided and returns a translation, if there is one. The text is attempted to be translated into whatever langauge is set on EasyTalkGameState.Instance.Language.
 
string Translate (string text, out string preTranslationText)
 Performs a lookup in the active Translation Library for the text provided and returns a translation, if there is one. The text is attempted to be translated into whatever langauge is set on EasyTalkGameState.Instance.Language. This method also sets the provided preTranslationText string to the string being translated, immediately prior to translation. The preTranslationText may differ from the originally provided text if the EasyTalkDialogueSettings.Instance.TranslationEvaluationMode is set to TRANSLATE_AFTER_VARIABLE_EVALUATION, since in that mode, all variable tags are replaced with their values prior to translation.
 
void HandleExit ()
 Handles the current 'exit' node by exiting the dialogue and triggering the onDialogueExited callback.
 
string ReplaceVariablesInString (string text)
 This method does variable value injection, replacing all variable references in the specified string with their associated values.
 
object GetVariableValue (string variableName)
 Returns the value of the variable specified, if available; otherwise returns null.
 
void SetVariableValue (string variableName, object variableValue)
 Sets the value of the specified variable.
 
NodeVariable GetVariable (string variableName)
 Returns the NodeVariable associated with the specified variable name.
 
EntryNode FindEntryNode ()
 Finds and returns the first 'entry' node in the Dialogue.
 
void EnterDialogue (string entryPointName=null)
 Enters and begins processing the Dialogue. If no entry point is specified, the Dialogue will enter at the first 'entry' node found in the Dialogue.
 
void Continue ()
 Continues along to the next line of dialogue, or the next node if the last line is currently being displayed.
 
void ResetVariablesOnEntry ()
 Resets the values of each variable which is set to "reset on entry".
 
void SaveVariableValues (string prefix="", bool saveToPlayerPrefs=false)
 Saves the values of all local variables in the Dialogue to either a file, or to the PlayerPrefs.
 
void SaveGlobalVariableValues (string prefix="", bool saveToPlayerPrefs=false)
 Saves global variable values to PlayerPrefs or a JSON file.
 
void LoadVariableValues (string prefix="", bool loadFromPlayerPrefs=false)
 Loads variable values for the dialogue from a save if available.
 
void LoadGlobalVariableValues (string prefix="", bool loadFromPlayerPrefs=false)
 Loads global variable values from a save if available.
 
NodeVariableValueCollection GetVariableValues ()
 Returns a new NodeVariableValueCollection containing the current values of each variable in the Dialogue.
 
NodeVariableValueCollection GetGlobalVariableValues ()
 Returns a new NodeVariableValueCollection containing the current values of all global dialogue variables.
 
string TranslateText (string text)
 Translates the specified string to a localized string using the TranslationLibrary of the Dialogue.
 
void SetListener (DialogueListener listener)
 Sets the Dialogue Listener which the node handler should send events to during Dialogue processing.
 
void InitializeGlobalVariables (DialogueRegistry registry=null)
 Attempts to initialize all global variables, if they can be found in either the DialogueRegistry provided, or in a DialogueRegistry in the current Dialogue Settings, or in the Dialogue Settings of a Dialogue Display in the Hierarchy.
 

Protected Attributes

Dictionary< int, NodeinputIdToNodeMap = new Dictionary<int, Node>()
 A mapping of node input IDs to the nodes which those inputs belong to.
 
Dictionary< int, NodeoutputIdToNodeMap = new Dictionary<int, Node>()
 A mapping of node output IDs to the nodes which those inputs belong to.
 
Dictionary< string, NodejumpMap = new Dictionary<string, Node>()
 A mapping of jump keys/IDs to the 'jump in' nodes they belong to.
 
Dictionary< string, NodeVariablevariables = new Dictionary<string, NodeVariable>()
 A mapping of variable names to their definitions and values.
 
Dictionary< string, NodeentryMap = new Dictionary<string, Node>()
 A mapping of entry IDs to the 'entry' nodes they belong to.
 
Node entryNode
 The default 'entry' node which is used if an entry ID is not provided, or the 'entry' node with the ID specified can't be found.
 
Node currentNode
 The current node being processed/displayed.
 
int convoIdx = 0
 The line index of the conversation when a 'conversation' node is being processed.
 
GameObject owner = null
 The GameObject this NodeHandler is being used by.
 

Static Protected Attributes

static Dictionary< string, NodeVariableglobalVariables = new Dictionary<string, NodeVariable>()
 A mapping of global variable names to their definitions and values.
 

Properties

DialogueListener Listener [get]
 Gets the Dialogue Listener of the node handler.
 
EasyTalkDialogueSettings DialolgueSettings [get, set]
 Gets or sets the Dialogue Settings used by the node handler.
 

Private Member Functions

void AsyncExecutionCompleted (AsyncNode asyncNode)
 Called whenever asynchronous execution of an AsyncNode has been completed.
 
Node Propagate (Dictionary< int, object > nodeOutputValues, Node node)
 Evaluates the specified node to determine its output value based on its configuration and any incoming values that it depends upon, then pushes the evaluated final value to any nodes connected along the output value path.
 
Node DetermineNodeValue (Dictionary< int, object > nodeOutputValues, Node node)
 Recursively determines the output value of the specified node.
 
ConversationLine GetConversationLine ()
 Builds a ConversationLine object containing information about the current line of dialogue to be displayed. This method handles variable injection, tag extraction, and translation on the text in the 'conversation' node's current line of dialogue.
 
void CreateBoolVariable (Node node)
 Creates a new bool type NodeVariable from the provided bool variable node.
 
void CreateIntVariable (Node node)
 Creates a new int type NodeVariable from the provided int variable node.
 
void CreateFloatVariable (Node node)
 Creates a new float type NodeVariable from the provided float variable node.
 
void CreateStringVariable (Node node)
 Creates a new string type NodeVariable from the provided string variable node.
 
void CreateVariable (Type type, string variableName, object initialValue, object currentValue, bool resetOnEntry, bool isGlobal)
 Creates a variable for use by the node handler. Global variables persist for use by all node handlers.
 
void SaveVariableValues (NodeVariableValueCollection variableValues, string suffix, string prefix="", bool saveToPlayerPrefs=false)
 Saves variable values from the provided NodeVariableValueCollection to PlayerPrefs or a JSON file.
 
NodeVariableValueCollection LoadVariableValueCollection (string suffix, string prefix="", bool loadFromPlayerPrefs=false)
 Loads the states of variables from a save if available.
 
void LoadVariableValues (NodeVariableValueCollection valueCollection)
 Loads the variable values from the specified NodeVariableValueCollection into the Dialogue.
 
void LoadGlobalVariableValues (NodeVariableValueCollection valueCollection)
 Loads the values from the specified NodeVariableValueCollection into the collection of global variables.
 
void LoadVariableValuesFromCollection (NodeVariableValueCollection valueCollection, Dictionary< string, NodeVariable > dialogueVariables)
 Loads the values from the specified NodeVariableValueCollection into the provided Dictionary of variable names mapped to NodeVariable values.
 
NodeVariableValueCollection CreateNodeVariableValueCollection (Dictionary< string, NodeVariable > dialogueVariables)
 Creates and returns a new NodeVariableValueCollection containing the current values of all of the variables in the provided Dictionary.
 
void SaveVariables ()
 
void SaveGlobalVariables ()
 
void LoadVariables ()
 
void LoadGlobalVariables ()
 

Private Attributes

Dialogue dialogue
 The dialogue to process.
 
DialogueListener listener
 The Dialogue Listener to use for callbacks as events happen during dialogue processing.
 
bool isProcessingAsyncNode = false
 Keeps track of whether the node handler is currently processing and waiting for an asynchronous node to finish.
 
bool isWaitingForNodeValueDetermination = false
 Keeps track of whether the node handler waiting for an output value to be determined for the current node.
 
Dictionary< int, object > nodeValues = new Dictionary<int, object>()
 A Dictionary which maps node and output IDs to the values output by the respective components.
 
EasyTalkDialogueSettings dialogueSettings = null
 The Dialogue Settings currently in use.
 
List< Task > tasks = new List<Task>()
 A List of Tasks.
 

Detailed Description

This class is used to process a collection of linked nodes, such as a dialogue and handles all of the logic for moving from one node to the next, evaluating variable values, and sending messages (via callbacks) about what is happening in a dialogue as it is processed.

Constructor & Destructor Documentation

◆ NodeHandler()

EasyTalk.Controller.NodeHandler.NodeHandler ( GameObject owner)

Creates a new NodeHandler.

Parameters
ownerThe GameObject which the NodeHandler is associated with.

Member Function Documentation

◆ AddTask()

void EasyTalk.Controller.NodeHandler.AddTask ( Task task)

Adds a task to the current queue.

Parameters
taskThe Task to add to the queue.

◆ AsyncExecutionCompleted()

void EasyTalk.Controller.NodeHandler.AsyncExecutionCompleted ( AsyncNode asyncNode)
private

Called whenever asynchronous execution of an AsyncNode has been completed.

Parameters
asyncNodeThe AsyncNode which execution completed on.

◆ ChooseOption()

void EasyTalk.Controller.NodeHandler.ChooseOption ( int optionIdx)

Chooses the option, and thus continues down the corresponding path, of the option specified.

Parameters
optionIdxThe option index to choose. This should be the index of the option as it was originally in the 'option' node, which may differ from the index of the option as it occurs in the List of options displayed to the player. It is recommended to use DialogueOption.OptionIndex for reliability.

◆ Continue()

void EasyTalk.Controller.NodeHandler.Continue ( )

Continues along to the next line of dialogue, or the next node if the last line is currently being displayed.

◆ CreateBoolVariable()

void EasyTalk.Controller.NodeHandler.CreateBoolVariable ( Node node)
private

Creates a new bool type NodeVariable from the provided bool variable node.

Parameters
nodeThe node to use.

◆ CreateFloatVariable()

void EasyTalk.Controller.NodeHandler.CreateFloatVariable ( Node node)
private

Creates a new float type NodeVariable from the provided float variable node.

Parameters
nodeThe node to use.

◆ CreateIntVariable()

void EasyTalk.Controller.NodeHandler.CreateIntVariable ( Node node)
private

Creates a new int type NodeVariable from the provided int variable node.

Parameters
nodeThe node to use.

◆ CreateNodeVariableValueCollection()

NodeVariableValueCollection EasyTalk.Controller.NodeHandler.CreateNodeVariableValueCollection ( Dictionary< string, NodeVariable > dialogueVariables)
private

Creates and returns a new NodeVariableValueCollection containing the current values of all of the variables in the provided Dictionary.

Parameters
dialogueVariablesThe variable dictionary to populate from.
Returns
A collection of variable values from the Dictionary provided.

◆ CreateStringVariable()

void EasyTalk.Controller.NodeHandler.CreateStringVariable ( Node node)
private

Creates a new string type NodeVariable from the provided string variable node.

Parameters
nodeThe node to use.

◆ CreateVariable()

void EasyTalk.Controller.NodeHandler.CreateVariable ( Type type,
string variableName,
object initialValue,
object currentValue,
bool resetOnEntry,
bool isGlobal )
private

Creates a variable for use by the node handler. Global variables persist for use by all node handlers.

Parameters
typeThe type of the variable (int, float, string, or bool).
variableNameThe name of the variable.
initialValueThe initial/default value of the variable.
currentValueThe current value of the variable.
resetOnEntryWhether the variable should be reset whenever the dialogue is entered (only applicable for local variables, not global).
isGlobalWhether the variable is global (persists to all dialogues).

◆ DetermineNodeValue()

Node EasyTalk.Controller.NodeHandler.DetermineNodeValue ( Dictionary< int, object > nodeOutputValues,
Node node )
private

Recursively determines the output value of the specified node.

Parameters
nodeOutputValuesA map of node IDs and connection IDs to the output values that those IDs correspond to.
nodeThe node to evaluate.
Returns
If the output values of the node could be determined successfully, this method returns null; otherwise this method returns the node whose value could not be determined (this may differ from the node originally passed into this method, since it could be a dependency node).

◆ DisplayLine()

void EasyTalk.Controller.NodeHandler.DisplayLine ( ConversationLine line)

Queues up a Task to call OnDisplayLine on the node handler's Dialogue Listener. Normally, this will cause a line of dialogue to be displayed.

Parameters
lineThe line of dialogue to queue up.

◆ EnterDialogue()

void EasyTalk.Controller.NodeHandler.EnterDialogue ( string entryPointName = null)

Enters and begins processing the Dialogue. If no entry point is specified, the Dialogue will enter at the first 'entry' node found in the Dialogue.

Parameters
entryPointNameThe optional name of the entry point where the Dialogue should start being processed.

◆ ExecutionCompleted()

void EasyTalk.Controller.NodeHandler.ExecutionCompleted ( AsyncNode asyncNode)

Creates a Task to call AsyncExecutionCompleted on the main thread.

Parameters
asyncNodeThe AsyncNode which has completed execution.

◆ FindEntryNode()

EntryNode EasyTalk.Controller.NodeHandler.FindEntryNode ( )

Finds and returns the first 'entry' node in the Dialogue.

Returns
The first 'entry' node found int the Dialogue.

◆ ForceExit()

void EasyTalk.Controller.NodeHandler.ForceExit ( )

Forces an exit to be triggered immediately on the Dialogue.

◆ GetConversationLine()

ConversationLine EasyTalk.Controller.NodeHandler.GetConversationLine ( )
private

Builds a ConversationLine object containing information about the current line of dialogue to be displayed. This method handles variable injection, tag extraction, and translation on the text in the 'conversation' node's current line of dialogue.

Returns
A ConversationLine containing information about the current line of dialogue to be displayed.

◆ GetGlobalVariableValues()

NodeVariableValueCollection EasyTalk.Controller.NodeHandler.GetGlobalVariableValues ( )

Returns a new NodeVariableValueCollection containing the current values of all global dialogue variables.

Returns
A collection of the current global dialogue variable values.

◆ GetNextNode()

Node EasyTalk.Controller.NodeHandler.GetNextNode ( )

Returns the next node along the Dialogue flow path.

Returns
The next node to be moved to after the current node.

◆ GetVariable()

NodeVariable EasyTalk.Controller.NodeHandler.GetVariable ( string variableName)

Returns the NodeVariable associated with the specified variable name.

Parameters
variableNameThe name of the variable to retrieve.
Returns
The NodeVariable for the specified variable name.

◆ GetVariableValue()

object EasyTalk.Controller.NodeHandler.GetVariableValue ( string variableName)

Returns the value of the variable specified, if available; otherwise returns null.

Parameters
variableNameThe name of the variable to retrieve the value of.
Returns
The value of the specified variable.

◆ GetVariableValues()

NodeVariableValueCollection EasyTalk.Controller.NodeHandler.GetVariableValues ( )

Returns a new NodeVariableValueCollection containing the current values of each variable in the Dialogue.

Returns
A collection of current variable values for the Dialogue.

◆ HandleConversation()

void EasyTalk.Controller.NodeHandler.HandleConversation ( )

Handles the current 'conversation' node, sending a signal via the onDisplayConversationLine callback to display the first line in the 'conversation' node. If the 'conversation' node only has 1 line, the atConversationNodeEnding callback will also be triggered.

◆ HandleExit()

void EasyTalk.Controller.NodeHandler.HandleExit ( )

Handles the current 'exit' node by exiting the dialogue and triggering the onDialogueExited callback.

◆ HandleJump()

void EasyTalk.Controller.NodeHandler.HandleJump ( )

Handles the 'jump out' node by finding the associated 'jump in' node and moving to the next node after the 'jump in'.

◆ HandleOptionNode()

void EasyTalk.Controller.NodeHandler.HandleOptionNode ( )

Builds a List of DialogueOptions to present to the player based on the current 'option' node. This method handles 'option modifier' nodes and also deals with variable injection, translation, and tag extraction. Once the List of DialogueOptions is created, this method calls the onDisplayOptions callback so that the options can be used by anything registered with the delegate.

◆ HandlePathSelectorNode()

void EasyTalk.Controller.NodeHandler.HandlePathSelectorNode ( )

Evaluates the current 'path select' node to determine which path to continue down and the moves along that path.

◆ HandlePauseNode()

void EasyTalk.Controller.NodeHandler.HandlePauseNode ( )

Triggers the OnPause() callback on the Dialogue Listener and waits for a continue.

◆ HandleStoryNode()

void EasyTalk.Controller.NodeHandler.HandleStoryNode ( )

Triggers the OnStory() callback on the Dialogue Listener and waits for a continue.

◆ HandleWaitNode()

void EasyTalk.Controller.NodeHandler.HandleWaitNode ( )

Waits for the configured duration of the wait node currently being processed before continuing.

◆ Initialize()

void EasyTalk.Controller.NodeHandler.Initialize ( Dialogue dialogue)

Initializes the NodeHandler by setting the dialogue, clearing various mappings, determining the default 'entry' node, and creating variables.

Parameters
dialogueThe Dialogue to use.

◆ InitializeGlobalVariables()

void EasyTalk.Controller.NodeHandler.InitializeGlobalVariables ( DialogueRegistry registry = null)

Attempts to initialize all global variables, if they can be found in either the DialogueRegistry provided, or in a DialogueRegistry in the current Dialogue Settings, or in the Dialogue Settings of a Dialogue Display in the Hierarchy.

Parameters
registryA Dialogue Registry to initialize global variables from.

◆ JumpToNodeAfterDelay()

IEnumerator EasyTalk.Controller.NodeHandler.JumpToNodeAfterDelay ( float delay,
Node node )

Jumps to the specified node after a certain amount of time.

Parameters
delayThe delay, in seconds.
nodeThe node to jump to.
Returns

◆ LoadGlobalVariables()

void EasyTalk.Controller.NodeHandler.LoadGlobalVariables ( )
private

◆ LoadGlobalVariableValues() [1/2]

void EasyTalk.Controller.NodeHandler.LoadGlobalVariableValues ( NodeVariableValueCollection valueCollection)
private

Loads the values from the specified NodeVariableValueCollection into the collection of global variables.

Parameters
valueCollectionThe collection of global variable values to load.

◆ LoadGlobalVariableValues() [2/2]

void EasyTalk.Controller.NodeHandler.LoadGlobalVariableValues ( string prefix = "",
bool loadFromPlayerPrefs = false )

Loads global variable values from a save if available.

Parameters
prefixThe prefix to use when loading. This prefix is appended to '_global' or '_global.json', depending on whether values are to be loaded from player prefs or a JSON file.
loadFromPlayerPrefsIf true, variable states will be loaded from PlayerPrefs rather than a JSON file.

◆ LoadVariables()

void EasyTalk.Controller.NodeHandler.LoadVariables ( )
private

◆ LoadVariableValueCollection()

NodeVariableValueCollection EasyTalk.Controller.NodeHandler.LoadVariableValueCollection ( string suffix,
string prefix = "",
bool loadFromPlayerPrefs = false )
private

Loads the states of variables from a save if available.

Parameters
suffixThe suffix to use when loading the values.
prefixThe prefix to use when loading the values.
loadFromPlayerPrefsIf true, variable states will be loaded from PlayerPrefs rather than a JSON file.

◆ LoadVariableValues() [1/2]

void EasyTalk.Controller.NodeHandler.LoadVariableValues ( NodeVariableValueCollection valueCollection)
private

Loads the variable values from the specified NodeVariableValueCollection into the Dialogue.

Parameters
valueCollectionThe collection of node variable values to load.

◆ LoadVariableValues() [2/2]

void EasyTalk.Controller.NodeHandler.LoadVariableValues ( string prefix = "",
bool loadFromPlayerPrefs = false )

Loads variable values for the dialogue from a save if available.

Parameters
prefixThe prefix to use when loading. This prefix is appended to ('_' + the dialogue name) or )'_' + the dialogue name + '.json'), depending on whether values are to be loaded from PlayerPrefs or a JSON file.
loadFromPlayerPrefs

◆ LoadVariableValuesFromCollection()

void EasyTalk.Controller.NodeHandler.LoadVariableValuesFromCollection ( NodeVariableValueCollection valueCollection,
Dictionary< string, NodeVariable > dialogueVariables )
private

Loads the values from the specified NodeVariableValueCollection into the provided Dictionary of variable names mapped to NodeVariable values.

Parameters
valueCollectionThe collection of variable values to load.
dialogueVariablesThe Dictionary to load variables into.

◆ ProcessCurrentNode()

void EasyTalk.Controller.NodeHandler.ProcessCurrentNode ( )

Processes the current node, determining any dependent values used by the node and setting values as necessary on outputs. Once the node is processed, the next node will be determined and processed.

◆ ProcessNode()

void EasyTalk.Controller.NodeHandler.ProcessNode ( Node node)

Processes the node specified according to its type.

Parameters
nodeThe node to process.

◆ Propagate()

Node EasyTalk.Controller.NodeHandler.Propagate ( Dictionary< int, object > nodeOutputValues,
Node node )
private

Evaluates the specified node to determine its output value based on its configuration and any incoming values that it depends upon, then pushes the evaluated final value to any nodes connected along the output value path.

Parameters
nodeOutputValuesA map of node IDs and connection IDs to the output values that those IDs correspond to.
nodeThe node to evaluate.
Returns

◆ ReplaceVariablesInString()

string EasyTalk.Controller.NodeHandler.ReplaceVariablesInString ( string text)

This method does variable value injection, replacing all variable references in the specified string with their associated values.

Parameters
textThe string to inject variable values into.
Returns
The modified string with variable references replaced by their respective values.

◆ ResetVariablesOnEntry()

void EasyTalk.Controller.NodeHandler.ResetVariablesOnEntry ( )

Resets the values of each variable which is set to "reset on entry".

◆ SaveGlobalVariables()

void EasyTalk.Controller.NodeHandler.SaveGlobalVariables ( )
private

◆ SaveGlobalVariableValues()

void EasyTalk.Controller.NodeHandler.SaveGlobalVariableValues ( string prefix = "",
bool saveToPlayerPrefs = false )

Saves global variable values to PlayerPrefs or a JSON file.

Parameters
prefixThe prefix to use when saving. The prefix is appended before '_global' or '_global.json'.
saveToPlayerPrefsWhether variable values should be saved to PlayerPrefs rather than a JSON file.

◆ SaveVariables()

void EasyTalk.Controller.NodeHandler.SaveVariables ( )
private

◆ SaveVariableValues() [1/2]

void EasyTalk.Controller.NodeHandler.SaveVariableValues ( NodeVariableValueCollection variableValues,
string suffix,
string prefix = "",
bool saveToPlayerPrefs = false )
private

Saves variable values from the provided NodeVariableValueCollection to PlayerPrefs or a JSON file.

Parameters
variableValuesThe collection of variable values to save.
suffixThe suffix to use when saving the values.
prefixThe prefix to use when saving the values.
saveToPlayerPrefsWhether the values should be saved to PlayerPrefs rather than a JSON file.

◆ SaveVariableValues() [2/2]

void EasyTalk.Controller.NodeHandler.SaveVariableValues ( string prefix = "",
bool saveToPlayerPrefs = false )

Saves the values of all local variables in the Dialogue to either a file, or to the PlayerPrefs.

Parameters
prefixThe prefix to use when saving. This prefix is appended to the beginning of the dialogue name.
saveToPlayerPrefsWhether the variable states should be saved to PlayerPrefs. If set to false, the variable states will be saved to a JSON file instead.

◆ SetListener()

void EasyTalk.Controller.NodeHandler.SetListener ( DialogueListener listener)

Sets the Dialogue Listener which the node handler should send events to during Dialogue processing.

Parameters
listenerThe Dialogue Listener to use.

◆ SetVariableValue()

void EasyTalk.Controller.NodeHandler.SetVariableValue ( string variableName,
object variableValue )

Sets the value of the specified variable.

Parameters
variableNameThe name of the variable to set.
variableValueThe value to set on the variable.

◆ Translate() [1/2]

string EasyTalk.Controller.NodeHandler.Translate ( string text)

Performs a lookup in the active Translation Library for the text provided and returns a translation, if there is one. The text is attempted to be translated into whatever langauge is set on EasyTalkGameState.Instance.Language.

Parameters
textThe text to translate.
Returns
A translation of the provided text, if there is a match in the current Translation Library.

◆ Translate() [2/2]

string EasyTalk.Controller.NodeHandler.Translate ( string text,
out string preTranslationText )

Performs a lookup in the active Translation Library for the text provided and returns a translation, if there is one. The text is attempted to be translated into whatever langauge is set on EasyTalkGameState.Instance.Language. This method also sets the provided preTranslationText string to the string being translated, immediately prior to translation. The preTranslationText may differ from the originally provided text if the EasyTalkDialogueSettings.Instance.TranslationEvaluationMode is set to TRANSLATE_AFTER_VARIABLE_EVALUATION, since in that mode, all variable tags are replaced with their values prior to translation.

Parameters
textThe text to translate.
preTranslationTextA string to store the text value which was translated in. This value is the text which is ultimately translated and may differ from the provided text string.
Returns
A translation of the provided text, if there is a match in the current Translation Library.

◆ TranslateText()

string EasyTalk.Controller.NodeHandler.TranslateText ( string text)

Translates the specified string to a localized string using the TranslationLibrary of the Dialogue.

Parameters
textThe line of text to translate.
Returns
The translated text, if a translation is found that matches the text provided.

◆ Update()

void EasyTalk.Controller.NodeHandler.Update ( )

Called by Dialogue Controllers to run queued up Tasks.

Member Data Documentation

◆ convoIdx

int EasyTalk.Controller.NodeHandler.convoIdx = 0
protected

The line index of the conversation when a 'conversation' node is being processed.

◆ currentNode

Node EasyTalk.Controller.NodeHandler.currentNode
protected

The current node being processed/displayed.

◆ dialogue

Dialogue EasyTalk.Controller.NodeHandler.dialogue
private

The dialogue to process.

◆ dialogueSettings

EasyTalkDialogueSettings EasyTalk.Controller.NodeHandler.dialogueSettings = null
private

The Dialogue Settings currently in use.

◆ entryMap

Dictionary<string, Node> EasyTalk.Controller.NodeHandler.entryMap = new Dictionary<string, Node>()
protected

A mapping of entry IDs to the 'entry' nodes they belong to.

◆ entryNode

Node EasyTalk.Controller.NodeHandler.entryNode
protected

The default 'entry' node which is used if an entry ID is not provided, or the 'entry' node with the ID specified can't be found.

◆ globalVariables

Dictionary<string, NodeVariable> EasyTalk.Controller.NodeHandler.globalVariables = new Dictionary<string, NodeVariable>()
staticprotected

A mapping of global variable names to their definitions and values.

◆ inputIdToNodeMap

Dictionary<int, Node> EasyTalk.Controller.NodeHandler.inputIdToNodeMap = new Dictionary<int, Node>()
protected

A mapping of node input IDs to the nodes which those inputs belong to.

◆ isProcessingAsyncNode

bool EasyTalk.Controller.NodeHandler.isProcessingAsyncNode = false
private

Keeps track of whether the node handler is currently processing and waiting for an asynchronous node to finish.

◆ isWaitingForNodeValueDetermination

bool EasyTalk.Controller.NodeHandler.isWaitingForNodeValueDetermination = false
private

Keeps track of whether the node handler waiting for an output value to be determined for the current node.

◆ jumpMap

Dictionary<string, Node> EasyTalk.Controller.NodeHandler.jumpMap = new Dictionary<string, Node>()
protected

A mapping of jump keys/IDs to the 'jump in' nodes they belong to.

◆ listener

DialogueListener EasyTalk.Controller.NodeHandler.listener
private

The Dialogue Listener to use for callbacks as events happen during dialogue processing.

◆ nodeValues

Dictionary<int, object> EasyTalk.Controller.NodeHandler.nodeValues = new Dictionary<int, object>()
private

A Dictionary which maps node and output IDs to the values output by the respective components.

◆ outputIdToNodeMap

Dictionary<int, Node> EasyTalk.Controller.NodeHandler.outputIdToNodeMap = new Dictionary<int, Node>()
protected

A mapping of node output IDs to the nodes which those inputs belong to.

◆ owner

GameObject EasyTalk.Controller.NodeHandler.owner = null
protected

The GameObject this NodeHandler is being used by.

◆ tasks

List<Task> EasyTalk.Controller.NodeHandler.tasks = new List<Task>()
private

A List of Tasks.

◆ variables

Dictionary<string, NodeVariable> EasyTalk.Controller.NodeHandler.variables = new Dictionary<string, NodeVariable>()
protected

A mapping of variable names to their definitions and values.

Property Documentation

◆ DialolgueSettings

EasyTalkDialogueSettings EasyTalk.Controller.NodeHandler.DialolgueSettings
getset

Gets or sets the Dialogue Settings used by the node handler.

◆ Listener

DialogueListener EasyTalk.Controller.NodeHandler.Listener
get

Gets the Dialogue Listener of the node handler.