EasyTalk API
Loading...
Searching...
No Matches
EasyTalk.Nodes.Variable.NodeVariable Class Reference

The NodeVariable class is used to store information about a dialogue variable, such as its type, name, initial value, and current value. More...

Static Public Member Functions

static string RemoveVariables (string text)
 Strips all variable references from the provided string and returns a new string.
 
static string IndexVariablesNames (string text, Dictionary< string, string > nameReplacementMap)
 Takes each variable in the provided string and replaces it with a numeric variable reference. The nameReplacementMap is populated with the new variable reference names as the keys, and the old variable reference names as the values. This method is useful for translations of text which contain variable references since automatic translation could potentially rename variable references; nameing the variables numerically prevents this and allows the original variable names to be swapped back into the string later.
 
static string ReplaceVariablesNames (string text, Dictionary< string, string > nameReplacementMap)
 Given a string, this method replaces the names of each variable reference in the string with the value attributed to the key of the same name in the provided nameReplacementMap.
 

Public Attributes

Type variableType
 The variable type.
 
string variableName
 The variable name.
 
object initialValue
 The initial value of the variable.
 
object currentValue
 The current value of the variable.
 
bool resetOnEntry
 Whether the variable should be reset to its initial value each time the dialogue is entered.
 

Detailed Description

The NodeVariable class is used to store information about a dialogue variable, such as its type, name, initial value, and current value.

Member Function Documentation

◆ IndexVariablesNames()

static string EasyTalk.Nodes.Variable.NodeVariable.IndexVariablesNames ( string text,
Dictionary< string, string > nameReplacementMap )
static

Takes each variable in the provided string and replaces it with a numeric variable reference. The nameReplacementMap is populated with the new variable reference names as the keys, and the old variable reference names as the values. This method is useful for translations of text which contain variable references since automatic translation could potentially rename variable references; nameing the variables numerically prevents this and allows the original variable names to be swapped back into the string later.

Parameters
textThe string to index variable references for.
nameReplacementMapA Dictionary which maps the new variable reference names to the old names.
Returns
A modified version of the original string with indexed variable references.

◆ RemoveVariables()

static string EasyTalk.Nodes.Variable.NodeVariable.RemoveVariables ( string text)
static

Strips all variable references from the provided string and returns a new string.

Parameters
textThe string to remove variable references from.
Returns
A modified version of the provided string with all references to variables removed.

◆ ReplaceVariablesNames()

static string EasyTalk.Nodes.Variable.NodeVariable.ReplaceVariablesNames ( string text,
Dictionary< string, string > nameReplacementMap )
static

Given a string, this method replaces the names of each variable reference in the string with the value attributed to the key of the same name in the provided nameReplacementMap.

Parameters
textThe string to replace variable name references in.
nameReplacementMapA mapping of current variable names to replacement names.
Returns
A modified version of the original string where the original variable name references have been replaced based upon the values in the nameReplacementMap.

Member Data Documentation

◆ currentValue

object EasyTalk.Nodes.Variable.NodeVariable.currentValue

The current value of the variable.

◆ initialValue

object EasyTalk.Nodes.Variable.NodeVariable.initialValue

The initial value of the variable.

◆ resetOnEntry

bool EasyTalk.Nodes.Variable.NodeVariable.resetOnEntry

Whether the variable should be reset to its initial value each time the dialogue is entered.

◆ variableName

string EasyTalk.Nodes.Variable.NodeVariable.variableName

The variable name.

◆ variableType

Type EasyTalk.Nodes.Variable.NodeVariable.variableType

The variable type.