narraleaf-react
Version:
A React visual novel player framework
46 lines (45 loc) • 1.92 kB
TypeScript
import { LogicAction } from "../action/logicAction";
import { Actionable } from "../action/actionable";
import { Chained, Proxied } from "../action/chain";
import { Sentence, SentencePrompt } from "../elements/character/sentence";
import Actions = LogicAction.Actions;
import { ActionStatements } from "./type";
export type MenuConfig = {};
export type MenuChoice = {
action: ActionStatements;
prompt: SentencePrompt | Sentence;
};
export type Choice = {
action: Actions[];
prompt: Sentence;
};
export type MenuData = {
prompt: Sentence | null;
choices: Choice[];
};
export declare class Menu extends Actionable<any, Menu> {
/**
* Create a menu with a prompt
* @param prompt - The prompt to display to the player
* @returns A new menu
*/
static prompt(prompt: SentencePrompt | Sentence | null | undefined, config?: MenuConfig): Menu;
static choose(arg0: Sentence | MenuChoice | SentencePrompt, arg1?: ActionStatements): Proxied<Menu, Chained<LogicAction.Actions>>;
constructor(prompt: SentencePrompt, config?: MenuConfig);
constructor(prompt: Sentence, config?: MenuConfig);
constructor(prompt: SentencePrompt | Sentence, config: MenuConfig);
constructor(prompt: null, config?: MenuConfig);
constructor(prompt: SentencePrompt | Sentence | null, config: MenuConfig);
/**
* Add a choice to the menu
* @example
* menu.choose("Go left", [
* character.say("I went left")
* ]);
* @chainable
*/
choose(choice: MenuChoice): Proxied<Menu, Chained<LogicAction.Actions>>;
choose(prompt: Sentence, action: ActionStatements): Proxied<Menu, Chained<LogicAction.Actions>>;
choose(prompt: SentencePrompt, action: ActionStatements): Proxied<Menu, Chained<LogicAction.Actions>>;
choose(arg0: Sentence | MenuChoice | SentencePrompt, arg1?: ActionStatements): Proxied<Menu, Chained<LogicAction.Actions>>;
}