diff options
author | 2024-11-21 12:17:44 -0500 | |
---|---|---|
committer | 2024-11-21 12:17:44 -0500 | |
commit | 26e2eddd1efeb0a5fff8ffabebefdae48c4a65dc (patch) | |
tree | 7f0903a6c90fb4e09d2894f55cffd0acbcb51350 /src/actor/events.rs | |
parent | 99c398cc127dbc83480f98fea8c76f7c19d4dce8 (diff) |
Thu Nov 21 12:17:44 PM EST 2024
Diffstat (limited to 'src/actor/events.rs')
-rw-r--r-- | src/actor/events.rs | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/src/actor/events.rs b/src/actor/events.rs new file mode 100644 index 0000000..e24e7f3 --- /dev/null +++ b/src/actor/events.rs @@ -0,0 +1,72 @@ +//! Actor-related events + +use bevy::prelude::*; +use yarnspinner::{core::LineId, runtime::{Command, DialogueOption, Line, OptionId}}; + +/// Event called by user to progress dialogue +#[derive(Debug, Event)] +pub enum ContinueDialogueEvent { + /// Continue to next line of dialogue for given actor entity + Continue(Entity), + /// Submit option selection to given actor entity + SelectedOption { + /// Target actor entity + actor: Entity, + /// Selected option ID + option: OptionId + }, +} + +/// Event called by plugin in response to a corresponding yarnspinner dialogue events +/// +/// The user should catch these events to update UI, and never call it directly. +#[derive(Event)] +pub enum DialogueEvent { + /// Recieved new line of dialogue + Line { + /// Actor entity + actor: Entity, + /// Line of dialogue received + line: Line, + }, + /// Dialogue complete + DialogueComplete { + /// Actor entity + actor: Entity, + }, + /// Encountered an option selection + Options { + /// Actor entity + actor: Entity, + /// Options to select from + options: Vec<DialogueOption>, + }, + /// Triggered a yarnspinner command + Command { + /// Actor entity + actor: Entity, + /// Triggered command + command: Command, + }, + /// Node started + NodeStart { + /// Actor entity + actor: Entity, + /// Name of started node + name: String, + }, + /// Node complete + NodeComplete { + /// Actor entity + actor: Entity, + /// Name of completed node + name: String, + }, + /// Received line hints + LineHints { + /// Actor entity + actor: Entity, + /// Lines affected + lines: Vec<LineId>, + }, +} |