26 lines
553 B
TypeScript
26 lines
553 B
TypeScript
export type VNSceneMessage = {
|
|
type: "message",
|
|
text: string,
|
|
sfx?: string,
|
|
}
|
|
|
|
export type VNSceneBasisPart = string | VNSceneMessage;
|
|
export type VNSceneBasis = VNSceneBasisPart[];
|
|
export type VNScenePart = VNSceneMessage;
|
|
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;
|
|
}
|