Skip to content

EditorPanelApis beta ​

Interface of @v12-engine/editor

ts
export interface EditorPanelApis

What each panel offers the others (panel.provide), by the panel's id: the editor's own, and a game's. A game adds its own by declaration merging, as EditorEvents, so editor.panels.api('td.waves') and panels.when('td.waves') know what the waves panel offers:

ts
declare module '@v12-engine/editor' {
	interface EditorPanelApis {
		'td.waves': { pick(wave: number): void }
	}
}

The editor's own: the Effects panel (fx) shows an effect by its name (reveal); the Assets panel (assets) takes files in (take); the Cinematic panel (cinematic) opens a cinematic and does its actions

Members ​

animation ​

ts
animation: {
        open(what: {
            type?: string;
            src?: string;
            clip?: string;
            apply?: string;
        }): Promise<void>;
        run(action: string, clicked?: boolean): boolean;
    };

The Animation panel: a model's clips as keys on its timeline, previewed on its stage

assets ​

ts
assets: {
        take(files: FileList | readonly File[]): Promise<void>;
    };

The Assets panel: files taken in as if dropped on it, where it is set to put them; one alone is picked after

cinematic ​

ts
cinematic: {
        open(id: string, at?: number): Promise<void>;
        run(action: string, clicked?: boolean): boolean;
        readonly preview: CinematicPreview;
        playInGame(): void;
    };

The Cinematic panel's API: opens a cinematic by id at a time, runs a panel action, and gives the preview

floats ​

ts
floats: {
        reveal(kind: string): void;
    };

The Words panel: a kind of floating words shown, by its name (damage, a game event's id)

fx ​

ts
fx: {
        reveal(name: string): void;
    };

The Effects panel's API: reveal(name) shows an effect of the game by its name

unitHud ​

ts
unitHud: {
        reveal(type: string): void;
    };

The Unit HUD panel: a unit type's HUD shown, by its id (* for the default of every unit)