Skip to content

CinematicFiles beta ​

Class of @v12-engine/editor

ts
export declare class CinematicFiles

The cinematics of a game as files (cinematics/<id>.json), through editor.files: what is written is a change until the map is saved (Ctrl+S), as every panel's file is. Read with the game's lanes (LaneDef), so that what is wrong in a file is said with its path

Members ​

constructor ​

ts
constructor(files: EditorGameFiles, lanes?: () => readonly LaneDef[]);

Constructs a new instance of the CinematicFiles class

freeId ​

ts
freeId(id: string): Promise<string>;

An id not taken: the one asked, else with a number after it (td.intro-2)

importTracks ​

ts
importTracks(tracks: Record<string, CinematicTrack>): Promise<string[]>;

Brings every track of tracks.json (the model before cinematics) in, each as a cinematic of its name (trackToCinematic), once: a track whose cinematic is there already is left (run again, it makes nothing), and nothing is deleted. Gives back the ids made

list ​

ts
list(): Promise<string[]>;

The ids of the game's cinematics, by name

read ​

ts
read(id: string): Promise<CinematicDef | undefined>;

A cinematic by its id, read and checked: nothing for one that is not there; what is wrong with one, thrown

remove ​

ts
remove(id: string): Promise<void>;

Takes a cinematic's file away

rename ​

ts
rename(def: CinematicDef, id: string): Promise<CinematicDef>;

Gives a cinematic another id: written under the new, the old file taken away. Refused for an id taken

watch ​

ts
watch(id: string, listener: (text: string | undefined) => void): () => void;

Told what a cinematic's file holds each time it changes (here, on disk, in another tab). Gives back what stops it

write ​

ts
write(def: CinematicDef): Promise<void>;

Writes a cinematic to its file (by its id), as writeCinematic has it