pub struct DialoguePlayer<H: DialogueHooks> { /* private fields */ }Expand description
Plays a scene: each advance moves to the next text
box (speech or narration), applying the portrait and caption steps in
between. At a reply choice it waits for choose, plays
that reply’s reaction, then rejoins the scene after the choice. The
@music lines passed on the way are kept for take_music.
It plays the scene as it is for those present when it starts: the
lines of an @if block whose character isn’t there are no part of it,
read or skipped. The game’s own lines play on its stage as the scene
reaches them (DialogueHooks::direct).
Pure: no drawing, no clock, no sound. Cheap to clone (the scene is
shared), so a copy can be kept as the scene was at a line (a dialogue
log).
Implementations§
Source§impl<H: DialogueHooks> DialoguePlayer<H>
impl<H: DialogueHooks> DialoguePlayer<H>
Sourcepub fn new(scene: &Scene<H::Directive>, hooks: H, present: &Present) -> Self
pub fn new(scene: &Scene<H::Directive>, hooks: H, present: &Present) -> Self
Starts scene as it plays for those present, at its first text
box, with hooks filling its text and playing the game’s lines. A
scene with nothing to say for them is finished at once.
Sourcepub fn stage_mut(&mut self) -> &mut H::Stage
pub fn stage_mut(&mut self) -> &mut H::Stage
What the game’s lines have set so far, for the game to take what it has played from it.
Sourcepub fn scene(&self) -> &Scene<H::Directive>
pub fn scene(&self) -> &Scene<H::Directive>
The scene being played: the one it was started with, as it is for those present.
Sourcepub fn line(&self) -> Option<&LineId>
pub fn line(&self) -> Option<&LineId>
The id of the line in the text box (while a choice is open, of the
line being answered); None once the scene is finished.
Sourcepub fn reply_line(&self, option: usize) -> Option<&LineId>
pub fn reply_line(&self, option: usize) -> Option<&LineId>
The id of reply option of the open choice, if a choice is open and
has it.
Sourcepub fn pending_music(&self) -> Option<&MusicLine>
pub fn pending_music(&self) -> Option<&MusicLine>
The music the scene has asked for and take_music
hasn’t taken yet, without taking it.
Sourcepub fn advance(&mut self)
pub fn advance(&mut self)
Moves to the next text box, applying every portrait, caption and
place step before it. After the last one the scene is finished; advancing a
finished scene does nothing. While a choice is open this does
nothing either: choose a reply.
Sourcepub fn choose(&mut self, option: usize)
pub fn choose(&mut self, option: usize)
Picks reply option of the open choice: plays its reaction, then
the scene after the choice. Does nothing if no choice is open or
there is no such option.
Sourcepub fn skip_to_choice(&mut self)
pub fn skip_to_choice(&mut self)
Advances until a choice is open or the scene is over (skipping a scene stops at each choice).
Sourcepub fn take_music(&mut self) -> Option<MusicLine>
pub fn take_music(&mut self) -> Option<MusicLine>
The music the scene has asked for since the last call: the last
@music line reached, whether the lines before it were read or
skipped. None if no @music line was reached since.
Sourcepub fn is_choosing(&self) -> bool
pub fn is_choosing(&self) -> bool
Whether a reply choice is waiting for choose.
Sourcepub fn is_finished(&self) -> bool
pub fn is_finished(&self) -> bool
Whether every text box has been shown and advanced past.
Trait Implementations§
Source§impl<H: Clone + DialogueHooks> Clone for DialoguePlayer<H>
impl<H: Clone + DialogueHooks> Clone for DialoguePlayer<H>
Source§fn clone(&self) -> DialoguePlayer<H>
fn clone(&self) -> DialoguePlayer<H>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more