Pardon our dust! Docs for Yarn Spinner for Unity 3.2 and Yarn Spinner for Godot C# are on docs.yarnspinner.dev (the old docs site). Docs for Yarn Spinner for Unity 3.3 (pre-release, out ASAP), Yarn Spinner for Godot GDScript and Yarn Spinner for Unreal Engine (work in progress) are on /docs/ (the new docs site).

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 IDialogueResponder
Without 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

  • functionNamestring
    the 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

  • The command encountered
  • tokenSystem.Threading.CancellationToken
    The 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

  • The line encountered
  • tokenSystem.Threading.CancellationToken
    The 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

  • nodestring
    The name of the node exited
  • tokenSystem.Threading.CancellationToken
    The 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

  • nodestring
    The name of the node entered
  • tokenSystem.Threading.CancellationToken
    The 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

  • The collection of options for the responder to use in it's selection
  • tokenSystem.Threading.CancellationToken
    The 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

  • functionNamestring
    the name of the function
  • parametersSystem.IConvertible[]
    The collection of parameters for this function, the order is the order they were on the stack
  • tokenSystem.Threading.CancellationToken
    The 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 ids
  • tokenSystem.Threading.CancellationToken
    The cancellation token for this task

Returns ValueTask

Generated from Yarn Spinner for Unity 3.3.