import { Sound } from "./sound.ts"; import { SaveFileV1 } from "./saveformat.ts"; export type VNSceneMessage = { type: "message"; text: string; sfx?: Sound; }; export type VNSceneCallback = { type: "callback"; callback: () => void; }; export type VNSceneSaveGameScreen = { type: "saveGameScreen"; file: SaveFileV1 | null; error: string | null; }; export type VNSceneBasisPart = string | VNSceneMessage | VNSceneCallback; export type VNSceneBasis = VNSceneBasisPart[]; export type VNScenePart = | VNSceneMessage | VNSceneCallback | VNSceneSaveGameScreen; export type VNScene = VNScenePart[]; export function compile(basis: VNSceneBasis): VNScene { let out: VNScene = []; for (let item of basis.values()) { if (typeof item == "string") { out.push({ type: "message", text: item, }); } else { out.push(item); } } return out; }