Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 | /**
* What a play session asks of the view that draws it (`PlaySessionTheme`), and the moments of the play it tells the
* view about (`PlayMoment`). The session draws nothing: the view's timing gates its intro and ending, and the view's
* key-beam fade times the key beams the session keeps. The view's touch lanes come back to the session as `lane`
* intents.
*/
import type { PlayerUICommand, PlayerUISeekJudgment } from '@be-music/player-engine/signals';
import type { Texture } from 'pixi.js';
import type { PlayViewSetting, PlayViewTiming } from '../../view/types.ts';
/**
* A moment of the play the session raises for its view: the scene stages, the exit phases, a judgment, the full combo,
* a gauge move, a bomb and the engine's lane commands. `at` is on the play clock (`PlaySession.playClock`). The scene
* session hands them to the view in its frames (`PlayFrame.events`, `playViewEventFromMoment`).
*/
export type PlayMoment =
| { readonly kind: 'scene-start'; readonly at: number }
| { readonly kind: 'input-start'; readonly at: number }
| { readonly kind: 'load-end'; readonly at: number }
| { readonly kind: 'play-start'; readonly at: number }
| { readonly kind: 'music-end'; readonly at: number }
| { readonly kind: 'exit-fade-out'; readonly at: number }
| { readonly kind: 'exit-close'; readonly at: number }
| {
readonly kind: 'judge';
readonly side: '1P' | '2P';
readonly at: number;
/** The judgment, as the engine named it. */
readonly judge: string;
readonly channel?: string;
/** The signed offset (ms, > 0 late), when the judgment has a timing. */
readonly deltaMs?: number;
/** The running combo after the judgment. */
readonly combo: number;
}
| { readonly kind: 'full-combo'; readonly at: number }
| { readonly kind: 'gauge'; readonly previous: number; readonly next: number; readonly at: number }
| { readonly kind: 'bomb'; readonly channel: string; readonly at: number }
| { readonly kind: 'lane-command'; readonly command: PlayerUICommand }
/**
* The play sought to chart second `seconds`, its gauge `gauge` percent there: what the view showed of the run before
* (its per-judgment timers, lane effects) is void, and `judgments` are the ones the engine rebuilt before `seconds`.
*/
| {
readonly kind: 'seek';
readonly seconds: number;
readonly gauge: number;
readonly judgments: readonly PlayerUISeekJudgment[];
readonly at: number;
}
/** The player's keys changed a view setting (the hi-speed, a lane cover). */
| { readonly kind: 'view-setting'; readonly setting: PlayViewSetting; readonly at: number };
/**
* What a play session asks of the view that draws it: the view's timing (the intro gates, the fade-out, the close), the
* moments it animates against, how long a key beam fades, and the loading and GPU upload only the view can do.
*/
export interface PlaySessionTheme {
/** The view's timing as its skin authors it: when loading counts as done, when the chart starts, the fade and close. */
timing(): PlayViewTiming;
/** Design pixels per beat at hi-speed 1, when the view uses a different canvas scale. */
pixelsPerBeat?(): number | undefined;
/** A moment of the play happened. */
moment(moment: PlayMoment): void;
/** How long `channel`'s key beam fades once its key is up, in ms. */
keyOnFadeMs(channel: string): number;
/**
* Loads the view's own assets once the chart is prepared and before its samples decode (an LR2 skin's images, fonts
* and timer spans); the play waits for it. It should stop early once the play is disposed.
*/
prepareView?(): Promise<void>;
/** Uploads `textures` to the GPU now, so the first frame that draws them does not stall. */
uploadTextures?(textures: Iterable<Texture | undefined>): Promise<void>;
/**
* How the view's hi-speed reads in the replay (`ReplayViewState`): its scale and the lane in beats at hi-speed 1.
* Without it the replay reads the built-in and LR2 scale over the lanes the shared playfield laid out. Either way
* the visible time is taken at the play's main BPM, which the session works out for every family.
*/
replayView?(): PlayReplayViewScale | undefined;
/**
* Whether the view draws the LIFT (the beatoraja play skin raises its judgement line): a replay then shows the
* recorded one. Without it the view draws none, and a replay leaves the play state's LIFT alone.
*/
drawsLift?(): boolean;
}
/** How a view's hi-speed reads in the replay: its scale and the lane in beats at hi-speed 1. */
export interface PlayReplayViewScale {
readonly scale: string;
readonly laneBeats: number;
}
|