mwg API
    Preparing search index...

    Class StorySequence

    The beats of a story screen and where the reader is in them, with no renderer attached - the same split TabbedList keeps, so the advance/back/skip rules are testable without a DOM.

    Music is reported as a signal rather than played: the sequence says what track a beat wants, and the game decides whether to crossfade, loop or ignore it. A beat with no music reports null, so a reader who turns the page to a silent beat gets the previous track stopped.

    import { StorySequence } from '@datamoc/mw_games/two-d/stage';

    const story = new StorySequence([
    { title: 'Prologue', text: 'The war begins.', music: 'intro.ogg' },
    { text: 'And so it went.' },
    ]);
    story.onMusic.add((track) => console.log(track)); // 'intro.ogg', then null
    story.advance();
    console.log(story.done); // true, only one page was left
    Index
    onChange: Signal<StoryBeat> = ...
    onMusic: Signal<string | null> = ...
    • moves to a beat, clamped to the ends; reports the beat and its music either way

      Parameters

      • index: number

      Returns void