narraleaf-react
Version:
A React visual novel player framework
48 lines (47 loc) • 2.81 kB
TypeScript
import { SceneActionContentType, SceneActionTypes } from "../../action/actionTypes";
import type { Scene, SceneDataRaw } from "../../elements/scene";
import { GameState, PlayerStateElementSnapshot } from "../../../player/gameState";
import { Awaitable } from "../../../../util/data";
import type { CalledActionResult } from "../../gameTypes";
import { ContentNode } from "../../action/tree/actionTree";
import { LogicAction } from "../../action/logicAction";
import { TypedAction } from "../../action/actions";
import { Story } from "../../elements/story";
import { ImageTransition } from "../../elements/transition/transitions/image/imageTransition";
import { ActionSearchOptions } from "../../types";
import { ExposedState, ExposedStateType } from "../../../player/type";
import { ImageDataRaw } from "../../elements/displayable/image";
import { ActionExecutionInjection, ExecutedActionResult } from "../action";
type SceneSnapshot = {
state: SceneDataRaw | null;
local: Record<string, any>;
element: PlayerStateElementSnapshot;
background: ImageDataRaw | null;
};
export declare class SceneAction<T extends typeof SceneActionTypes[keyof typeof SceneActionTypes] = typeof SceneActionTypes[keyof typeof SceneActionTypes]> extends TypedAction<SceneActionContentType, T, Scene> {
static ActionTypes: {
readonly action: "scene:action";
readonly init: "scene:init";
readonly exit: "scene:exit";
readonly jumpTo: "scene:jumpTo";
readonly setBackgroundMusic: "scene:setBackgroundMusic";
readonly preUnmount: "scene:preUnmount";
readonly transitionToScene: "scene:transitionToScene";
};
static handleSceneInit(scene: Scene, next: CalledActionResult, state: GameState, awaitable: Awaitable<CalledActionResult, any>): {
type: any;
node: ContentNode<any> | null;
wait?: import("../../gameTypes").StackModelWaiting | null;
} | Awaitable<CalledActionResult, any>;
static initBackgroundMusic(scene: Scene, exposed: ExposedState[ExposedStateType.scene]): void;
static createSceneSnapshot(scene: Scene, state: GameState): SceneSnapshot;
static restoreSceneSnapshot(snapshot: SceneSnapshot, state: GameState): void;
applyTransition(gameState: GameState, transition: ImageTransition, injection: ActionExecutionInjection): Awaitable<CalledActionResult, CalledActionResult>;
exit(state: GameState): void;
executeAction(gameState: GameState, injection: ActionExecutionInjection): ExecutedActionResult;
getFutureActions(story: Story, searchOptions?: ActionSearchOptions): LogicAction.Actions[];
_sceneNotFoundError(sceneId: string): Error;
getSceneName(scene: Scene | string): string;
stringify(story: Story, seen: Set<LogicAction.Actions>, _strict: boolean): string;
}
export {};