pub struct Story {
pub asset_id: AssetId,
pub title: String,
pub nodes: Vec<StoryNode>,
pub text_speed: f32,
pub scaffold: StoryScaffold,
pub save_key: String,
}Expand description
A compiled branching story graph, played at runtime by the story system.
A Story is normally produced by a StoryImport expansion
at build time rather than written by hand: the Markdown source compiles
into this graph plus the stage scaffolding (a single dialogue
Screen whose labels and sprites the story system mutates page by
page). All references are pre-resolved: dialog text is pre-wrapped,
speakers carry their display name and color, stage images carry their
on-canvas rectangle, and jump / choice targets are node indices into
nodes.
The story system reads the graph and drives the stage screen named
<name>_stage: it fills the dialogue and name-plate labels (revealing
text at text_speed), swaps the backdrop and portrait sprite textures,
shows the choice menu when a node ends in one, and plays page audio.
Clicking the stage (or pressing Space) advances; story:start restarts
from the first node.
Fields§
§asset_id: AssetIdAsset identity; injected via inject_name. Not part of args.
title: StringThe story title, as shown on the generated title screen.
nodes: Vec<StoryNode>The node graph in document order. Play starts at the first node; a node whose last page has no jump and no choices falls through to the next node, and the last node ends the story.
text_speed: f32Dialogue reveal speed in characters per second. 0 shows each page
instantly.
scaffold: StoryScaffoldThe generated stage assets the story system drives. All references are resolved to ids at build time, like every other cross-reference.
save_key: StringStable key naming this story’s save file (position + flags, auto-saved page by page under the project data directory). Empty disables saving.
Trait Implementations§
Source§impl Component for Story
impl Component for Story
Source§fn inject_name(&mut self, id: AssetId)
fn inject_name(&mut self, id: AssetId)
Source§fn from_baked(bytes: &[u8]) -> Result<Story, CnResult>
fn from_baked(bytes: &[u8]) -> Result<Story, CnResult>
Source§fn inject_locator(&mut self, _locator: PayloadLocator)
fn inject_locator(&mut self, _locator: PayloadLocator)
Source§impl ComponentSlot for Story
impl ComponentSlot for Story
Source§const DISCRIMINANT: u8
const DISCRIMINANT: u8
ComponentId.Source§impl<'de> Deserialize<'de> for Story
impl<'de> Deserialize<'de> for Story
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Story, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Story, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl From<Story> for ComponentAsset
impl From<Story> for ComponentAsset
Source§fn from(c: Story) -> ComponentAsset
fn from(c: Story) -> ComponentAsset
impl RuntimeComponent for Story
Source§impl Serialize for Story
impl Serialize for Story
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Auto Trait Implementations§
impl Freeze for Story
impl RefUnwindSafe for Story
impl Send for Story
impl Sync for Story
impl Unpin for Story
impl UnsafeUnpin for Story
impl UnwindSafe for Story
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
impl<S, T> Duplex<S> for Twhere
T: FromSample<S> + ToSample<S>,
Source§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
fn into_sample(self) -> T
Source§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian().