UNPKG

@drincs/pixi-vn

Version:

Pixi'VN is a npm package that provides various features for creating visual novels.

120 lines (111 loc) 3.33 kB
import { ChoiceInterface, CharacterInterface, GameStepState } from '@drincs/pixi-vn'; import deepDiff from 'deep-diff'; import { Difference } from 'microdiff'; import { S as StorageElementType } from './StorageElementType-DTGcnkzF.cjs'; type CloseType = "close"; declare const Close: CloseType; /** * is a string containing the name of the label. * It is used to {@link narration.registeredLabels} to get the label class. */ type LabelIdType = string; type LabelRunModeType = "call" | "jump"; interface ChoiceOptionInterface extends Omit<ChoiceInterface, "label" | "type" | "closeCurrentLabel"> { /** * Label Id to be opened when the option is selected */ label: LabelIdType; /** * Type of the label to be opened */ type: LabelRunModeType; } interface CloseChoiceOptionInterface extends Omit<ChoiceInterface, "label" | "type" | "closeCurrentLabel"> { /** * Type of the label to be opened */ type: CloseType; /** * If true, the current label will be closed */ closeCurrentLabel?: boolean; } type StoredChoiceInterface = ChoiceOptionInterface | CloseChoiceOptionInterface; type StoredIndexedChoiceInterface = StoredChoiceInterface & { /** * Is the index of the choice in the menu. It is used to identify the choice when it is selected. */ choiceIndex: number; }; interface DialogueInterface { /** * The text of the dialogue. */ text: string | string[]; /** * The id of the character that is speaking. */ character?: CharacterInterface | string; } type StoredDialogue = Omit<DialogueInterface, "character"> & { character: string | undefined; }; interface HistoryStep { /** * The difference between the previous step and the current step. */ diff?: deepDiff.Diff<GameStepState, GameStepState>[] | Difference[]; /** * The label id of the current step. */ currentLabel?: LabelIdType; /** * The sha1 of the step function. */ stepSha1: string; /** * Equivalent to the narration.stepCounter */ index: number; /** * The data of the step of the label. */ labelStepIndex: number | null; /** * @deprecated */ dialoge?: StoredDialogue; /** * Dialogue to be shown in the game */ dialogue?: StoredDialogue; /** * List of choices asked of the player */ choices?: StoredChoiceInterface[]; /** * List of choices already made by the player */ alreadyMadeChoices?: number[]; /** * The input value of the player */ inputValue?: StorageElementType; /** * The choice made by the player */ choiceIndexMade?: number; /** * If true, the current dialogue will be glued to the previous one. */ isGlued?: boolean; /** * Opened Labels in the current step. */ openedLabels?: OpenedLabel[]; } interface OpenedLabel { label: LabelIdType; currentStepIndex: number; } export { type CloseType as C, type DialogueInterface as D, type HistoryStep as H, type LabelRunModeType as L, type OpenedLabel as O, type StoredChoiceInterface as S, type ChoiceOptionInterface as a, type CloseChoiceOptionInterface as b, type StoredIndexedChoiceInterface as c, Close as d, type LabelIdType as e };