IDialogueResponder
The responder is responsible for handling important dialogue events.
This includes all user facing content events (such as lines and options) as well as non-usesr facing events (such as node enters and exits)
public interface IDialogueResponderWithout a responder the VM won't know when to continue along to the next piece of content or how to respond to user input.
The VM will always await the action of it's responder before continuining onwards.
The VM always has the Dialogue as it's default responder but that just logs these events and otherwise forwards the calls onto it's responder on the Responder field.
#Methods
#CanCallFunction(string)
Asks the responder if it can handle the function by this name.
bool CanCallFunction(string functionName);Parameters
functionNamestringthe name of the function
Returns Boolean: true if the responder can handle the function
For the in-built functions the VM will still ask it's responder if it would like to handle them instead allowing for engine specific overrides.
#HandleCommand(Command, CancellationToken)
Requests the responder handle the current command and inform the VM when it is done so.
ValueTask HandleCommand(Command command, CancellationToken token);Parameters
commandYarn.CommandThe command encounteredtokenSystem.Threading.CancellationTokenThe cancellation token for this task
Returns ValueTask
#HandleDialogueComplete()
Informs the responder that dialogue is finishing
ValueTask HandleDialogueComplete();Returns ValueTask
#HandleLine(Line, CancellationToken)
Requests the responder handle the current line and inform the VM when it is done so.
ValueTask HandleLine(Line line, CancellationToken token);Parameters
lineYarn.LineThe line encounteredtokenSystem.Threading.CancellationTokenThe cancellation token for this task
Returns ValueTask
#HandleNodeComplete(string, CancellationToken)
Informs the responder that a node has been exited and the VM will await it's processing of this.
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)
Informs the responder that a node has been entered and the VM will await it's processing of this.
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)
Requests the responder handle the current option group and tell the VM which option was selected.
If NoOptionSelected is returned the option group will be skipped over.
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
#InvokeFunction(string, IConvertible[], CancellationToken)
Asks the responder to run the function, and provides the parameters from the stack and awaits it's completion.
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
#PrepareForLines(List<string>, CancellationToken)
Informs the responder that the following lines are likely soon to be encountered and it should perform any preparation for their presentation.
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
Generated from Yarn Spinner for Unity 3.3.