narraleaf-react
Version:
A React visual novel player framework
48 lines (47 loc) • 1.47 kB
TypeScript
import { Sound } from "../elements/sound";
import { Image } from "../elements/displayable/image";
import { Story } from "../common/core";
import { StaticImageData } from "../types";
import { LogicAction } from "../action/logicAction";
export type SrcType = "image" | "video" | "audio";
export type Src = {
type: "image";
src: Image | string;
} | {
type: "video";
src: string;
} | {
type: "audio";
src: Sound;
};
export type ActiveSrc<T extends "scene" | "once" = "scene" | "once"> = Src & {
activeType: T;
};
export declare class SrcManager {
static SrcTypes: {
[key in SrcType]: key;
};
static catSrc(src: Src[]): {
image: (Image | string)[];
video: string[];
audio: Sound[];
};
static getSrc(src: Src | string | Image): string | null;
static getPreloadableSrc(story: Story, action: LogicAction.Actions): (Src & {
activeType: "scene" | "once";
}) | null;
src: Src[];
future: SrcManager[];
register(src: Src): this;
register(src: Src[]): this;
register(src: Sound): this;
register(src: Image | StaticImageData): this;
register(type: SrcType, src: Src["src"]): this;
registerRawSrc(src: string): this;
isSrcRegistered(src: string | Sound | Image | null): boolean;
getSrc(): Src[];
getSrcByType(type: SrcType): Src[];
registerFuture(srcManager: SrcManager): this;
hasFuture(s: SrcManager): boolean;
getFutureSrc(): Src[];
}