All files / player-ui/src models.ts

0% Statements 0/0
0% Branches 0/0
0% Functions 0/0
0% Lines 0/0

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 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155                                                                                                                                                                                                                                                                                                                     
import type {
  BeMusicBGAFrame,
  BeMusicBomb,
  BeMusicDOMGameplayFrame,
  BeMusicGameplayRuntime,
  BeMusicLaneFrame,
  BeMusicLongNote,
  BeMusicMeasureLine,
  BeMusicMine,
  BeMusicNote,
  BeMusicRect,
  GaugeHistorySample,
  BeMusicJudgmentTiming,
  LaneRun,
} from '@be-music/player-skin-sdk';
 
export interface BeMusicScoreData {
  readonly exScore: number;
  readonly maximum: number;
  readonly combo: number;
  readonly maxCombo: number;
  readonly rank?: string;
  readonly score: number;
  readonly totalNotes: number;
  readonly judgedNotes: number;
  readonly missCount: number;
  readonly courseCombo?: { combo: number; maxCombo: number };
}
export interface BeMusicJudgmentData {
  readonly perfect: number;
  readonly great: number;
  readonly good: number;
  readonly bad: number;
  readonly poor: number;
  readonly emptyPoor: number;
  readonly fast: number;
  readonly slow: number;
  readonly earlyLate: BeMusicDOMGameplayFrame['state']['earlyLate'];
  readonly lastJudge?: string;
  readonly lastDeltaMs?: number;
}
export interface BeMusicGaugeData {
  readonly value: number;
  readonly label?: string;
  readonly cleared: boolean;
  readonly threshold?: number;
  readonly survival?: boolean;
  readonly history: readonly GaugeHistorySample[];
}
export interface BeMusicTimingData {
  readonly timings: readonly BeMusicJudgmentTiming[];
}
export interface BeMusicSettingsData {
  readonly options: BeMusicDOMGameplayFrame['playOptions'];
  readonly view: BeMusicDOMGameplayFrame['state']['view'];
  readonly runtime: Pick<
    BeMusicGameplayRuntime,
    'greenNumber' | 'visibleMs' | 'minBPM' | 'maxBPM' | 'mainBPM' | 'rulesetLabel' | 'gaugeLabel'
  >;
}
 
/** Lane backgrounds, key beams and held long-note markers, in stage design pixels. */
export interface BeMusicLanesData {
  readonly lanes: readonly BeMusicLaneFrame[];
}
/** Everything that scrolls down the lanes, in stage design pixels. */
export interface BeMusicNotesData {
  readonly notes: readonly BeMusicNote[];
  readonly longNotes: readonly BeMusicLongNote[];
  readonly mines: readonly BeMusicMine[];
  readonly measureLines: readonly BeMusicMeasureLine[];
  /** Play time of the frame, for the marks that move (a held hell charge note's flowing rungs). */
  readonly nowMs?: number;
  /** The playfield's white-key lane width, which every note takes its height from (`resolveNoteHeight`). */
  readonly whiteLaneWidth?: number;
}
/** One play side's lane area with its SUDDEN (top) and HIDDEN (bottom) cover fractions. */
export interface BeMusicLaneCoverArea {
  readonly left: number;
  readonly right: number;
  readonly top: number;
  readonly bottom: number;
  readonly sudden: number;
  readonly hidden: number;
  readonly lift?: number;
}
export interface BeMusicLaneCoversData {
  readonly areas: readonly BeMusicLaneCoverArea[];
}
/** The judge line, drawn once per lane run so it never crosses the gap between double-play sides. */
export interface BeMusicJudgeLineData {
  readonly runs: readonly (LaneRun & { readonly y?: number })[];
  readonly y: number;
}
export interface BeMusicBombsData {
  readonly bombs: readonly BeMusicBomb[];
}
/** One side's judgment word, centered on `x`. `combo` is the count under it when the judgment keeps the combo. */
export interface BeMusicJudgmentWord {
  /** Automated play caption, above the judgment even between hits. */
  readonly mode?: string;
  /** Per-side text baseline when the sides use different LIFT heights. */
  readonly y?: number;
  readonly x: number;
  readonly text: string;
  /** Colour this frame. A PGREAT's GREAT cycles; the other words stay put. */
  readonly color: string;
  readonly combo?: number;
  /** The judge detail above the word: FAST / SLOW or the offset, each in its own colour. */
  readonly details?: readonly BeMusicJudgmentWordDetail[];
}
/** One judge detail of a judgment word: its text and colour. */
export interface BeMusicJudgmentWordDetail {
  readonly text: string;
  readonly color: string;
}
/** The judgment words showing this frame, on the text baseline `y`. */
export interface BeMusicJudgmentDisplayData {
  readonly words: readonly BeMusicJudgmentWord[];
  readonly y: number;
}
/** The BGA layers showing this frame; `shown` is false when the chart has no BGA, leaving the rect empty. */
export interface BeMusicBGAData {
  readonly frame: BeMusicBGAFrame | undefined;
  readonly shown: boolean;
}
/** One canvas component of the playfield: the stage rect it covers and what it draws there. */
export interface BeMusicPlayfieldPart<Data> {
  readonly rect: BeMusicRect;
  readonly data: Data;
}
/** The playfield split into its canvas components, in drawing order. */
export interface BeMusicPlayfieldParts {
  readonly stage: { readonly width: number; readonly height: number };
  readonly bga: BeMusicPlayfieldPart<BeMusicBGAData>;
  readonly lanes: BeMusicPlayfieldPart<BeMusicLanesData>;
  readonly notes: BeMusicPlayfieldPart<BeMusicNotesData>;
  readonly laneCovers: BeMusicPlayfieldPart<BeMusicLaneCoversData>;
  readonly judgeLine: BeMusicPlayfieldPart<BeMusicJudgeLineData>;
  readonly bombs: BeMusicPlayfieldPart<BeMusicBombsData>;
  readonly judgmentDisplay: BeMusicPlayfieldPart<BeMusicJudgmentDisplayData>;
}
/** What the playback controls show: the position and length in chart seconds, and the player's own controls. */
export interface BeMusicPlaybackData {
  readonly currentSeconds: number;
  readonly durationSeconds: number;
  readonly playing: boolean;
  /** Whether the seek bar moves the play now. */
  readonly seekable: boolean;
  /** 0..1. */
  readonly volume: number;
  readonly muted: boolean;
  readonly fullscreen: boolean;
}