Dialogue
public class Dialogue : ISmartVariableEvaluator, IDialogueResponderInherits from System.Object
Implements Yarn.ISmartVariableEvaluator, Yarn.IDialogueResponder
Yarn.VirtualMachine and provides a nicer interface into manipulating the vm from the perspective of dialogue instead of a stack machine.#Constructors
#Dialogue(IVariableStorage)
public Dialogue(IVariableStorage variableStorage)Parameters
variableStorageYarn.IVariableStorageThe varstore for this dialogue
Exceptions
System.ArgumentNullExceptionIf the variable storage is null there is no way to create an a dialogue object
#Fields
#NoOptionSelected
public const int NoOptionSelected = -1;Type Int32
#Properties
#ContentSaliencyStrategy
public Saliency.IContentSaliencyStrategy ContentSaliencyStrategy { get; set; }#CurrentNode
public string? CurrentNode { get; }Type String
#IsActive
public bool IsActive { get }Type Boolean
#LogDebugMessage
public Logger? LogDebugMessage { get; set; }Type Logger
#LogErrorMessage
public Logger? LogErrorMessage { get; set; }Type Logger
#NodeNames
public IEnumerable<string> NodeNames { get; }Type IEnumerable
#Program
#Responder
public IDialogueResponder? Responder { get; set; }Type IDialogueResponder
#VariableStorage
public IVariableStorage VariableStorage { get; set; }Type IVariableStorage
#Methods
#CanCallFunction(string)
public bool CanCallFunction(string functionName)Parameters
functionNamestringthe name of the function
Returns Boolean: true if the responder can handle the function
#GetHeaders(string)
public IEnumerable<KeyValuePair<string, string>> GetHeaders(string nodeName)Parameters
nodeNamestringThe node whos headers you covet
Returns IEnumerable: The collection of headers as key-value pairs
Exceptions
System.InvalidOperationExceptionThrows if there is no program set
#GetHeaderValue(string, string)
public string? GetHeaderValue(string nodeName, string headerName)Parameters
nodeNamestringThe node whos header you covetheaderNamestringThe header upon the requested node
Returns String: The value of the requested header on the requested node, or null if either the node or header doesn't exist
Exceptions
System.InvalidOperationExceptionThrows if there is no program set
#GetNodeVisitCount(string)
public float GetNodeVisitCount(string nodeName)Parameters
nodeNamestringthe node whos visitation count you are cirous about
Returns Single: 0 if the node has never been visited, otherwise the number of times the node has been visited
See also
#GetSaliencyOptionsForNodeGroup(string)
public IEnumerable<Saliency.ContentSaliencyOption> GetSaliencyOptionsForNodeGroup(string nodeGroup)Parameters
nodeGroupstringThe node group you want the salient content from
Returns IEnumerable: Collection of salient content inside the node group, may be a single item if the requested nodegroup is just a single node
Exceptions
System.ArgumentExceptionIf the requested nodegroup isn't a node
#HandleCommand(Command, CancellationToken)
public ValueTask HandleCommand(Command command, CancellationToken token)Parameters
commandYarn.CommandThe command encounteredtokenSystem.Threading.CancellationTokenThe cancellation token for this task
Returns ValueTask
#HandleDialogueComplete()
public ValueTask HandleDialogueComplete()Returns ValueTask
#HandleLine(Line, CancellationToken)
public ValueTask HandleLine(Line line, CancellationToken token)Parameters
lineYarn.LineThe line encounteredtokenSystem.Threading.CancellationTokenThe cancellation token for this task
Returns ValueTask
#HandleNodeComplete(string, CancellationToken)
public ValueTask HandleNodeComplete(string node, CancellationToken token)Parameters
nodestringThe name of the node exitedtokenSystem.Threading.CancellationTokenThe cancellation token for this task
Returns ValueTask
#HandleNodeStart(string, CancellationToken)
public ValueTask HandleNodeStart(string node, CancellationToken token)Parameters
nodestringThe name of the node enteredtokenSystem.Threading.CancellationTokenThe cancellation token for this task
Returns ValueTask
#HandleOptions(OptionSet, CancellationToken)
public ValueTask<int> HandleOptions(OptionSet options, CancellationToken token)Parameters
optionsYarn.OptionSetThe collection of options for the responder to use in it's selectiontokenSystem.Threading.CancellationTokenThe cancellation token for this task
Returns ValueTask: The id of the selected option
#HasAnyContent(string)
public bool HasAnyContent(string nodeGroup)Parameters
nodeGroupstringThe node group to check for content
Returns Boolean: True if there is content to show, false otherwise
- the requested node is not a node or nodegroup
- the node group has no elements
- the node group has been fully exhausted according to the ContentSaliencyStrategy
- there is only failing content according to the ContentSaliencyStrategy
#InvokeFunction(string, IConvertible[], CancellationToken)
public ValueTask<IConvertible> InvokeFunction(string functionName, IConvertible[] parameters, CancellationToken token)Parameters
functionNamestringthe name of the functionparametersSystem.IConvertible[]The collection of parameters for this function, the order is the order they were on the stacktokenSystem.Threading.CancellationTokenThe cancellation token for this task
Returns ValueTask: The result of the function
#IsNodeGroup(string)
public bool IsNodeGroup(string nodeName)Parameters
nodeNamestringThe node whos node groupedipidty you are curious about
Returns Boolean: true if the requested node is part of a node group
Exceptions
System.InvalidOperationExceptionThrows if there is no program set
#IsNodeVisited(string)
public bool IsNodeVisited(string nodeName)Parameters
nodeNamestringThe node whos visitation you are curious about
Returns Boolean: True if the node has been visited at least once
See also
#NodeExists(string)
public bool NodeExists(string nodeName)Parameters
nodeNamestringthe node whos existence you are curious about
Returns Boolean: True if the node exists, false otherwise
#PrepareForLines(List<string>, CancellationToken)
public ValueTask PrepareForLines(List<string> lineIDs, CancellationToken token)Parameters
lineIDsSystem.Collections.Generic.List<string>The collection of line idstokenSystem.Threading.CancellationTokenThe cancellation token for this task
Returns ValueTask
#SetNode(string, CancellationToken)
public async ValueTask SetNode(string node, CancellationToken cancellationToken = default)Parameters
nodestringthe requested nodecancellationTokenSystem.Threading.CancellationTokenA token that can be used to cancel the set node operation
Returns ValueTask
#Start(CancellationToken)
public async ValueTask Start(CancellationToken cancellationToken = default)Parameters
cancellationTokenSystem.Threading.CancellationToken
Returns ValueTask
Exceptions
System.InvalidOperationExceptionIf there is no node currently set as the entry point this method throws
See also
#StartDialogue(string, CancellationToken)
public async ValueTask StartDialogue(string node, CancellationToken cancellationToken = default)Parameters
nodestringThe node to use as the entry point for the dialoguecancellationTokenSystem.Threading.CancellationTokenAn optional external cancellation source for the dialogue operation.
Returns ValueTask
#Stop()
public async ValueTask Stop()Returns ValueTask
#TryGetSmartVariable<T>(string, T)
public bool TryGetSmartVariable<T>(string name, out T result)Type Parameters
TThe type of the smart varible, must match the type of the variable itself or be convertible to that type
Parameters
namestringThe name of the smart variableresultTthe smart variable itself
Returns Boolean: True if it was possible to retrieve the smart variable
#UnloadAll()
public void UnloadAll()Generated from Yarn Spinner for Unity 3.3.