Scene
Interface of @v12-engine/client/app
export interface Scene<A extends object = any> extends SceneRef<A>Something the app shows, one at a time (U2): every scene is this shape, whatever it shows. It draws itself into the element it is given (open) and gives back what takes it away again: going to another scene ends the one shown, a game disposed with everything it holds (its engine, its canvas, its sounds, its listeners), once the next one is ready and has come in over it (SceneOpenContext.hold, SceneTransition). A scene of a game's own (a campaign map, a lobby, a hero draft) is one as it is; a game, a menu and a scene fetched as it opens are ones their makers build (gameScene, menuScene, lazyScene), with more on them
Members
id
readonly id: string;The scene's id, by which goTo, a menu's button and the page's address name it
kind
readonly kind?: SceneKind;What it is, where it cannot be told from it (a scene fetched as it opens): sceneKind tells the rest
name
name: string;Said where it is named (its button, the list, while it loads); the app may give it another after
names
readonly names?: readonly SceneRef<any>[];The scenes it names (its way out, a menu's buttons, the scene it plays): what startApp checks the app has, as it starts (missingScenes). A scene fetched as it opens is given them as it is made, so they are checked before
open
open(element: HTMLElement, context: SceneOpenContext<A>): () => void;Draws the scene into element, as it is opened with context. Gives back what takes it away again, as another scene opens. context.render draws a Solid component there under the app's own (its overlays)
shows
readonly shows?: SceneShows;What of the game it shows, for what opens that elsewhere: the map it plays, the cinematic it is (the editor's Project panel)
transition
transition?: SceneTransition;How it comes in over the scene before (SceneTransition): as the app says when left out
warmFiles
warmFiles?(context: {
args: SceneArgs<A>;
runtime: ClientRuntime;
}): Promise<void>;Fetches the scene's files ahead of its opening, with nothing drawn (app.warm, MenuDef.warm): what the client's game scenes do of themselves. Its code is fetched before: this is for what its code says. What fails here is said and forgotten