Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Method in DialogueViewBase
Called by the DialogueRunner to signal that the dialogue has ended, and no more lines will be delivered.
This method is called after the last piece of content (that is, lines, options or commands) finished running.
This method is a good place to perform tasks like dismissing on-screen dialogue UI (for example, turning off a letterboxing effect, or hiding dialogue UI elements.)
The default implementation of this method does nothing.
Method in DialogueViewBase
Called by the DialogueRunner to signal that a line has been interrupted, and that the Dialogue View should finish presenting its line as quickly as possible.
This method is called when Dialogue Runner wants to interrupt the presentation of the current line, in order to proceed to the next piece of content.
When this method is called, the Dialogue View must finish presenting their line as quickly as it can. Depending on how this Dialogue View presents lines, this can mean different things: for example, a view that plays voice-over audio might stop playback immediately, or fade out playback over a short period of time; a view that displays text a letter at a time might display all of the text at once.
The process of finishing the presentation can take time to complete, but should happen as quickly as possible, because this method is generally called when the user wants to skip the current line.
When the line has finished presenting, the onDialogueLineFinished
method must be called, which indicates to the Dialogue Runner that this line is ready to be dismissed.
When InterruptLine(LocalizedLine,Action) is called, you must not call the completion handler that RunLine(LocalizedLine,Action) has previously received - this completion handler is no longer valid. Call this method's onDialogueLineFinished
instead.
The default implementation of this method immediately calls the onDialogueLineFinished
method (that is, it reports that it has finished presenting the line the moment that it receives it), and otherwise does nothing.
Name | Description |
---|---|
DialogueViewBase.RunLine(LocalizedLine,Action): Called by the DialogueRunner to signal that a line should be displayed to the user.
DialogueViewBase.DismissLine(Action): Called by the DialogueRunner to signal that the view should dismiss its current line from display, and clean up.
Method in
Called by the to signal that a set of options should be displayed to the user.
This method is called when the Dialogue Runner wants to show a collection of options that the user should choose from. Each option is represented by a object, which contains information about the option.
When this method is called, the Dialogue View should display appropriate user interface elements that let the user choose among the options.
After this method is called, the will wait until the onOptionSelected
method is called.
After calling the onOptionSelected
method, the Dialogue View should dismiss whatever options UI it presented. The Dialogue Runner will immediately deliver the next piece of content.
When the Dialogue Runner delivers Options to its Dialogue Views, it expects precisely one of its views to call the onOptionSelected
.
If your scene includes no dialogue views that override , the Dialogue Runner will never be told which option the user selected, and will therefore wait forever.
If your scene includes multiple dialogue views that override , they will all receive a call each time the dialogue system presents options to the player. You must ensure that only one of them calls the onOptionSelected
method.
The default implementation of this method does nothing, and does not call the onOptionSelected
method (that is, it ignores any Options it receives.)
Method in
Called by the to signal that the view should dismiss its current line from display, and clean up.
This method is called when all Dialogue Views attached to a Dialogue Runner report that they have finished presenting this line. When this occurs, the Dialogue Runner calls on all Dialogue Views to tell them to clear their current line from display.
Depending on how the Dialogue View presents lines, "dismissing" a line may mean different things. For example, a Dialogue View that presents on-screen text might fade the text away, or a Dialogue View that presents voice-over dialogue may not need to do anything at all (because audio finished playing when the line finished presenting.)
Dismissing the line can take time, but should ideally be as fast as possible, because the user will be waiting for the next piece of content to appear.
When the line has finished dismissing, this method calls onDismissalComplete to indicate that the dismissal is complete. When all Dialogue Views on a Dialogue Runner have finished dismissing, the Dialogue Runner moves on to the next piece of content.
The default implementation of this method immediately calls the onDismissalComplete
method (that is, it reports that it has finished dismissing the line the moment that it receives it), and otherwise does nothing.
Name | Description |
---|
Class in
Inherits from MonoBehaviour
A MonoBehaviour
that can present lines and options to the user, when it receives them from a .
When the Dialogue Runner encounters content that the user should see - that is, lines or options - it sends that content to all of the dialogue views stored in . The Dialogue Runner then waits until all Dialogue Views have reported that they have finished presenting the content.
To use this class, subclass it, and override its methods. Some of the more common methods you may wish to override are: , , and .
Once you have written your subclass, attach it as a component to a GameObject
, and add this game object to the list of Dialogue Views in your scene's .
Dialogue Views do not need to handle every kind of content that the Dialogue Runner might produce. For example, you might have one Dialogue View that handles Lines, and another that handles Options. The built-in class is an example of this, in that it only handles Lines and does nothing when it receives Options.
You may also have multiple Dialogue Views that handle the same kind of content. For example, you may have a Dialogue View that receives Lines and uses them to play voice-over audio, and a second Dialogue View that also receives Lines and uses them to display on-screen subtitles.
Name | Description |
---|
Method in
Called by the to signal that a line should be displayed to the user.
When this method is called, the Dialogue View should present the line to the user. The content to present is contained within the dialogueLine
parameter, which contains information about the line in the user's current locale.
The value of the dialogueLine
parameter is produced by the Dialogue Runner's .
It's up to the Dialogue View to decide what "presenting" the line may mean; for example, showing on-screen text, or playing voice-over audio.
When the line has finished being presented, this method calls the onDialogueLineFinished
method, which signals to the Dialogue Runner that this Dialogue View has finished presenting the line. When all Dialogue Views have finished presenting the line, the Dialogue Runner calls to signal that the views should get rid of the line.
If you want to create a Dialogue View that waits for user input before continuing, either wait for that input before calling onDialogueLineFinished
, or don't call it at all and instead call to tell the Dialogue Runner to interrupt the line.
The onDialogueLineFinished
method should only be called when finishes its presentation normally. If has been called, you must call the completion handler that it receives, and not the completion handler that has received.
The default implementation of this method immediately calls the onDialogueLineFinished
method (that is, it reports that it has finished presenting the line the moment that it receives it), and otherwise does nothing.
Name | Description |
---|
Method in
Called by the to signal that dialogue has started.
This method is called before any content (that is, lines, options or commands) are delivered.
This method is a good place to perform tasks like preparing on-screen dialogue UI (for example, turning on a letterboxing effect, or making dialogue UI elements visible.)
The default implementation of this method does nothing.
Method in
Called by to signal that the user has requested that the dialogue advance.
When this method is called, the Dialogue View should advance the dialogue. Advancing the dialogue can mean different things, depending on the nature of the dialogue view, and its current state.
In many situations, if the Dialogue View hasn't yet finished presenting its line (that is, the method has been called, but it hasn't yet called its completion handler), it's sufficient to call the method, which tells the Dialogue Runner to interrupt the current line.
'Advancing' the dialogue may not always mean finishing the line's presentation.
For example, in the Legend of Zelda series of games, lines of dialogue are displayed one character at a time in a text box, until the line has finished appearing. At this point, the text box displays a button to continue; when the user presses the primary input button (typically the A
button), the line is dismissed. However, if this button is pressed while the line is still appearing, the rest of the line appears all at once, and the button appears. Finally, if a secondary input button (typically the B
button) is pressed at any point, the line is interrupted, and the dialogue proceeds to the next line immediately.
is designed to give your Dialogue View an opportunity to decide whether it wants to interrupt the entire line for all views, or simply speed up the delivery of this view.
The default implementation of this method does nothing.
Field in
Represents the method that should be called when this view wants the line to be interrupted.
This value is set by the class during initial setup. Do not modify this value yourself.
When this method is called, the Dialogue Runner that has this Dialogue View in its list will call on any view that has not yet finished presenting its line.
A Dialogue View can call this method to signal to the Dialogue Runner that the current line should be interrupted. This is usually done when it receives some input that the user wants to skip to the next line of dialogue.
Name | Description |
---|
Name | Description |
---|
: A MonoBehaviour
that produces s, for use in Dialogue Views.
: The View classes that will present the dialogue to the user.
: Called by the to signal that a line has been interrupted, and that the Dialogue View should finish presenting its line as quickly as possible.
: Called by the to signal that the view should dismiss its current line from display, and clean up.
: Called by the to signal that a set of options should be displayed to the user.
Yarn.Unity.LocalizedLine dialogueLine
The current line that is being presented.
Action
onDialogueLineFinished
The method that should be called after the line has finished being presented.
| The method that should be called when the view has finished dismissing the line. |
The set of options that should be displayed to the user. |
| A method that should be called when the user has made a selection. |
Represents the method that should be called when this view wants the line to be interrupted. |
The content of the line that should be presented to the user. |
| The method that should be called after the line has finished being presented. |
dialogueOptions
Called by the to signal that the dialogue has ended, and no more lines will be delivered.
Called by the to signal that dialogue has started.
Called by the to signal that the view should dismiss its current line from display, and clean up.
Called by the to signal that a line has been interrupted, and that the Dialogue View should finish presenting its line as quickly as possible.
Called by the to signal that a line should be displayed to the user.
Called by the to signal that a set of options should be displayed to the user.
Called by to signal that the user has requested that the dialogue advance.
dialogueLine