@drincs/pixi-vn 0.5.9 → 0.5.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/dist/classes/CharacterBaseModel.js.map +1 -1
  2. package/dist/classes/CharacterBaseModel.mjs.map +1 -1
  3. package/dist/classes/ChoiceMenuOption.js.map +1 -1
  4. package/dist/classes/ChoiceMenuOption.mjs.map +1 -1
  5. package/dist/classes/StoredClassModel.js.map +1 -1
  6. package/dist/classes/StoredClassModel.mjs.map +1 -1
  7. package/dist/classes/index.js.map +1 -1
  8. package/dist/classes/index.mjs.map +1 -1
  9. package/dist/classes/ticker/TickerFadeAlpha.js.map +1 -1
  10. package/dist/classes/ticker/TickerFadeAlpha.mjs.map +1 -1
  11. package/dist/classes/ticker/TickerMove.js.map +1 -1
  12. package/dist/classes/ticker/TickerMove.mjs.map +1 -1
  13. package/dist/classes/ticker/TickerRotate.js.map +1 -1
  14. package/dist/classes/ticker/TickerRotate.mjs.map +1 -1
  15. package/dist/classes/ticker/index.js.map +1 -1
  16. package/dist/classes/ticker/index.mjs.map +1 -1
  17. package/dist/decorators/LabelDecorator.js.map +1 -1
  18. package/dist/decorators/LabelDecorator.mjs.map +1 -1
  19. package/dist/decorators/index.js.map +1 -1
  20. package/dist/decorators/index.mjs.map +1 -1
  21. package/dist/functions/DialogueUtility.js +1 -1
  22. package/dist/functions/DialogueUtility.js.map +1 -1
  23. package/dist/functions/DialogueUtility.mjs +1 -1
  24. package/dist/functions/DialogueUtility.mjs.map +1 -1
  25. package/dist/functions/FlagsUtility.js.map +1 -1
  26. package/dist/functions/FlagsUtility.mjs.map +1 -1
  27. package/dist/functions/GameUtility.js.map +1 -1
  28. package/dist/functions/GameUtility.mjs.map +1 -1
  29. package/dist/functions/ImageUtility.js.map +1 -1
  30. package/dist/functions/ImageUtility.mjs.map +1 -1
  31. package/dist/functions/SavesUtility.js +1 -1
  32. package/dist/functions/SavesUtility.js.map +1 -1
  33. package/dist/functions/SavesUtility.mjs +1 -1
  34. package/dist/functions/SavesUtility.mjs.map +1 -1
  35. package/dist/functions/index.js +1 -1
  36. package/dist/functions/index.js.map +1 -1
  37. package/dist/functions/index.mjs +1 -1
  38. package/dist/functions/index.mjs.map +1 -1
  39. package/dist/index.js +1 -1
  40. package/dist/index.js.map +1 -1
  41. package/dist/index.mjs +1 -1
  42. package/dist/index.mjs.map +1 -1
  43. package/dist/managers/StepManager.js +1 -1
  44. package/dist/managers/StepManager.js.map +1 -1
  45. package/dist/managers/StepManager.mjs +1 -1
  46. package/dist/managers/StepManager.mjs.map +1 -1
  47. package/dist/managers/index.js +1 -1
  48. package/dist/managers/index.js.map +1 -1
  49. package/dist/managers/index.mjs +1 -1
  50. package/dist/managers/index.mjs.map +1 -1
  51. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/managers/StepManager.ts","../../src/functions/StepLabelUtility.ts","../../src/classes/Label.ts","../../src/classes/CloseLabel.ts","../../src/classes/canvas/CanvasBase.ts","../../src/classes/canvas/CanvasContainer.ts","../../src/functions/CanvasUtility.ts","../../src/classes/canvas/CanvasImage.ts","../../src/functions/TextureUtility.ts","../../src/classes/canvas/CanvasSprite.ts","../../src/decorators/EventDecorator.ts","../../src/classes/canvas/CanvasText.ts","../../src/decorators/CanvasElementDecorator.ts","../../src/decorators/TickerDecorator.ts","../../src/types/PauseType.ts","../../src/types/RepeatType.ts","../../src/classes/StoredClassModel.ts","../../src/decorators/LabelDecorator.ts","../../src/functions/DialogueUtility.ts","../../src/classes/ticker/TickerBase.ts","../../src/classes/ticker/TickerFadeAlpha.ts","../../src/classes/ticker/TickerMove.ts","../../src/functions/TickerUtility.ts","../../src/classes/ticker/TickerRotate.ts","../../src/functions/ExportUtility.ts","../../src/functions/DiffUtility.ts","../../src/managers/StorageManager.ts","../../src/managers/WindowManager.ts","../../src/functions/EasterEgg.ts","../../src/classes/CharacterBaseModel.ts"],"names":["Container","Sprite","diff","index","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AA2B;AAC/B,SAAK,mBAA2B,OAAO,KAAK;AAAA,EAChD;AAAA;AAAA;AAAA;AAAA,EAKA,IAAI,OAA2B;AAC3B,WAAO,KAAK;AAAA,EAChB;AAAA;AAAA;AAAA;AAAA,EAKA,IAAI,QAA4B;AAC5B,WAAO,KAAK;AAAA,EAChB;AACJ","sourcesContent":["import { diff } from \"deep-diff\"\nimport { DialogueBaseModel, Label } from \"../classes\"\nimport { IStoratedChoiceMenuOption } from \"../classes/ChoiceMenuOption\"\nimport newCloseLabel, { CLOSE_LABEL_ID } from \"../classes/CloseLabel\"\nimport { getLabelById } from \"../decorators/LabelDecorator\"\nimport { getDialogue } from \"../functions\"\nimport { restoreDeepDiffChanges } from \"../functions/DiffUtility\"\nimport { createExportableElement } from \"../functions/ExportUtility\"\nimport { getStepSha1 } from \"../functions/StepLabelUtility\"\nimport ExportedStep from \"../interface/export/ExportedStep\"\nimport IHistoryStep, { IHistoryStepData } from \"../interface/IHistoryStep\"\nimport IOpenedLabel from \"../interface/IOpenedLabel\"\nimport { LabelIdType } from \"../types/LabelIdType\"\nimport { StepHistoryDataType } from \"../types/StepHistoryDataType\"\nimport { StepLabelPropsType, StepLabelResultType, StepLabelType } from \"../types/StepLabelType\"\nimport GameStorageManager from \"./StorageManager\"\nimport GameWindowManager from \"./WindowManager\"\n\n/**\n * GameStepManager is a class that manages the steps and labels of the game.\n */\nexport default class GameStepManager {\n private constructor() { }\n /**\n * stepHistory is a list of label events and steps that occurred during the progression of the steps.\n */\n private static _stepsHistory: IHistoryStep[] = []\n static get stepsHistory() {\n return GameStepManager._stepsHistory\n }\n private static _lastStepIndex: number = 0\n /**\n * lastStepIndex is the last step index that occurred during the progression of the steps. **Not is the length of the stepsHistory - 1.**\n */\n static get lastStepIndex() {\n return GameStepManager._lastStepIndex\n }\n /**\n * Increase the last step index that occurred during the progression of the steps.\n */\n private static increaseLastStepIndex() {\n GameStepManager._lastStepIndex++\n }\n private static _openedLabels: IOpenedLabel[] = []\n static get openedLabels() {\n return GameStepManager._openedLabels\n }\n /**\n * currentLabelId is the current label id that occurred during the progression of the steps.\n */\n private static get currentLabelId(): LabelIdType | undefined {\n if (GameStepManager._openedLabels.length > 0) {\n let item = GameStepManager._openedLabels[GameStepManager._openedLabels.length - 1]\n return item.label\n }\n return undefined\n }\n /**\n * currentLabel is the current label that occurred during the progression of the steps.\n */\n static get currentLabel(): Label | undefined {\n if (GameStepManager.currentLabelId) {\n return getLabelById(GameStepManager.currentLabelId)\n }\n }\n private static get currentLabelStepIndex(): number | null {\n if (GameStepManager._openedLabels.length > 0) {\n let item = GameStepManager._openedLabels[GameStepManager._openedLabels.length - 1]\n return item.currentStepIndex\n }\n return null\n }\n /**\n * currentLabelStep is the current step that occurred during the progression of the steps. It can used to determine the game end.\n */\n static get isLastGameStep(): boolean {\n let stepLabel = GameStepManager.currentLabel?.steps\n if (stepLabel && GameStepManager.currentLabelStepIndex === stepLabel.length) {\n if (this.openedLabels.length <= 1) {\n return true\n }\n else {\n this.openedLabels.forEach((item) => {\n let label = getLabelById(item.label)\n if (label && label.steps.length > item.currentStepIndex) {\n return false\n }\n })\n return true\n }\n }\n return false\n }\n /**\n * lastHistoryStep is the last history step that occurred during the progression of the steps.\n */\n private static get lastHistoryStep(): IHistoryStep | null {\n if (GameStepManager._stepsHistory.length > 0) {\n return GameStepManager._stepsHistory[GameStepManager._stepsHistory.length - 1]\n }\n return null\n }\n private static _originalStepData: IHistoryStepData | undefined = undefined\n private static get originalStepData(): IHistoryStepData {\n if (!GameStepManager._originalStepData) {\n return {\n path: \"\",\n storage: {},\n canvas: {\n childrenTagsOrder: [],\n currentElements: {},\n currentTickers: [],\n },\n labelIndex: -1,\n openedLabels: [],\n }\n }\n return createExportableElement(GameStepManager._originalStepData)\n }\n private static set originalStepData(value: IHistoryStepData) {\n GameStepManager._originalStepData = createExportableElement(value)\n }\n\n /* Edit History Methods */\n\n /**\n * Add a label to the history.\n * @param label The label to add to the history.\n */\n private static addStepHistory(step: StepLabelType<any>, choiseMade?: number) {\n let stepHistory: StepHistoryDataType = getStepSha1(step)\n let historyStep: IHistoryStepData = {\n path: window.location.pathname,\n storage: GameStorageManager.export(),\n canvas: GameWindowManager.export(),\n labelIndex: GameStepManager.currentLabelStepIndex || 0,\n openedLabels: createExportableElement(GameStepManager._openedLabels),\n }\n if (GameStepManager.originalStepData) {\n if (GameStepManager.originalStepData.openedLabels.length === historyStep.openedLabels.length) {\n try {\n let lastStepDataOpenedLabelsString = JSON.stringify(GameStepManager.originalStepData.openedLabels)\n let historyStepOpenedLabelsString = JSON.stringify(historyStep.openedLabels)\n if (lastStepDataOpenedLabelsString === historyStepOpenedLabelsString) {\n return\n }\n }\n catch (e) {\n console.error(\"[Pixi'VN] Error comparing openedLabels\", e)\n }\n }\n }\n let data = diff(GameStepManager.originalStepData, historyStep)\n if (data) {\n let dialoge: DialogueBaseModel | undefined = undefined\n let requiredChoices: IStoratedChoiceMenuOption[] | undefined = undefined\n if (GameStorageManager.getVariable<number>(GameStorageManager.keysSystem.LAST_DIALOGUE_ADDED_IN_STEP_MEMORY_KEY) === GameStepManager.lastStepIndex) {\n dialoge = getDialogue()\n }\n if (GameStorageManager.getVariable<number>(GameStorageManager.keysSystem.LAST_MENU_OPTIONS_ADDED_IN_STEP_MEMORY_KEY) === GameStepManager.lastStepIndex) {\n requiredChoices = GameStorageManager.getVariable<IStoratedChoiceMenuOption[]>(GameStorageManager.keysSystem.CURRENT_MENU_OPTIONS_MEMORY_KEY)\n }\n GameStepManager._stepsHistory.push({\n diff: data,\n currentLabel: GameStepManager.currentLabelId,\n dialoge: dialoge,\n choices: requiredChoices,\n stepSha1: stepHistory,\n index: GameStepManager.lastStepIndex,\n choiceIndexMade: choiseMade\n })\n GameStepManager.originalStepData = historyStep\n }\n GameStepManager.increaseLastStepIndex()\n }\n /**\n * Add a label to the history.\n * @param label The label to add to the history.\n */\n private static pushNewLabel(label: LabelIdType) {\n let currentLabel = getLabelById(label)\n if (!currentLabel) {\n throw new Error(`[Pixi'VN] Label ${label} not found`)\n }\n GameStepManager._openedLabels.push({\n label: label,\n currentStepIndex: 0,\n })\n }\n /**\n * Close the current label and add it to the history.\n * @returns \n */\n static closeCurrentLabel() {\n if (!GameStepManager.currentLabelId) {\n console.warn(\"[Pixi'VN] No label to close\")\n return\n }\n if (!GameStepManager.currentLabel) {\n console.error(\"[Pixi'VN] currentLabel not found\")\n return\n }\n GameStepManager._openedLabels.pop()\n }\n /**\n * Close all labels and add them to the history.\n */\n static closeAllLabels() {\n while (GameStepManager._openedLabels.length > 0) {\n GameStepManager.closeCurrentLabel()\n }\n }\n /**\n * Increase the current step index of the current label.\n */\n private static increaseCurrentStepIndex() {\n let item = GameStepManager._openedLabels[GameStepManager._openedLabels.length - 1]\n GameStepManager._openedLabels[GameStepManager._openedLabels.length - 1] = {\n ...item,\n currentStepIndex: item.currentStepIndex + 1,\n }\n }\n\n /* Run Methods */\n\n /**\n * Execute the next step and add it to the history.\n * @param props The props to pass to the step.\n * @returns StepLabelResultType or undefined.\n * @example\n * ```typescript\n * function nextOnClick() {\n * setLoading(true)\n * GameStepManager.runNextStep(yourParams)\n * .then((result) => {\n * setUpdate((p) => p + 1)\n * setLoading(false)\n * if (result) {\n * // your code\n * }\n * })\n * .catch((e) => {\n * setLoading(false)\n * console.error(e)\n * })\n * }\n * ```\n */\n public static async runNextStep(props: StepLabelPropsType): Promise<StepLabelResultType> {\n if (GameStepManager._openedLabels.length === 0) {\n console.warn(\"[Pixi'VN] There are no labels to run\")\n return\n }\n GameStepManager.increaseCurrentStepIndex()\n return await GameStepManager.runCurrentStep(props)\n }\n /**\n * Execute the current step and add it to the history.\n * @param props The props to pass to the step.\n * @param choiseMade The choise made by the player.\n * @returns StepLabelResultType or undefined.\n */\n private static async runCurrentStep<T extends {}>(props: StepLabelPropsType<T>, choiseMade?: number): Promise<StepLabelResultType> {\n if (GameStepManager.currentLabelId) {\n let lastStepsLength = GameStepManager.currentLabelStepIndex\n if (lastStepsLength === null) {\n console.error(\"[Pixi'VN] currentLabelStepIndex is null\")\n return\n }\n let currentLabel = GameStepManager.currentLabel as Label<T>\n if (!currentLabel) {\n console.error(\"[Pixi'VN] currentLabel not found\")\n return\n }\n let n = currentLabel.steps.length\n if (n > lastStepsLength) {\n let step = currentLabel.steps[lastStepsLength]\n let result = await step(props)\n GameStepManager.addStepHistory(step, choiseMade)\n return result\n }\n else if (n === lastStepsLength) {\n GameStepManager.closeCurrentLabel()\n return await GameStepManager.runNextStep(props)\n }\n else {\n console.warn(\"[Pixi'VN] There are no steps to run\")\n }\n }\n }\n /**\n * Execute the label and add it to the history.\n * Is a call function in Ren'Py.\n * @param label The label to execute or the id of the label\n * @param props The props to pass to the label.\n * @returns StepLabelResultType or undefined.\n * @example\n * ```typescript\n * GameStepManager.callLabel(startLabel, yourParams).then((result) => {\n * if (result) {\n * // your code\n * }\n * })\n * ```\n * @example\n * ```typescript\n * // if you use it in a step label you should return the result.\n * return GameStepManager.callLabel(startLabel).then((result) => {\n * return result\n * })\n * ```\n */\n public static async callLabel<T extends {} = {}>(label: Label<T> | LabelIdType, props: StepLabelPropsType<T>): Promise<StepLabelResultType> {\n let choiseMade: number | undefined = undefined\n let labelId: LabelIdType\n if (typeof label === 'string') {\n labelId = label\n }\n else {\n labelId = label.id\n if (typeof label.choiseIndex === \"number\") {\n choiseMade = label.choiseIndex\n }\n }\n try {\n if (labelId === CLOSE_LABEL_ID) {\n let closeLabel = newCloseLabel(choiseMade)\n return GameStepManager.closeChoiceMenu(closeLabel, props)\n }\n let tempLabel = getLabelById<Label<T>>(labelId)\n if (!tempLabel) {\n throw new Error(`[Pixi'VN] Label ${labelId} not found`)\n }\n GameStepManager.pushNewLabel(tempLabel.id)\n }\n catch (e) {\n console.error(\"[Pixi'VN] Error calling label\", e)\n return\n }\n return await GameStepManager.runCurrentStep<T>(props, choiseMade)\n }\n /**\n * Execute the label, close all labels and add them to the history.\n * Is a jump function in Ren'Py.\n * @param label The label to execute.\n * @param props The props to pass to the label or the id of the label\n * @returns StepLabelResultType or undefined.\n * @example\n * ```typescript\n * GameStepManager.jumpLabel(startLabel, yourParams).then((result) => {\n * if (result) {\n * // your code\n * }\n * })\n * ```\n * @example\n * ```typescript\n * // if you use it in a step label you should return the result.\n * return GameStepManager.jumpLabel(startLabel).then((result) => {\n * return result\n * })\n * ```\n */\n public static async jumpLabel<T extends {}>(label: Label<T> | LabelIdType, props: StepLabelPropsType<T>): Promise<StepLabelResultType> {\n GameStepManager.closeAllLabels()\n let choiseMade: number | undefined = undefined\n let labelId: LabelIdType\n if (typeof label === 'string') {\n labelId = label\n }\n else {\n labelId = label.id\n if (typeof label.choiseIndex === \"number\") {\n choiseMade = label.choiseIndex\n }\n }\n try {\n if (labelId === CLOSE_LABEL_ID) {\n let closeLabel = newCloseLabel(choiseMade)\n return GameStepManager.closeChoiceMenu(closeLabel, props)\n }\n let tempLabel = getLabelById<Label<T>>(labelId)\n if (!tempLabel) {\n throw new Error(`[Pixi'VN] Label ${labelId} not found`)\n }\n GameStepManager.pushNewLabel(tempLabel.id)\n }\n catch (e) {\n console.error(\"[Pixi'VN] Error jumping label\", e)\n return\n }\n return await GameStepManager.runCurrentStep<T>(props, choiseMade)\n }\n /**\n * When the player is in a choice menu, can use this function to exit to the choice menu.\n * @param props The props to pass to the step.\n * @returns StepLabelResultType or undefined.\n * @example\n * ```typescript\n * GameStepManager.closeChoiceMenu(yourParams).then((result) => {\n * if (result) {\n * // your code\n * }\n * })\n * ```\n */\n public static async closeChoiceMenu<T extends {}>(label: Label<T>, props: StepLabelPropsType<T>): Promise<StepLabelResultType> {\n let choiseMade: number | undefined = undefined\n if (typeof label.choiseIndex === \"number\") {\n choiseMade = label.choiseIndex\n }\n GameStepManager.addStepHistory(() => { }, choiseMade)\n return GameStepManager.runNextStep(props)\n }\n\n /* After Update Methods */\n\n // /**\n // * After the update or code edit, some steps or labels may no longer match.\n // * - In case of step mismatch, the game will be updated to the last matching step.\n // * - In case of label mismatch, the game gives an error.\n // * @returns \n // */\n // private static afterUpdate() {\n // // TODO: implement\n // if (!GameStepManager.currentLabel) {\n // // TODO: implement\n // return\n // }\n // let currentLabel = getLabelInstanceByClassName(GameStepManager.currentLabel)\n // if (!currentLabel) {\n // console.error(\"Label not found\")\n // return\n // }\n // let oldSteps = GameStepManager.stepsAfterLastHistoryLabel\n // let currentStepIndex = currentLabel.getCorrespondingStepsNumber(oldSteps)\n // let stepToRemove = oldSteps.length - currentStepIndex\n // GameStepManager.removeLastHistoryNodes(stepToRemove)\n // GameStepManager.loadLastStep()\n // }\n // private static loadLastStep() {\n // // TODO: implement\n // }\n // /**\n // * Remove a number of items from the last of the history.\n // * @param itemNumber The number of items to remove from the last of the history.\n // */\n // private static removeLastHistoryNodes(itemNumber: number) {\n // // TODO: implement\n // for (let i = 0; i < itemNumber; i++) {\n // GameStepManager._stepsHistory.pop()\n // }\n // }\n // /**\n // * stepsAfterLastHistoryLabel is a list of steps that occurred after the last history label.\n // */\n // private static get stepsAfterLastHistoryLabel(): StepHistoryDataType[] {\n // let length = GameStepManager._stepsHistory.length\n // let steps: StepHistoryDataType[] = []\n // for (let i = length - 1; i >= 0; i--) {\n // let element = GameStepManager._stepsHistory[i]\n // if (typeof element === \"object\" && \"stepSha1\" in element) {\n // steps.push(element.stepSha1)\n // }\n // else {\n // break\n // }\n // }\n\n // steps = steps.reverse()\n // return steps\n // }\n\n /* Go Back & Refresh Methods */\n\n /**\n * Go back to the last step and add it to the history.\n * @param navigate The navigate function.\n * @param steps The number of steps to go back.\n * @returns \n * @example\n * ```typescript\n * export function goBack(navigate: (path: string) => void, afterBack?: () => void) {\n * GameStepManager.goBack(navigate)\n * afterBack && afterBack()\n * }\n * ```\n */\n public static goBack(navigate: (path: string) => void, steps: number = 1) {\n if (steps <= 0) {\n console.warn(\"[Pixi'VN] Steps must be greater than 0\")\n return\n }\n if (GameStepManager._stepsHistory.length <= 1) {\n console.warn(\"[Pixi'VN] No steps to go back\")\n return\n }\n let restoredStep = GameStepManager.goBackInternal(steps, GameStepManager.originalStepData)\n if (restoredStep) {\n GameStepManager._originalStepData = restoredStep\n GameStepManager._openedLabels = createExportableElement(restoredStep.openedLabels)\n GameStorageManager.import(createExportableElement(restoredStep.storage))\n GameWindowManager.import(createExportableElement(restoredStep.canvas))\n navigate(restoredStep.path)\n }\n else {\n console.error(\"[Pixi'VN] Error going back\")\n }\n }\n private static goBackInternal(steps: number, restoredStep: IHistoryStepData): IHistoryStepData {\n if (steps <= 0) {\n return restoredStep\n }\n if (GameStepManager._stepsHistory.length == 0) {\n return restoredStep\n }\n let lastHistoryStep = GameStepManager.lastHistoryStep\n if (lastHistoryStep) {\n try {\n let result = restoreDeepDiffChanges(restoredStep, lastHistoryStep.diff)\n GameStepManager._lastStepIndex = lastHistoryStep.index\n GameStepManager._stepsHistory.pop()\n return GameStepManager.goBackInternal(steps - 1, result)\n }\n catch (e) {\n console.error(\"[Pixi'VN] Error applying diff\", e)\n return restoredStep\n }\n }\n else {\n return restoredStep\n }\n }\n\n /**\n * Return true if it is possible to go back.\n */\n public static get canGoBack(): boolean {\n return GameStepManager._stepsHistory.length > 1\n }\n\n /**\n * Add a label to the history.\n */\n public static clear() {\n GameStepManager._stepsHistory = []\n GameStepManager._openedLabels = []\n }\n\n /* Export and Import Methods */\n\n /**\n * Export the history to a JSON string.\n * @returns The history in a JSON string.\n */\n public static exportJson(): string {\n return JSON.stringify(this.export())\n }\n /**\n * Export the history to an object.\n * @returns The history in an object.\n */\n public static export(): ExportedStep {\n return {\n stepsHistory: GameStepManager._stepsHistory,\n openedLabels: GameStepManager._openedLabels,\n lastStepIndex: GameStepManager._lastStepIndex,\n originalStepData: GameStepManager._originalStepData,\n }\n }\n /**\n * Import the history from a JSON string.\n * @param dataString The history in a JSON string.\n */\n public static importJson(dataString: string) {\n GameStepManager.import(JSON.parse(dataString))\n }\n /**\n * Import the history from an object.\n * @param data The history in an object.\n */\n public static import(data: object) {\n GameStepManager.clear()\n try {\n if (data.hasOwnProperty(\"stepsHistory\")) {\n GameStepManager._stepsHistory = (data as ExportedStep)[\"stepsHistory\"]\n }\n else {\n console.warn(\"[Pixi'VN] No stepsHistory data found\")\n }\n if (data.hasOwnProperty(\"openedLabels\")) {\n GameStepManager._openedLabels = (data as ExportedStep)[\"openedLabels\"]\n }\n else {\n console.warn(\"[Pixi'VN] No openedLabels data found\")\n }\n if (data.hasOwnProperty(\"lastStepIndex\")) {\n GameStepManager._lastStepIndex = (data as ExportedStep)[\"lastStepIndex\"]\n }\n else {\n console.warn(\"[Pixi'VN] No lastStepIndex data found\")\n }\n if (data.hasOwnProperty(\"originalStepData\")) {\n GameStepManager._originalStepData = (data as ExportedStep)[\"originalStepData\"]\n }\n else {\n console.warn(\"[Pixi'VN] No originalStepData data found\")\n }\n }\n catch (e) {\n console.error(\"[Pixi'VN] Error importing data\", e)\n }\n }\n}\n","import sha1 from 'crypto-js/sha1';\nimport { StepHistoryDataType } from \"../types/StepHistoryDataType\";\nimport { StepLabelType } from \"../types/StepLabelType\";\n\n/**\n * Convert StepLabel to StepHistoryData\n * @param step\n * @returns\n */\nexport function getStepSha1(step: StepLabelType): StepHistoryDataType {\n let sha1String = sha1(step.toString().toLocaleLowerCase())\n return sha1String.toString()\n}\n/**\n * Check if two steps are equal\n * @param step1\n * @param step2\n * @returns\n */\nexport function checkIfStepsIsEqual(step1: StepHistoryDataType | StepLabelType<any>, step2: StepHistoryDataType | StepLabelType<any>): boolean {\n return step1 === step2\n}\n","import { checkIfStepsIsEqual } from \"../functions/StepLabelUtility\"\nimport { LabelIdType } from \"../types/LabelIdType\"\nimport { StepHistoryDataType } from \"../types/StepHistoryDataType\"\nimport { StepLabelType } from \"../types/StepLabelType\"\n\n/**\n * Label is a class that contains a list of steps, which will be performed as the game continues.\n * For Ren'py this is the equivalent of a label.\n * @example\n * ```typescript\n * const START_LABEL_ID = \"StartLabel\"\n * \n * export const startLabel = newLabel(START_LABEL_ID,\n * [\n * (props) => {\n * GameWindowManager.clear()\n * setDialogue({ character: liam, text: \"Which test do you want to perform?\" })\n * setChoiceMenuOptions([\n * new ChoiceMenuOption(\"Events Test\", eventsTestLabel),\n * new ChoiceMenuOption(\"Show Image Test\", showImageTest),\n * ])\n * },\n * (props) => GameStepManager.jumpLabel(START_LABEL_ID, props),\n * ]\n * )\n * \n * GameStepManager.callLabel(StartLabel)\n * ```\n */\nexport default class Label<T extends {} = {}> {\n /**\n * @param id is the id of the label\n * @param steps is the list of steps that the label will perform\n * @param onStepRun is a function that will be executed before any step is executed, is useful for example to make sure all images used have been cached\n * @param choiseIndex is the index of the choice that the label will perform\n */\n constructor(id: LabelIdType, steps: StepLabelType<T>[], onStepRun?: () => void | Promise<void>, choiseIndex?: number) {\n this._id = id\n this._steps = steps\n this._onStepRun = onStepRun\n this._choiseIndex = choiseIndex\n }\n\n private _id: LabelIdType\n /**\n * Get the id of the label\n */\n public get id(): LabelIdType {\n return this._id\n }\n\n private _steps: StepLabelType<T>[]\n /**\n * Get the steps of the label.\n * This class should be extended and the steps method should be overridden.\n * Every time you update this list will also be updated when the other game versions load.\n */\n public get steps(): StepLabelType<T>[] {\n return this._steps\n }\n\n /**\n * Get the corresponding steps number\n * @param externalSteps\n * @returns Numer of corresponding steps, for example, if externalSteps is [ABC, DEF, GHI] and the steps of the label is [ABC, GHT], the result will be 1\n */\n public getCorrespondingStepsNumber(externalSteps: StepHistoryDataType[] | StepLabelType[]): number {\n if (externalSteps.length === 0) {\n return 0\n }\n let res: number = 0\n externalSteps.forEach((step, index) => {\n if (checkIfStepsIsEqual(step, this.steps[index])) {\n res = index\n }\n })\n return res\n }\n\n private _onStepRun: (() => void | Promise<void>) | undefined\n /**\n * Get the function that will be executed before any step is executed, is useful for example to make sure all images used have been cached\n * @returns Promise<void> or void\n * @example\n * ```typescript\n * newLabel(\"id\", [], () => {\n * Assets.load('path/to/image1.png')\n * Assets.load('path/to/image2.png')\n * })\n * ```\n */\n public get onStepRun(): (() => void | Promise<void>) | undefined {\n return this._onStepRun\n }\n\n private _choiseIndex: number | undefined\n public get choiseIndex(): number | undefined {\n return this._choiseIndex\n }\n}\n","import Label from \"./Label\"\n\nexport const CLOSE_LABEL_ID = \"__close-label-id__\"\n\n/**\n * CloseLabel is a label used for closing the menu.\n */\nexport default function newCloseLabel(choiseIndex?: number) { return new Label(CLOSE_LABEL_ID, [], undefined, choiseIndex) }\n","import { Container } from \"pixi.js\";\nimport { ICanvasBaseMemory } from \"../../interface/canvas\";\n\n/**\n * This class is used to create a canvas element to add into a Pixi Application.\n * You can use GameWindowManager.addCanvasElement() to add this element into the application.\n * This class should be implemented and the memory method should be overridden.\n * You must use the canvasElementDecorator to register the canvas in the game.\n * In Ren'Py is a displayable.\n * @example\n * ```typescript\n * \\@canvasElementDecorator() // this is equivalent to canvasElementDecorator(\"CanvasExample\")\n * export class CanvasExample extends Container implements CanvasBase<ICanvasExampleMemory> {\n * get memory(): ICanvasExampleMemory {\n * return {\n * className: \"CanvasExample\",\n * // ... other properties\n * }\n * }\n * set memory(value: ICanvasExampleMemory) {\n * // ... set other properties\n * }\n * }\n * ```\n */\nexport default class CanvasBase<T2 extends ICanvasBaseMemory> extends Container {\n /**\n * This method return the memory of the canvas element.\n */\n get memory(): T2 { throw new Error(\"[Pixi'VN] The method CanvasBase.memory must be overridden\") }\n /**\n * This method set the memory of the canvas element.\n */\n set memory(_value: T2) { throw new Error(\"[Pixi'VN] The method CanvasBase.memory must be overridden\") }\n}\n","import { Container, ContainerOptions } from \"pixi.js\";\nimport { exportCanvasElement, importCanvasElement } from \"../../functions/CanvasUtility\";\nimport ICanvasContainerMemory from \"../../interface/canvas/ICanvasContainerMemory\";\nimport CanvasBase from \"./CanvasBase\";\n\n/**\n * This class is a extension of the [PIXI.Container class](https://pixijs.com/8.x/examples/basic/container), it has the same properties and methods, \n * but it has the ability to be saved and loaded by the Pixi'VN library.\n * @example\n * ```typescript\n * const container = new CanvasContainer();\n * GameWindowManager.addCanvasElement(container);\n * const texture = await Assets.load('https://pixijs.com/assets/bunny.png');\n * for (let i = 0; i < 25; i++)\n * {\n * const bunny = new CanvasSprite(texture);\n * bunny.x = (i % 5) * 40;\n * bunny.y = Math.floor(i / 5) * 40;\n * container.addChild(bunny);\n * }\n * ```\n */\nexport default class CanvasContainer extends Container implements CanvasBase<ICanvasContainerMemory> {\n get memory(): ICanvasContainerMemory {\n let memory = getMemoryContainer(this)\n this.children.forEach(child => {\n memory.elements.push(exportCanvasElement(child as CanvasBase<any>))\n })\n return memory\n }\n set memory(value: ICanvasContainerMemory) {\n setMemoryContainer(this, value)\n value.elements.forEach(child => {\n this.addChild(importCanvasElement(child))\n })\n }\n}\n\nexport function getMemoryContainer<T extends Container>(element: T): ICanvasContainerMemory {\n return {\n className: \"CanvasContainer\",\n elements: [],\n\n width: element.width,\n height: element.height,\n\n isRenderGroup: element.isRenderGroup,\n blendMode: element.blendMode,\n tint: element.tint,\n alpha: element.alpha,\n angle: element.angle,\n renderable: element.renderable,\n rotation: element.rotation,\n scale: { x: element.scale.x, y: element.scale.y },\n pivot: { x: element.pivot.x, y: element.pivot.y },\n position: { x: element.position.x, y: element.position.y },\n skew: { x: element.skew.x, y: element.skew.y },\n visible: element.visible,\n culled: element.culled,\n x: element.x,\n y: element.y,\n boundsArea: element.boundsArea,\n\n cursor: element.cursor,\n eventMode: element.eventMode,\n interactive: element.interactive,\n interactiveChildren: element.interactiveChildren,\n hitArea: element.hitArea\n }\n}\n\nexport function setMemoryContainer<T extends Container>(element: T | Container, memory: ContainerOptions) {\n memory.width && (element.width = memory.width)\n memory.height && (element.height = memory.height)\n\n memory.isRenderGroup && (element.isRenderGroup = memory.isRenderGroup)\n memory.blendMode && (element.blendMode = memory.blendMode)\n memory.tint && (element.tint = memory.tint)\n memory.alpha && (element.alpha = memory.alpha)\n memory.angle && (element.angle = memory.angle)\n memory.renderable && (element.renderable = memory.renderable)\n memory.rotation && (element.rotation = memory.rotation)\n if (memory.scale) {\n if (typeof memory.scale === \"number\") {\n element.scale.set(memory.scale, memory.scale)\n }\n else {\n element.scale.set(memory.scale.x, memory.scale.y)\n }\n }\n if (memory.pivot) {\n if (typeof memory.pivot === \"number\") {\n element.pivot.set(memory.pivot, memory.pivot)\n }\n else {\n element.pivot.set(memory.pivot.x, memory.pivot.y)\n }\n }\n memory.position && (element.position.set(memory.position.x, memory.position.y))\n memory.skew && (element.skew.set(memory.skew.x, memory.skew.y))\n memory.visible && (element.visible = memory.visible)\n memory.culled && (element.culled = memory.culled)\n memory.x && (element.x = memory.x)\n memory.y && (element.y = memory.y)\n memory.boundsArea && (element.boundsArea = memory.boundsArea)\n\n memory.cursor && (element.cursor = memory.cursor)\n memory.eventMode && (element.eventMode = memory.eventMode)\n memory.interactive && (element.interactive = memory.interactive)\n memory.interactiveChildren && (element.interactiveChildren = memory.interactiveChildren)\n memory.hitArea && (element.hitArea = memory.hitArea)\n}\n","import { Texture } from \"pixi.js\";\nimport { CanvasBase } from \"../classes/canvas\";\nimport { getCanvasElementInstanceByClassName } from \"../decorators/CanvasElementDecorator\";\nimport { ICanvasBaseMemory, ITextureMemory } from \"../interface/canvas\";\n\n/**\n * Get the memory object of the PixiJS texture\n * @param texture PixiJS Texture object\n * @returns Memory object of the texture\n */\nexport function getTextureMemory(texture: Texture): ITextureMemory {\n let sourceTexture = texture.source\n let textureMemory: ITextureMemory = {\n image: sourceTexture.label\n }\n return textureMemory\n}\n\n/**\n * Export a Canvas element to a memory object\n * @param element Canvas element\n * @returns Memory object of the canvas\n */\nexport function exportCanvasElement<T extends CanvasBase<any>>(\n element: T,\n): ICanvasBaseMemory {\n return element.memory\n}\n\n/**\n * Import a Canvas element from a memory object\n * @param memory Memory object of the canvas\n * @returns Canvas element\n */\nexport function importCanvasElement<T extends CanvasBase<any>>(\n memory: ICanvasBaseMemory,\n): T {\n let element = getCanvasElementInstanceByClassName<T>(memory.className)\n if (element) {\n element.memory = memory\n }\n else {\n throw new Error(\"[Pixi'VN] The element \" + memory.className + \" could not be created\")\n }\n\n return element\n}\n","import { Sprite, SpriteOptions, Texture, TextureSourceLike } from \"pixi.js\";\nimport { getTexture } from \"../../functions/TextureUtility\";\nimport ICanvasImageMemory from \"../../interface/canvas/ICanvasImageMemory\";\nimport CanvasSprite, { getMemorySprite, setMemorySprite } from \"./CanvasSprite\";\n\n/**\n * This class is a extension of the CanvasSprite class, it has the same properties and methods,\n * but it has some features that make texture management easier.\n * You need to use CanvasImage.load() to show the image in the canvas.\n * This class is used for functions like addImage, loadImages and showWithDissolveTransition.\n * @example\n * ```typescript\n * let alien = new CanvasImage({\n * anchor: { x: 0.5, y: 0.5 },\n * x: 100,\n * y: 100,\n * }, 'https://pixijs.com/assets/eggHead.png')\n * await alien.load()\n * GameWindowManager.addCanvasElement(\"alien\", alien)\n * ```\n * @example\n * ```typescript\n * let alien = addImage(\"alien\", 'https://pixijs.com/assets/eggHead.png')\n * alien.anchor.set(0.5);\n * alien.x = 100\n * alien.y = 100\n * await alien.load()\n * ```\n */\nexport default class CanvasImage extends CanvasSprite<ICanvasImageMemory> {\n constructor(options?: SpriteOptions | Texture | undefined, imageLink?: string) {\n super(options)\n if (imageLink) {\n this.imageLink = imageLink\n }\n }\n override get memory(): ICanvasImageMemory {\n return {\n ...getMemorySprite(this),\n className: \"CanvasImage\",\n textureImage: { image: this.imageLink },\n }\n }\n override set memory(memory: ICanvasImageMemory) {\n setMemorySprite(this, memory)\n }\n imageLink: string = \"\"\n static override from(source: Texture | TextureSourceLike, skipCache?: boolean) {\n let sprite = Sprite.from(source, skipCache)\n let mySprite = new CanvasImage()\n mySprite.texture = sprite.texture\n return mySprite\n }\n /** \n * Load the image from the link and set the texture of the sprite.\n * @param image The link of the image. If it is not set, it will use the imageLink property.\n * @returns A promise that resolves when the image is loaded.\n */\n async load(image?: string) {\n if (!image) {\n image = this.imageLink\n }\n return getTexture(this.imageLink)\n .then((texture) => {\n if (texture) {\n this.texture = texture\n }\n })\n .catch((e) => {\n console.error(\"[Pixi'VN] Error into CanvasImage.load()\", e)\n })\n }\n}\n","import { Assets, TextStyle, TextStyleOptions, Texture } from 'pixi.js';\n\n/**\n * Get a texture from a url.\n * @param imageUrl is the url of the image.\n * @returns the texture of the image, or a text with the error.\n */\nexport async function getTexture(imageUrl: string): Promise<Texture | void> {\n if (Assets.cache.has(imageUrl)) {\n return Assets.get(imageUrl)\n }\n return Assets.load(imageUrl)\n .then((texture) => {\n if (!texture) {\n console.error(\"[Pixi'VN] Texture not found\", imageUrl)\n return\n }\n // if texture not is a Texture, then it is a TextureResource\n if (!(texture instanceof Texture)) {\n console.error(\"[Pixi'VN] File not is a image\", imageUrl)\n return\n }\n\n return texture\n })\n .catch((e) => {\n console.error(\"[Pixi'VN] Error loading image\", e)\n return\n })\n}\n\nexport function getTextStyle(style: TextStyle): TextStyleOptions {\n let fill = style.fill\n if (fill instanceof Object) {\n // TODO: FillGradient and FillPattern are not supported yet\n console.warn(\"[Pixi'VN] CanvasText.style.fill is a FillGradient or FillPattern, this is not supported yet.\", fill)\n fill = \"#00FF00\"\n }\n return {\n align: style.align,\n breakWords: style.breakWords,\n dropShadow: style.dropShadow,\n fill: fill,\n fontFamily: style.fontFamily,\n fontSize: style.fontSize,\n fontStyle: style.fontStyle,\n fontVariant: style.fontVariant,\n fontWeight: style.fontWeight,\n leading: style.leading,\n letterSpacing: style.letterSpacing,\n lineHeight: style.lineHeight,\n padding: style.padding,\n stroke: style.stroke,\n textBaseline: style.textBaseline,\n trim: style.trim,\n whiteSpace: style.whiteSpace,\n wordWrap: style.wordWrap,\n wordWrapWidth: style.wordWrapWidth,\n }\n}\n","import { ContainerChild, ContainerEvents, EventEmitter, Sprite, SpriteOptions, Texture, TextureSourceLike } from \"pixi.js\";\nimport { getEventInstanceByClassName, getEventTypeByClassName } from \"../../decorators/EventDecorator\";\nimport { getTextureMemory } from \"../../functions/CanvasUtility\";\nimport { getTexture } from \"../../functions/TextureUtility\";\nimport ICanvasBaseMemory from \"../../interface/canvas/ICanvasBaseMemory\";\nimport ICanvasSpriteMemory, { ICanvasSpriteBaseMemory } from \"../../interface/canvas/ICanvasSpriteMemory\";\nimport { CanvasEventNamesType } from \"../../types/CanvasEventNamesType\";\nimport { EventIdType } from \"../../types/EventIdType\";\nimport CanvasEvent from \"../CanvasEvent\";\nimport CanvasBase from \"./CanvasBase\";\nimport { getMemoryContainer, setMemoryContainer } from \"./CanvasContainer\";\n\n/**\n * This class is a extension of the [PIXI.Sprite class](https://pixijs.com/8.x/examples/sprite/basic), it has the same properties and methods,\n * but it has the ability to be saved and loaded by the Pixi'VN library.\n * @example\n * ```typescript\n * const texture = await Assets.load('https://pixijs.com/assets/bunny.png');\n * const sprite = CanvasSprite.from(texture);\n *\n * sprite.anchor.set(0.5);\n * sprite.x = GameWindowManager.screen.width / 2;\n * sprite.y = GameWindowManager.screen.height / 2;\n *\n * sprite.eventMode = 'static';\n * sprite.cursor = 'pointer';\n * sprite.onEvent('pointerdown', EventTest);\n *\n * GameWindowManager.addCanvasElement(\"bunny\", sprite);\n * ```\n */\nexport default class CanvasSprite<Memory extends SpriteOptions & ICanvasBaseMemory = ICanvasSpriteMemory> extends Sprite implements CanvasBase<Memory | ICanvasSpriteMemory> {\n get memory(): Memory | ICanvasSpriteMemory {\n return getMemorySprite(this)\n }\n set memory(value: ICanvasSpriteMemory) {\n setMemorySprite(this, value)\n }\n private _onEvents: { [name: CanvasEventNamesType]: EventIdType } = {}\n get onEvents() {\n return this._onEvents\n }\n /**\n * is same function as on(), but it keeps in memory the children.\n * @param event The event type, e.g., 'click', 'mousedown', 'mouseup', 'pointerdown', etc.\n * @param eventClass The class that extends CanvasEvent.\n * @returns \n * @example\n * ```typescript\n * \\@eventDecorator()\n * export class EventTest extends CanvasEvent<CanvasSprite> {\n * override fn(event: CanvasEventNamesType, sprite: CanvasSprite): void {\n * if (event === 'pointerdown') {\n * sprite.scale.x *= 1.25;\n * sprite.scale.y *= 1.25;\n * }\n * }\n * }\n * ```\n * \n * ```typescript\n * let sprite = addImage(\"alien\", 'https://pixijs.com/assets/eggHead.png')\n * await sprite.load()\n *\n * sprite.eventMode = 'static';\n * sprite.cursor = 'pointer';\n * sprite.onEvent('pointerdown', EventTest);\n *\n * GameWindowManager.addCanvasElement(\"bunny\", sprite);\n * ```\n */\n onEvent<T extends CanvasEventNamesType, T2 extends typeof CanvasEvent<typeof this>>(event: T, eventClass: T2) {\n let className = eventClass.name\n let instance = getEventInstanceByClassName(className)\n this._onEvents[event] = className\n if (instance) {\n super.on(event, () => {\n (instance as CanvasEvent<CanvasBase<any>>).fn(event, this)\n })\n }\n return this\n }\n /**\n * on() does not keep in memory the event class, use onEvent() instead\n * @deprecated\n * @private\n * @param event \n * @param fn \n * @param context \n */\n override on<T extends keyof ContainerEvents<ContainerChild> | keyof { [K: symbol]: any;[K: {} & string]: any; }>(event: T, fn: (...args: EventEmitter.ArgumentMap<ContainerEvents<ContainerChild> & { [K: symbol]: any;[K: {} & string]: any; }>[Extract<T, keyof ContainerEvents<ContainerChild> | keyof { [K: symbol]: any;[K: {} & string]: any; }>]) => void, context?: any): this {\n return super.on(event, fn, context)\n }\n static override from(source: Texture | TextureSourceLike, skipCache?: boolean): CanvasSprite<any> {\n let sprite = Sprite.from(source, skipCache)\n let mySprite = new CanvasSprite()\n mySprite.texture = sprite.texture\n return mySprite\n }\n}\n\nexport function getMemorySprite<T extends CanvasSprite<any>>(element: T | CanvasSprite<any>): ICanvasSpriteMemory {\n let temp = getMemoryContainer(element)\n return {\n ...temp,\n className: \"CanvasSprite\",\n textureImage: getTextureMemory((element as any).texture),\n anchor: { x: element.anchor.x, y: element.anchor.y },\n roundPixels: element.roundPixels,\n onEvents: element.onEvents,\n }\n}\n\nexport function setMemorySprite<Memory extends ICanvasSpriteBaseMemory>(element: CanvasSprite<any>, memory: Memory) {\n setMemoryContainer(element, memory)\n getTexture(memory.textureImage.image).then((texture) => {\n if (texture) {\n element.texture = texture\n }\n })\n if (memory.anchor) {\n if (typeof memory.anchor === \"number\") {\n element.anchor.set(memory.anchor, memory.anchor)\n }\n else {\n element.anchor.set(memory.anchor.x, memory.anchor.y)\n }\n }\n memory.roundPixels && (element.roundPixels = memory.roundPixels)\n for (let event in memory.onEvents) {\n let className = memory.onEvents[event]\n let instance = getEventTypeByClassName(className)\n if (instance) {\n element.onEvent(event, instance)\n }\n }\n}\n","import { CanvasEvent } from \"../classes\"\nimport CanvasBase from \"../classes/canvas/CanvasBase\"\nimport { CanvasEventNamesType } from \"../types/CanvasEventNamesType\"\nimport { EventIdType } from \"../types/EventIdType\"\n\n/**\n * Canvas Event Register\n */\nexport const registeredEvents: { [name: EventIdType]: typeof CanvasEvent<CanvasEventNamesType> } = {}\n/**\n * Is a decorator that register a event in the game.\n * Is a required decorator for use the event in the game.\n * Thanks to this decoration the game has the possibility of updating the events to the latest modification and saving the game.\n * @param name is th identifier of the event, by default is the name of the class\n * @returns \n */\nexport default function eventDecorator(name?: EventIdType) {\n return function (target: typeof CanvasEvent<any>) {\n if (!name) {\n name = target.name\n }\n if (registeredEvents[name]) {\n console.warn(`[Pixi'VN] Event ${name} already exists, it will be overwritten`)\n }\n registeredEvents[name] = target\n }\n}\n\n/**\n * Get an event type by the class name.\n * @param eventName The name of the class.\n * @returns The event type.\n */\nexport function getEventTypeByClassName<T = typeof CanvasEvent<CanvasBase<any>>>(eventName: EventIdType): T | undefined {\n try {\n let eventType = registeredEvents[eventName]\n if (!eventType) {\n console.error(`[Pixi'VN] Event ${eventName} not found`)\n return\n }\n new eventType()\n return eventType as T\n }\n catch (e) {\n console.error(`[Pixi'VN] Error while getting Event ${eventName}`, e)\n return\n }\n}\n\n/**\n * Get an event instance by the class name.\n * @param eventName The name of the class.\n * @returns The event instance.\n */\nexport function getEventInstanceByClassName<T = CanvasEvent<CanvasBase<any>>>(eventName: EventIdType): T | undefined {\n try {\n let eventType = registeredEvents[eventName]\n if (!eventType) {\n console.error(`[Pixi'VN] Event ${eventName} not found`)\n return\n }\n let event = new eventType()\n return event as T\n }\n catch (e) {\n console.error(`[Pixi'VN] Error while getting Event ${eventName}`, e)\n return\n }\n}\n","import { ContainerChild, ContainerEvents, EventEmitter, Text } from \"pixi.js\";\nimport { getEventInstanceByClassName, getEventTypeByClassName } from \"../../decorators/EventDecorator\";\nimport { getTextStyle } from \"../../functions/TextureUtility\";\nimport ICanvasTextMemory from \"../../interface/canvas/ICanvasTextTextMemory\";\nimport { CanvasEventNamesType } from \"../../types/CanvasEventNamesType\";\nimport { EventIdType } from \"../../types/EventIdType\";\nimport CanvasEvent from \"../CanvasEvent\";\nimport CanvasBase from \"./CanvasBase\";\nimport { getMemoryContainer, setMemoryContainer } from \"./CanvasContainer\";\n\n/**\n * This class is a extension of the [PIXI.Text class](https://pixijs.com/8.x/examples/text/pixi-text), it has the same properties and methods,\n * but it has the ability to be saved and loaded by the Pixi'VN library.\n * @example\n * ```typescript\n * const text = new CanvasText();\n * text.text = \"Hello World\"\n * GameWindowManager.addCanvasElement(\"text\", text);\n * ```\n */\nexport default class CanvasText extends Text implements CanvasBase<ICanvasTextMemory> {\n get memory(): ICanvasTextMemory {\n return getMemoryText(this)\n }\n set memory(value: ICanvasTextMemory) {\n setMemoryText(this, value)\n }\n private _onEvents: { [name: CanvasEventNamesType]: EventIdType } = {}\n get onEvents() {\n return this._onEvents\n }\n /**\n * is same function as on(), but it keeps in memory the children.\n * @param event The event type, e.g., 'click', 'mousedown', 'mouseup', 'pointerdown', etc.\n * @param eventClass The class that extends CanvasEvent.\n * @returns \n * @example\n * ```typescript\n * \\@eventDecorator()\n * export class EventTest extends CanvasEvent<CanvasText> {\n * override fn(event: CanvasEventNamesType, text: CanvasText): void {\n * if (event === 'pointerdown') {\n * text.scale.x *= 1.25;\n * text.scale.y *= 1.25;\n * }\n * }\n * }\n * ```\n * \n * ```typescript\n * const text = new CanvasText();\n * text.text = \"Hello World\"\n *\n * text.eventMode = 'static';\n * text.cursor = 'pointer';\n * text.onEvent('pointerdown', EventTest);\n *\n * GameWindowManager.addCanvasElement(\"text\", text);\n * ```\n */\n onEvent<T extends CanvasEventNamesType, T2 extends typeof CanvasEvent<typeof this>>(event: T, eventClass: T2) {\n let className = eventClass.name\n let instance = getEventInstanceByClassName(className)\n this._onEvents[event] = className\n if (instance) {\n super.on(event, () => {\n (instance as CanvasEvent<CanvasBase<any>>).fn(event, this)\n })\n }\n return this\n }\n /**\n * on() does not keep in memory the event class, use onEvent() instead\n * @deprecated\n * @private\n * @param event \n * @param fn \n * @param context \n */\n override on<T extends keyof ContainerEvents<ContainerChild> | keyof { [K: symbol]: any;[K: {} & string]: any; }>(event: T, fn: (...args: EventEmitter.ArgumentMap<ContainerEvents<ContainerChild> & { [K: symbol]: any;[K: {} & string]: any; }>[Extract<T, keyof ContainerEvents<ContainerChild> | keyof { [K: symbol]: any;[K: {} & string]: any; }>]) => void, context?: any): this {\n return super.on(event, fn, context)\n }\n}\n\nexport function getMemoryText<T extends CanvasText>(element: T | CanvasText): ICanvasTextMemory {\n let temp = getMemoryContainer(element)\n return {\n ...temp,\n className: \"CanvasText\",\n anchor: { x: element.anchor.x, y: element.anchor.y },\n text: element.text,\n resolution: element.resolution,\n style: getTextStyle(element.style),\n roundPixels: element.roundPixels,\n onEvents: element.onEvents,\n }\n}\n\nexport function setMemoryText(element: CanvasText, memory: ICanvasTextMemory) {\n setMemoryContainer(element, memory)\n if (memory.anchor) {\n if (typeof memory.anchor === \"number\") {\n element.anchor.set(memory.anchor, memory.anchor)\n }\n else {\n element.anchor.set(memory.anchor.x, memory.anchor.y)\n }\n }\n memory.text && (element.text = memory.text)\n memory.resolution && (element.resolution = memory.resolution)\n memory.style && (element.style = memory.style)\n memory.roundPixels && (element.roundPixels = memory.roundPixels)\n for (let event in memory.onEvents) {\n let className = memory.onEvents[event]\n let instance = getEventTypeByClassName(className)\n if (instance) {\n element.onEvent(event as CanvasEventNamesType, instance)\n }\n }\n}\n","import { CanvasContainer, CanvasImage, CanvasSprite, CanvasText } from \"../classes/canvas\"\nimport CanvasBase from \"../classes/canvas/CanvasBase\"\nimport { CanvasElementTagType } from \"../types/CanvasElementTagType\"\n\nexport const registeredCanvasElement: { [name: CanvasElementTagType]: typeof CanvasBase<any> } = {}\n/**\n * Is a decorator that register a canvas element in the game.\n * @param name Name of the canvas element, by default it will use the class name. If the name is already registered, it will show a warning\n * @returns \n */\nexport default function canvasElementDecorator(name?: CanvasElementTagType) {\n return function (target: typeof CanvasBase<any>) {\n if (!name) {\n name = target.name\n }\n if (registeredCanvasElement[name]) {\n console.warn(`[Pixi'VN] CanvasElement ${name} already registered`)\n }\n registeredCanvasElement[name] = target\n }\n}\n\nexport function getCanvasElementTypeByClassName<T extends typeof CanvasBase<any>>(canvasName: CanvasElementTagType): T | undefined {\n try {\n let eventType = registeredCanvasElement[canvasName]\n if (!eventType) {\n console.error(`[Pixi'VN] CanvasElement ${canvasName} not found`)\n return\n }\n new eventType()\n return eventType as T\n }\n catch (e) {\n console.error(`[Pixi'VN] Error while getting CanvasElement ${canvasName}`, e)\n return\n }\n}\n\nexport function getCanvasElementInstanceByClassName<T extends CanvasBase<any>>(canvasName: CanvasElementTagType): T | undefined {\n try {\n let eventType = registeredCanvasElement[canvasName]\n if (!eventType) {\n if (canvasName === \"CanvasContainer\") {\n eventType = CanvasContainer\n }\n else if (canvasName === \"CanvasImage\") {\n eventType = CanvasImage\n }\n else if (canvasName === \"CanvasSprite\") {\n eventType = CanvasSprite\n }\n else if (canvasName === \"CanvasText\") {\n eventType = CanvasText\n }\n }\n\n if (!eventType) {\n console.error(`[Pixi'VN] CanvasElement ${canvasName} not found`)\n return\n }\n let canvasElement = new eventType()\n return canvasElement as T\n }\n catch (e) {\n console.error(`[Pixi'VN] Error while getting CanvasElement ${canvasName}`, e)\n return\n }\n}\n","import { UPDATE_PRIORITY } from \"pixi.js\"\nimport TickerBase, { TickerArgsType } from \"../classes/ticker/TickerBase\"\nimport { TickerIdType } from \"../types/TickerIdType\"\n\n/**\n * A dictionary that contains all tickers registered and avvailable to be used.\n */\nexport const registeredTickers: { [name: TickerIdType]: typeof TickerBase } = {}\n/**\n * Is a decorator that register a ticker in the game.\n * Is a required decorator for use the ticker in the game.\n * Thanks to this decoration the game has the possibility of updating the tickers to the latest modification and saving the game.\n * @param name is th identifier of the label, by default is the name of the class\n * @returns \n */\nexport default function tickerDecorator(name?: TickerIdType) {\n return function (target: typeof TickerBase<any>) {\n if (!name) {\n name = target.name\n }\n if (registeredTickers[name]) {\n console.warn(`[Pixi'VN] Ticker ${name} already exists, it will be overwritten`)\n }\n registeredTickers[name] = target\n }\n}\n\n/**\n * Get a ticker instance by the class name.\n * @param tickerName The name of the class.\n * @returns The ticker instance.\n */\nexport function geTickerInstanceByClassName<TArgs extends TickerArgsType>(tickerName: TickerIdType, args: TArgs, duration?: number, priority?: UPDATE_PRIORITY): TickerBase<TArgs> | undefined {\n try {\n let ticker = registeredTickers[tickerName]\n if (!ticker) {\n console.error(`[Pixi'VN] Ticker ${tickerName} not found`)\n return\n }\n return new ticker(args, duration, priority)\n }\n catch (e) {\n console.error(`[Pixi'VN] Error while getting Ticker ${tickerName}`, e)\n return\n }\n}\n","export const PauseValueType = \"pause\"\nexport type PauseType = {\n type: typeof PauseValueType,\n duration: number,\n}\nexport function Pause(duration: number): PauseType {\n return {\n type: PauseValueType,\n duration: duration,\n }\n}","export type RepeatType = \"repeat\"\nexport const Repeat: RepeatType = \"repeat\"","import { GameStorageManager } from \"../managers\"\n\n/**\n * StoredClassModel is a abstract class that contains the methods to store a class in the game.\n * I suggest you extend this class to create your own stored class.\n * @example\n * ```typescript\n * export class CharacterBaseModel extends StoredClassModel implements CharacterBaseModelProps {\n * constructor(id: string, props: CharacterBaseModelProps) {\n * super(\"___character___\", id)\n * this.defaultName = props.name\n * this.defaultSurname = props.surname\n * }\n * private defaultName: string = \"\"\n * get name(): string {\n * return this.getStorageProperty<string>(\"name\") || this.defaultName\n * }\n * set name(value: string) {\n * this.setStorageProperty<string>(\"name\", value)\n * }\n * private defaultSurname?: string\n * get surname(): string | undefined {\n * return this.getStorageProperty<string>(\"surname\") || this.defaultSurname\n * }\n * set surname(value: string | undefined) {\n * this.setStorageProperty<string>(\"surname\", value)\n * }\n * }\n * ```\n */\nexport default class StoredClassModel {\n /**\n * @param categoryId The id of the category. For example if you are storing a character class, you can use \"characters\" as categoryId. so all instances of the character class will be stored in the \"characters\" category.\n * @param id The id of instance of the class. This id must be unique for the category.\n */\n constructor(categoryId: string, id: string) {\n this.categoryId = categoryId\n this._id = id\n }\n private _id: string\n /**\n * Is id of the stored class. is unique for this class.\n */\n get id(): string {\n return this._id\n }\n private categoryId: string\n /**\n * Update a property in the storage.\n * @param propertyName The name of the property to set.\n * @param value The value to set. If is undefined, the property will be removed from the storage.\n */\n setStorageProperty<T>(propertyName: string, value: T | undefined): void {\n let storage = GameStorageManager.getVariable<any>(this.categoryId)\n if (!storage) {\n storage = {}\n }\n // if storage not have a key with the id\n if (!storage.hasOwnProperty(this.id)) {\n storage[this.id] = {}\n }\n\n if (value === undefined || value === null) {\n if (storage[this.id].hasOwnProperty(propertyName)) {\n delete storage[this.id][propertyName]\n }\n }\n else {\n storage[this.id] = { ...storage[this.id], [propertyName]: value }\n }\n\n if (Object.keys(storage[this.id]).length === 0) {\n delete storage[this.id]\n }\n\n GameStorageManager.setVariable(this.categoryId, storage)\n }\n /**\n * Get a property from the storage.\n * @param propertyName The name of the property to get.\n * @returns The value of the property. If the property is not found, returns undefined.\n */\n getStorageProperty<T>(propertyName: string): T | undefined {\n let storage = GameStorageManager.getVariable<any>(this.categoryId)\n if (storage && storage.hasOwnProperty(this.id) && storage[this.id].hasOwnProperty(propertyName)) {\n return storage[this.id][propertyName]\n }\n return undefined\n }\n}\n","import { Label } from \"../classes\"\nimport { StepLabelType } from \"../types\"\nimport { LabelIdType } from \"../types/LabelIdType\"\n\nexport const registeredLabels: { [key: LabelIdType]: Label<any> } = {}\n\n/**\n * Creates a new label and registers it in the system\n * @param id The id of the label, it must be unique\n * @param steps The steps of the label\n * @param onStepRun is a function that will be executed before any step is executed, is useful for example to make sure all images used have been cached\n * @returns The created label\n */\nexport function newLabel<T extends {} = {}>(id: LabelIdType, steps: StepLabelType<T>[], onStepRun?: () => void | Promise<void>): Label<T> {\n if (registeredLabels[id]) {\n console.warn(`[Pixi'VN] Label ${id} already exists, it will be overwritten`)\n }\n let label = new Label<T>(id, steps, onStepRun)\n registeredLabels[id] = label\n return label\n}\n\n/**\n * Gets a label by its id\n * @param id The id of the label\n * @returns The label or undefined if it does not exist\n */\nexport function getLabelById<T = Label<any>>(id: LabelIdType): T | undefined {\n let label = registeredLabels[id]\n if (!label) {\n console.error(`[Pixi'VN] Label ${id} not found`)\n return\n }\n return label as T\n}\n","import { CharacterBaseModel, DialogueBaseModel, Label } from \"../classes\";\nimport { ChoiceMenuOptionClose, HistoryChoiceMenuOption, IStoratedChoiceMenuOption } from \"../classes/ChoiceMenuOption\";\nimport newCloseLabel from \"../classes/CloseLabel\";\nimport { DialogueData } from \"../classes/DialogueBaseModel\";\nimport { getLabelById } from \"../decorators\";\nimport { DialogueHistory } from \"../interface\";\nimport { GameStepManager, GameStorageManager } from \"../managers\";\nimport { Close } from \"../types\";\nimport { ChoiceMenuOptionsType } from \"../types/ChoiceMenuOptionsType\";\n\n/**\n * Set the dialogue to be shown in the game\n * @param text Text of the dialogue\n * @example\n * ```typescript\n * setDialogue(\"Hello World\")\n * setDialogue({\n * character: \"characterId\",\n * text: \"Hello World\"\n * })\n * setDialogue(new DialogueBaseModel(\"Hello World\", character))\n * ```\n */\nexport function setDialogue<TCharacter extends CharacterBaseModel = CharacterBaseModel, TDialogue extends DialogueBaseModel = DialogueBaseModel>(props: {\n character: string | TCharacter,\n text: string,\n} | string | TDialogue): void {\n let text = ''\n let characterId: string | undefined = undefined\n let dialogue: TDialogue | DialogueBaseModel\n if (typeof props === 'string') {\n text = props\n dialogue = new DialogueBaseModel(text, characterId)\n }\n else if (!(props instanceof DialogueBaseModel)) {\n text = props.text\n if (props.character) {\n if (typeof props.character === 'string') {\n characterId = props.character\n }\n else {\n characterId = props.character.id\n }\n }\n dialogue = new DialogueBaseModel(text, characterId)\n }\n else {\n dialogue = props\n }\n\n GameStorageManager.setVariable(GameStorageManager.keysSystem.CURRENT_DIALOGUE_MEMORY_KEY, dialogue as DialogueData)\n GameStorageManager.setVariable(GameStorageManager.keysSystem.LAST_DIALOGUE_ADDED_IN_STEP_MEMORY_KEY, GameStepManager.lastStepIndex)\n}\n\n/**\n * Get the dialogue to be shown in the game\n * @returns Dialogue to be shown in the game\n */\nexport function getDialogue<T extends DialogueBaseModel = DialogueBaseModel>(): T | undefined {\n return GameStorageManager.getVariable<DialogueData>(GameStorageManager.keysSystem.CURRENT_DIALOGUE_MEMORY_KEY) as T\n}\n\n/**\n * Clear the dialogue to be shown in the game\n */\nexport function clearDialogue(): void {\n GameStorageManager.setVariable(GameStorageManager.keysSystem.CURRENT_DIALOGUE_MEMORY_KEY, undefined)\n}\n\n/**\n * Set the options to be shown in the game\n * @param options Options to be shown in the game\n * @example\n * ```typescript\n * setChoiceMenuOptions([\n * new ChoiceMenuOption(\"Events Test\", EventsTestLabel),\n * new ChoiceMenuOption(\"Show Image Test\", ShowImageTest, \"call\", { image: \"imageId\" }),\n * new ChoiceMenuOption(\"Ticker Test\", TickerTestLabel),\n * new ChoiceMenuOption(\"Tinting Test\", TintingTestLabel, \"jump\"),\n * new ChoiceMenuOption(\"Base Canvas Element Test Label\", BaseCanvasElementTestLabel)\n * ])\n * ```\n */\nexport function setChoiceMenuOptions<T extends {} = {}>(options: ChoiceMenuOptionsType<T>): void {\n let value: IStoratedChoiceMenuOption[] = options.map((option) => {\n if (option instanceof ChoiceMenuOptionClose) {\n return {\n text: option.text,\n type: Close\n }\n }\n return {\n ...option,\n label: option.label.id,\n }\n })\n GameStorageManager.setVariable(GameStorageManager.keysSystem.CURRENT_MENU_OPTIONS_MEMORY_KEY, value)\n GameStorageManager.setVariable(GameStorageManager.keysSystem.LAST_MENU_OPTIONS_ADDED_IN_STEP_MEMORY_KEY, GameStepManager.lastStepIndex)\n}\n\n/**\n * Get the options to be shown in the game\n * @returns Options to be shown in the game\n */\nexport function getChoiceMenuOptions<TChoice extends ChoiceMenuOptionsType = ChoiceMenuOptionsType<{ [key: string | number | symbol]: any }>>(): TChoice | undefined {\n let d = GameStorageManager.getVariable<IStoratedChoiceMenuOption[]>(GameStorageManager.keysSystem.CURRENT_MENU_OPTIONS_MEMORY_KEY)\n if (d) {\n let options: ChoiceMenuOptionsType = []\n d.forEach((option, index) => {\n if (option.type === Close) {\n let itemLabel = newCloseLabel(index)\n options.push({\n text: option.text,\n label: itemLabel,\n type: Close,\n props: {}\n })\n return\n }\n let label = getLabelById(option.label)\n if (label) {\n let itemLabel = new Label(label.id, label.steps, label.onStepRun, index)\n options.push({\n ...option,\n label: itemLabel\n })\n }\n })\n return options as TChoice\n }\n return undefined\n}\n\n/**\n * Clear the options to be shown in the game\n */\nexport function clearChoiceMenuOptions(): void {\n GameStorageManager.setVariable(GameStorageManager.keysSystem.CURRENT_MENU_OPTIONS_MEMORY_KEY, undefined)\n}\n\n/**\n * Get the history of the dialogues\n * @returns the history of the dialogues\n */\nexport function getDialogueHistory<T extends DialogueBaseModel = DialogueBaseModel>(): DialogueHistory<T>[] {\n let list: DialogueHistory<T>[] = []\n GameStepManager.stepsHistory.forEach((step) => {\n let dialoge = step.dialoge\n let requiredChoices = step.choices\n if (\n list.length > 0 &&\n list[list.length - 1].choices &&\n !list[list.length - 1].playerMadeChoice &&\n step.currentLabel\n ) {\n let oldChoices = list[list.length - 1].choices\n if (oldChoices) {\n let choiceMade = false\n if (step.choiceIndexMade !== undefined && oldChoices.length > step.choiceIndexMade) {\n oldChoices[step.choiceIndexMade].isResponse = true\n choiceMade = true\n }\n list[list.length - 1].playerMadeChoice = choiceMade\n list[list.length - 1].choices = oldChoices\n }\n }\n if (dialoge || requiredChoices) {\n let choices: HistoryChoiceMenuOption[] | undefined = requiredChoices?.map((choice) => {\n return {\n text: choice.text,\n type: choice.type,\n isResponse: false\n }\n })\n list.push({\n dialoge: dialoge as T,\n playerMadeChoice: false,\n choices: choices,\n stepIndex: step.index\n })\n }\n })\n return list\n}\n","import { Ticker, UPDATE_PRIORITY } from \"pixi.js\"\nimport ITicker from \"../../interface/ITicker\"\nimport { StorageElementType } from \"../../types/StorageElementType\"\n\nexport type TickerArgsType = { [id: string]: StorageElementType }\n\n/**\n * A class is used to create a ticker element to add into a Pixi Application.\n * You can use GameWindowManager.addTicker() to add this element into the application.\n * This class should be extended and the fn method should be overridden.\n * You must use the tickerDecorator to register the ticker in the game.\n * In Ren'Py is a transform.\n * @example\n * ```typescript\n * \\@tickerDecorator() // this is equivalent to tickerDecorator(\"TickerRotate\")\n * export class TickerRotate extends TickerBase<{ speed?: number }> {\n * override fn(\n * t: Ticker,\n * args: {\n * speed?: number,\n * },\n * tags: string[]\n * ): void {\n * let speed = args.speed === undefined ? 0.1 : args.speed\n * tags.forEach((tag) => {\n * let element = GameWindowManager.getCanvasElement(tag)\n * if (element && element instanceof Container) {\n * if (clockwise)\n * element.rotation += speed * t.deltaTime\n * else\n * element.rotation -= speed * t.deltaTime\n * }\n * })\n * }\n * }\n * ```\n */\nexport default class TickerBase<TArgs extends TickerArgsType> implements ITicker<TArgs> {\n /**\n * @param args The arguments that you want to pass to the ticker.\n * @param duration The duration of the ticker. If is undefined, the ticker will be called every frame.\n * @param priority The priority of the ticker. If is undefined, the priority will be UPDATE_PRIORITY.NORMAL.\n */\n constructor(args: TArgs, duration?: number, priority?: UPDATE_PRIORITY) {\n this.args = args\n this.duration = duration\n this.priority = priority\n }\n args: TArgs\n duration?: number\n priority?: UPDATE_PRIORITY\n /**\n * The method that will be called every frame.\n * This method should be overridden and you can use GameWindowManager.addCanvasElement() to get the canvas element of the canvas, and edit them.\n * @param t The ticker that is calling this method\n * @param args The arguments that you passed when you added the ticker\n * @param tags The tags of the canvas elements that are connected to this ticker\n */\n fn(_t: Ticker, _args: TArgs, _tags: string | string[]): void { throw new Error(\"[Pixi'VN] The method TickerBase.fn() must be overridden\") }\n}\n","import { Container, Sprite, Ticker } from \"pixi.js\";\nimport { tickerDecorator } from \"../../decorators\";\nimport { GameWindowManager } from \"../../managers\";\nimport { TickerFadeAlphaProps } from \"../../types/ticker/TickerFadeAlphaProps\";\nimport TickerBase from \"./TickerBase\";\n\n/**\n * A ticker that fades the alpha of the canvas element of the canvas.\n * @example\n * ```typescript\n * let bunny = addImage(\"bunny1\", \"https://pixijs.com/assets/eggHead.png\")\n * await bunny.load()\n * GameWindowManager.addCanvasElement(\"bunny\", bunny);\n * // ...\n * const ticker = new TickerFadeAlpha({\n * speed: 0.01,\n * type: \"hide\",\n * }),\n * GameWindowManager.addTicker(\"bunny\", ticker)\n * ```\n */\n@tickerDecorator()\nexport default class TickerFadeAlpha extends TickerBase<TickerFadeAlphaProps> {\n /**\n * The method that will be called every frame to fade the alpha of the canvas element of the canvas.\n * @param delta The delta time\n * @param args The arguments that are passed to the ticker\n * @param tags The tags of the canvas element that are connected to this ticker\n */\n override fn(\n t: Ticker,\n args: TickerFadeAlphaProps,\n tags: string[]\n ): void {\n let type = args.type === undefined ? \"hide\" : args.type\n let speed = args.speed === undefined ? 0.1 : args.speed\n let limit = args.limit === undefined ? type === \"hide\" ? 0 : 1 : args.limit\n let removeElementAfter = args.tagToRemoveAfter || []\n if (typeof removeElementAfter === \"string\") {\n removeElementAfter = [removeElementAfter]\n }\n if (type === \"hide\" && limit < 0) {\n limit = 0\n }\n if (type === \"show\" && limit > 1) {\n limit = 1\n }\n tags\n .filter((tag) => {\n let element = GameWindowManager.getCanvasElement(tag)\n if (args.startOnlyIfHaveTexture) {\n if (element && element instanceof Sprite && element.texture?.label == \"EMPTY\") {\n return false\n }\n }\n return true\n })\n .forEach((tag) => {\n let element = GameWindowManager.getCanvasElement(tag)\n if (element && element instanceof Container) {\n if (type === \"show\" && element.alpha < limit) {\n element.alpha += speed * t.deltaTime\n }\n else if (type === \"hide\" && element.alpha > limit) {\n element.alpha -= speed * t.deltaTime\n }\n else {\n element.alpha = limit\n GameWindowManager.removeAssociationBetweenTickerCanvasElement(tag, this)\n GameWindowManager.removeCanvasElement(removeElementAfter)\n }\n }\n })\n }\n}\n","import { Container, Sprite, Ticker } from \"pixi.js\";\nimport { tickerDecorator } from \"../../decorators\";\nimport { updateTickerProgression } from \"../../functions/TickerUtility\";\nimport { GameWindowManager } from \"../../managers\";\nimport { TickerMoveProps } from \"../../types/ticker/TickerMoveProps\";\nimport TickerBase from \"./TickerBase\";\n\n/**\n * A ticker that moves the canvas element of the canvas.\n * @example\n * ```typescript\n * let alien = addImage(\"alien\", 'https://pixijs.com/assets/eggHead.png')\n * GameWindowManager.addCanvasElement(\"alien\", alien);\n * const ticker = new TickerMove({\n * speed: 0.1,\n * destination: { x: 100, y: 100 },\n * }),\n * ```\n */\n@tickerDecorator()\nexport default class TickerMove extends TickerBase<TickerMoveProps> {\n /**\n * The method that will be called every frame to move the canvas element of the canvas.\n * @param t The ticker that is calling this method\n * @param args The arguments that are passed to the ticker\n * @param tags The tags of the canvas element that are connected to this ticker\n */\n override fn(\n t: Ticker,\n args: TickerMoveProps,\n tags: string[]\n ): void {\n let speed = args.speed === undefined ? 0.1 : args.speed\n let destination = args.destination\n tags\n .filter((tag) => {\n let element = GameWindowManager.getCanvasElement(tag)\n if (args.startOnlyIfHaveTexture) {\n if (element && element instanceof Sprite && element.texture?.label == \"EMPTY\") {\n return false\n }\n }\n return true\n })\n .forEach((tag) => {\n let element = GameWindowManager.getCanvasElement(tag)\n if (element && element instanceof Container) {\n let xDistance = destination.x - element.x\n if (xDistance != 0) {\n element.x += xDistance / speed * t.deltaTime\n let newDistance = destination.x - element.x\n if (xDistance < 0 && newDistance > 0 ||\n xDistance > 0 && newDistance < 0\n ) {\n element.x = destination.x\n }\n }\n let yDistance = destination.y - element.y\n if (yDistance != 0) {\n element.y += yDistance / speed * t.deltaTime\n let newDistance = destination.y - element.y\n if (yDistance < 0 && newDistance > 0 ||\n yDistance > 0 && newDistance < 0\n ) {\n element.y = destination.y\n }\n }\n }\n })\n if (args.speedProgression)\n updateTickerProgression(args, \"speed\", args.speedProgression)\n }\n}\n","import { TickerProgrationType } from \"../interface/TickerProgrationType\"\n\n/**\n * This function updates the progression of the ticker.\n * For example, if the speed of the ticker is 0.1 and the progression is 0.01, then the speed will be 0.11.\n * @param args The arguments that are passed to the ticker\n * @param propertyName The property name that will be updated \n * @param progression The progression of the ticker\n * @returns \n */\nexport function updateTickerProgression(args: any, propertyName: string, progression: TickerProgrationType) {\n if (args.hasOwnProperty(propertyName) && typeof args[propertyName] !== \"number\") {\n return\n }\n if (args[propertyName] !== undefined\n && progression\n && args[propertyName] !== progression.limit\n ) {\n if (progression.type === \"linear\") {\n args[propertyName] += progression.amt\n if (progression.limit !== undefined) {\n if (args[propertyName] > progression.limit && progression.amt > 0) {\n args[propertyName] = progression.limit\n }\n else if (args[propertyName] < progression.limit && progression.amt < 0) {\n args[propertyName] = progression.limit\n }\n }\n }\n else if (progression.type === \"exponential\") {\n args[propertyName] += args[propertyName] * progression.percentage\n if (progression.limit !== undefined) {\n if (args[propertyName] > progression.limit && progression.percentage > 0) {\n args[propertyName] = progression.limit\n }\n else if (args[propertyName] < progression.limit && progression.percentage < 0) {\n args[propertyName] = progression.limit\n }\n }\n }\n }\n}\n","import { Container, Sprite, Ticker } from \"pixi.js\";\nimport { tickerDecorator } from \"../../decorators\";\nimport { updateTickerProgression } from \"../../functions/TickerUtility\";\nimport { GameWindowManager } from \"../../managers\";\nimport { TickerRotateProps } from \"../../types/ticker/TickerRotateProps\";\nimport TickerBase from \"./TickerBase\";\n\n/**\n * A ticker that rotates the canvas element of the canvas.\n * @example\n * ```typescript\n * let alien = addImage(\"alien\", 'https://pixijs.com/assets/eggHead.png')\n * GameWindowManager.addCanvasElement(\"alien\", alien);\n * const ticker = new TickerRotate({\n * speed: 0.1,\n * clockwise: true,\n * }),\n * GameWindowManager.addTicker(\"alien\", ticker)\n * ```\n */\n@tickerDecorator()\nexport default class TickerRotate extends TickerBase<TickerRotateProps> {\n /**\n * The method that will be called every frame to rotate the canvas element of the canvas.\n * @param delta The delta time\n * @param args The arguments that are passed to the ticker\n * @param tags The tags of the canvas element that are connected to this ticker\n */\n override fn(\n t: Ticker,\n args: TickerRotateProps,\n tags: string[]\n ): void {\n let speed = args.speed === undefined ? 0.1 : args.speed\n let clockwise = args.clockwise === undefined ? true : args.clockwise\n tags\n .filter((tag) => {\n let element = GameWindowManager.getCanvasElement(tag)\n if (args.startOnlyIfHaveTexture) {\n if (element && element instanceof Sprite && element.texture?.label == \"EMPTY\") {\n return false\n }\n }\n return true\n })\n .forEach((tag) => {\n let element = GameWindowManager.getCanvasElement(tag)\n if (element && element instanceof Container) {\n if (clockwise)\n element.rotation += speed * t.deltaTime\n else\n element.rotation -= speed * t.deltaTime\n }\n })\n if (args.speedProgression)\n updateTickerProgression(args, \"speed\", args.speedProgression)\n }\n}\n","/**\n * This function is used to create a deep copy of the element\n * @param element The element to be copied\n * @returns The copied element\n */\nexport function createExportableElement<T>(element: T): T {\n try {\n let elementString = JSON.stringify(element)\n return JSON.parse(elementString)\n }\n catch (e) {\n console.error(\"[Pixi'VN] Error creating exportable element\", e)\n throw new Error(\"[Pixi'VN] Error creating exportable element\")\n }\n}\n","import deepDiff from \"deep-diff\"\nimport { createExportableElement } from \"./ExportUtility\"\n\nexport function restoreDeepDiffChanges<T extends object = object>(data: T, differences: deepDiff.Diff<T, T>[]): T {\n let result = createExportableElement(data)\n differences.forEach((diff) => {\n let dataToEdit: any = result\n if (diff.path && diff.path.length > 0) {\n diff.path.forEach((path, index) => {\n if (diff.path && index === diff.path.length - 1) {\n if (diff.kind === \"E\" || diff.kind === \"D\") {\n dataToEdit[path] = diff.lhs\n }\n else if (diff.kind === \"N\") {\n // if path is a number, dataToEdit is an array\n if (Number.isInteger(path)) {\n // remove index from array\n if (Array.isArray(dataToEdit)) {\n dataToEdit.splice(path, 1)\n }\n }\n // if path is a string, dataToEdit is an object\n else if (typeof path === \"string\") {\n // remove key from object\n delete dataToEdit[path]\n }\n }\n else if (diff.kind === \"A\") {\n let index = diff.index\n if (diff.item.kind === \"N\") {\n // remove index from array\n (dataToEdit[path] as any[]).splice(index, 1)\n }\n else if (diff.item.kind === \"E\" || diff.item.kind === \"D\") {\n // edit index in array\n (dataToEdit[path] as any[])[index] = diff.item.lhs\n }\n else if (diff.item.kind === \"A\") {\n console.warn(\"[Pixi'VN] Nested array found, skipping diff\", diff)\n }\n else {\n console.warn(\"[Pixi'VN] No array found, skipping diff\", diff)\n }\n }\n }\n else {\n dataToEdit = dataToEdit[path]\n }\n })\n }\n else {\n console.warn(\"[Pixi'VN] No path found, skipping diff\", diff)\n }\n })\n return result\n}","import { createExportableElement } from \"../functions/ExportUtility\"\nimport { ExportedStorage } from \"../interface/export\"\nimport { StorageElementType } from \"../types/StorageElementType\"\n\nexport default class GameStorageManager {\n private static storage: { [key: string]: StorageElementType } = {}\n private constructor() { }\n public static get keysSystem() {\n return {\n CURRENT_DIALOGUE_MEMORY_KEY: \"___current_dialogue_memory___\",\n LAST_DIALOGUE_ADDED_IN_STEP_MEMORY_KEY: \"___last_dialogue_added_in_step_memory___\",\n CURRENT_MENU_OPTIONS_MEMORY_KEY: \"___current_menu_options_memory___\",\n LAST_MENU_OPTIONS_ADDED_IN_STEP_MEMORY_KEY: \"___last_menu_options_added_in_step_memory___\",\n CHARACTER_CATEGORY_KEY: \"___character___\",\n FLAGS_CATEGORY_KEY: \"___flags___\",\n }\n }\n /**\n * Set a variable in the storage\n * @param key The key of the variable\n * @param value The value of the variable. If undefined, the variable will be removed\n * @returns\n */\n public static setVariable(key: string, value: StorageElementType) {\n key = key.toLowerCase()\n if (value === undefined || value === null) {\n if (GameStorageManager.storage.hasOwnProperty(key)) {\n delete GameStorageManager.storage[key]\n }\n return\n }\n GameStorageManager.storage[key] = value\n }\n /**\n * Get a variable from the storage\n * @param key The key of the variable\n * @returns The value of the variable. If the variable does not exist, it will return undefined\n */\n public static getVariable<T extends StorageElementType>(key: string): T | undefined {\n key = key.toLowerCase()\n if (GameStorageManager.storage.hasOwnProperty(key)) {\n return GameStorageManager.storage[key] as T\n }\n return undefined\n }\n /**\n * Remove a variable from the storage\n * @param key The key of the variable\n * @returns\n */\n public static removeVariable(key: string) {\n key = key.toLowerCase()\n if (GameStorageManager.storage.hasOwnProperty(key)) {\n delete GameStorageManager.storage[key]\n }\n }\n /**\n * Clear the storage and the oidsUsed\n * @returns\n */\n public static clear() {\n GameStorageManager.storage = {}\n }\n public static exportJson(): string {\n return JSON.stringify(this.export())\n }\n public static export(): ExportedStorage {\n return createExportableElement(GameStorageManager.storage)\n }\n public static importJson(dataString: string) {\n GameStorageManager.import(JSON.parse(dataString))\n }\n public static import(data: object) {\n GameStorageManager.clear()\n try {\n if (data) {\n GameStorageManager.storage = (data as ExportedStorage)\n }\n else {\n console.warn(\"[Pixi'VN] No storage data found\")\n }\n }\n catch (e) {\n console.error(\"[Pixi'VN] Error importing data\", e)\n }\n }\n}\n","import { Application, ApplicationOptions, Container, Ticker } from \"pixi.js\";\nimport CanvasBase from \"../classes/canvas/CanvasBase\";\nimport TickerBase, { TickerArgsType } from \"../classes/ticker/TickerBase\";\nimport { geTickerInstanceByClassName } from \"../decorators/TickerDecorator\";\nimport { exportCanvasElement, importCanvasElement } from \"../functions/CanvasUtility\";\nimport { asciiArtLog } from \"../functions/EasterEgg\";\nimport { createExportableElement } from \"../functions/ExportUtility\";\nimport { ITicker, ITickersSteps } from \"../interface\";\nimport { IClassWithArgsHistory } from \"../interface/IClassWithArgsHistory\";\nimport { ITickersStep } from \"../interface/ITickersSteps\";\nimport { ICanvasBaseMemory } from \"../interface/canvas\";\nimport { ExportedCanvas } from \"../interface/export\";\nimport { PauseType, PauseValueType } from \"../types/PauseType\";\nimport { Repeat, RepeatType } from \"../types/RepeatType\";\nimport { TickerIdType } from \"../types/TickerIdType\";\n\n/**\n * This class is responsible for managing the canvas, the tickers, the events, and the window size and the children of the window.\n */\nexport default class GameWindowManager {\n private constructor() { }\n\n private static _app: Application | undefined = undefined\n /**\n * The PIXI Application instance.\n * It not recommended to use this property directly.\n */\n static get app() {\n if (!GameWindowManager._app) {\n throw new Error(\"[Pixi'VN] GameWindowManager.app is undefined\")\n }\n return GameWindowManager._app\n }\n private static _isInitialized: boolean = false\n /**\n * If the manager is initialized.\n */\n static get isInitialized() {\n return GameWindowManager._isInitialized\n }\n /**\n * This is the div that have same size of the canvas.\n * This is useful to put interface elements.\n * You can use React or other framework to put elements in this div.\n */\n static htmlLayout: HTMLElement\n static canvasWidth: number\n static canvasHeight: number\n static get screen() {\n return GameWindowManager.app.screen\n }\n\n /**\n * Initialize the PIXI Application and the interface div.\n * This method should be called before any other method.\n * @param element The html element where I will put the canvas. Example: document.body\n * @param width The width of the canvas\n * @param height The height of the canvas\n * @param options The options of PIXI Application\n * @example\n * ```typescript\n * const body = document.body\n * if (!body) {\n * throw new Error('body element not found')\n * }\n * await GameWindowManager.initialize(body, 1920, 1080, {\n * backgroundColor: \"#303030\"\n * })\n * ```\n */\n public static async initialize(element: HTMLElement, width: number, height: number, options?: Partial<ApplicationOptions>): Promise<void> {\n GameWindowManager.canvasWidth = width\n GameWindowManager.canvasHeight = height\n GameWindowManager._app = new Application()\n return GameWindowManager.app.init({\n resolution: window.devicePixelRatio || 1,\n autoDensity: true,\n width: width,\n height: height,\n ...options\n }).then(() => {\n GameWindowManager._isInitialized = true\n // Manager.app.ticker.add(Manager.update)\n this.addCanvasIntoElement(element)\n // listen for the browser telling us that the screen size changed\n window.addEventListener(\"resize\", GameWindowManager.resize)\n\n // call it manually once so we are sure we are the correct size after starting\n GameWindowManager.resize()\n\n asciiArtLog()\n });\n }\n\n /**\n * Add the canvas into a html element.\n * @param element it is the html element where I will put the canvas. Example: document.body\n */\n private static addCanvasIntoElement(element: HTMLElement) {\n if (GameWindowManager.isInitialized) {\n element.appendChild(GameWindowManager.app.canvas as HTMLCanvasElement)\n }\n else {\n console.error(\"[Pixi'VN] GameWindowManager is not initialized\")\n }\n }\n /**\n * Initialize the interface div and add it into a html element.\n * @param element it is the html element where I will put the interface div. Example: document.getElementById('root')\n * @example\n * ```typescript\n * const root = document.getElementById('root')\n * if (!root) {\n * throw new Error('root element not found')\n * }\n * GameWindowManager.initializeHTMLLayout(root)\n * const reactRoot = createRoot(GameWindowManager.htmlLayout)\n * reactRoot.render(\n * <App />\n * )\n * ```\n */\n public static initializeHTMLLayout(element: HTMLElement) {\n let div = document.createElement('div')\n div.style.position = 'absolute'\n div.style.pointerEvents = 'none'\n element.appendChild(div)\n GameWindowManager.htmlLayout = div\n GameWindowManager.resize()\n }\n\n /* Resize Metods */\n\n /**\n * This method returns the scale of the screen.\n */\n public static get screenScale() {\n let screenWidth = Math.max(document.documentElement.clientWidth, window.innerWidth || 0)\n let screenHeight = Math.max(document.documentElement.clientHeight, window.innerHeight || 0)\n return Math.min(screenWidth / GameWindowManager.canvasWidth, screenHeight / GameWindowManager.canvasHeight)\n }\n /**\n * This method returns the width of the screen enlarged by the scale.\n */\n public static get screenWidth() {\n return Math.floor(GameWindowManager.screenScale * GameWindowManager.canvasWidth)\n }\n /**\n * This method returns the height of the screen enlarged by the scale.\n */\n public static get screenHeight() {\n return Math.floor(GameWindowManager.screenScale * GameWindowManager.canvasHeight)\n }\n /**\n * This method returns the horizontal margin of the screen.\n */\n public static get horizontalMargin() {\n let screenWidth = Math.max(document.documentElement.clientWidth, window.innerWidth || 0)\n return (screenWidth - GameWindowManager.screenWidth) / 2\n }\n /**\n * This method returns the vertical margin of the screen.\n */\n public static get verticalMargin() {\n let screenHeight = Math.max(document.documentElement.clientHeight, window.innerHeight || 0)\n return (screenHeight - GameWindowManager.screenHeight) / 2\n }\n /**\n * This method is called when the screen is resized.\n */\n private static resize(): void {\n // now we use css trickery to set the sizes and margins\n if (GameWindowManager.isInitialized) {\n let style = GameWindowManager.app.canvas.style;\n style.width = `${GameWindowManager.screenWidth}px`;\n style.height = `${GameWindowManager.screenHeight}px`;\n (style as any).marginLeft = `${GameWindowManager.horizontalMargin}px`;\n (style as any).marginRight = `${GameWindowManager.horizontalMargin}px`;\n (style as any).marginTop = `${GameWindowManager.verticalMargin}px`;\n (style as any).marginBottom = `${GameWindowManager.verticalMargin}px`;\n }\n\n if (GameWindowManager.htmlLayout) {\n GameWindowManager.htmlLayout.style.width = `${GameWindowManager.screenWidth}px`\n GameWindowManager.htmlLayout.style.height = `${GameWindowManager.screenHeight}px`\n GameWindowManager.htmlLayout.style.marginLeft = `${GameWindowManager.horizontalMargin}px`\n GameWindowManager.htmlLayout.style.marginRight = `${GameWindowManager.horizontalMargin}px`\n GameWindowManager.htmlLayout.style.marginTop = `${GameWindowManager.verticalMargin}px`\n GameWindowManager.htmlLayout.style.marginBottom = `${GameWindowManager.verticalMargin}px`\n }\n }\n\n /* Edit Canvas Elements Methods */\n\n /**\n * This is a dictionary that contains all Canvas Elements of Canvas, currently.\n */\n static get currentCanvasElements() {\n return GameWindowManager._children\n }\n private static _children: { [tag: string]: CanvasBase<any> } = {}\n /**\n * The order of the children tags.\n */\n private static childrenTagsOrder: string[] = []\n /**\n * Add a canvas element to the canvas.\n * If there is a canvas element with the same tag, it will be removed.\n * @param tag The tag of the canvas element.\n * @param canvasElement The canvas elements to be added.\n * @example\n * ```typescript\n * const texture = await Assets.load('https://pixijs.com/assets/bunny.png');\n * const sprite = CanvasSprite.from(texture);\n * GameWindowManager.addCanvasElement(\"bunny\", sprite);\n * ```\n */\n public static addCanvasElement(tag: string, canvasElement: CanvasBase<any>) {\n if (GameWindowManager._children[tag]) {\n GameWindowManager.removeCanvasElement(tag)\n }\n GameWindowManager.app.stage.addChild(canvasElement)\n GameWindowManager._children[tag] = canvasElement\n GameWindowManager.childrenTagsOrder.push(tag)\n }\n /**\n * Remove a canvas element from the canvas.\n * And remove all tickers that are not connected to any canvas element.\n * @param tag The tag of the canvas element to be removed.\n * @returns \n * @example\n * ```typescript\n * GameWindowManager.removeCanvasElement(\"bunny\");\n * ```\n */\n public static removeCanvasElement(tag: string | string[]) {\n if (typeof tag === \"string\") {\n tag = [tag]\n }\n tag.forEach((t) => {\n if (GameWindowManager._children[t]) {\n GameWindowManager.app.stage.removeChild(GameWindowManager._children[t])\n delete GameWindowManager._children[t]\n }\n })\n GameWindowManager.removeTickersWithoutAssociatedCanvasElement()\n GameWindowManager.childrenTagsOrder = GameWindowManager.childrenTagsOrder.filter((t) => !tag.includes(t))\n }\n /**\n * Get a canvas element by the tag.\n * @param tag The tag of the canvas element.\n * @returns The canvas element.\n * @example\n * ```typescript\n * const sprite = GameWindowManager.getCanvasElement<CanvasSprite>(\"bunny\");\n * ```\n */\n public static getCanvasElement<T extends CanvasBase<any>>(tag: string): T | undefined {\n return GameWindowManager._children[tag] as T | undefined\n }\n /**\n * Check if a DisplayObject is on the canvas.\n * @param pixiElement The DisplayObject to be checked.\n * @returns If the DisplayObject is on the canvas.\n */\n public static canvasElementIsOnCanvas<T extends Container>(pixiElement: T) {\n return GameWindowManager.app.stage.children.includes(pixiElement)\n }\n /**\n * Remove all canvas elements from the canvas.\n * And remove all tickers that are not connected to any canvas element.\n */\n public static removeCanvasElements() {\n GameWindowManager.app.stage.removeChildren()\n GameWindowManager._children = {}\n GameWindowManager.childrenTagsOrder = []\n GameWindowManager.removeTickers()\n }\n /**\n * Edit the tag of a canvas element.\n * @param oldTag The old tag of the canvas element.\n * @param newTag The new tag of the canvas element.\n */\n public static editTagCanvasElement(oldTag: string, newTag: string) {\n if (GameWindowManager._children[oldTag]) {\n GameWindowManager._children[newTag] = GameWindowManager._children[oldTag]\n delete GameWindowManager._children[oldTag]\n }\n }\n\n /** Edit Tickers Methods */\n\n /**\n * Currently tickers that are running.\n */\n public static get currentTickers() {\n return GameWindowManager._currentTickers\n }\n private static _currentTickers: IClassWithArgsHistory<any>[] = []\n /**\n * The steps of the tickers\n */\n public static get currentTickersSteps() {\n return GameWindowManager._currentTickersSteps\n }\n private static _currentTickersSteps: { [tag: string]: ITickersSteps } = {}\n static currentTickersTimeouts: { [timeout: string]: { tags: string[], ticker: string } } = {}\n /**\n * Run a ticker.\n * @param canvasEslementTag The tag of the canvas element that will use the ticker.\n * @param ticker The ticker class to be run.\n * @param args The arguments to be used in the ticker.\n * @param duration The time to be used in the ticker. This number is in milliseconds. If it is undefined, the ticker will run forever.\n * @param priority The priority to be used in the ticker.\n * @returns \n * @example\n * ```typescript\n * GameWindowManager.addTicker(\"alien\", new TickerRotate({ speed: 0.2 }))\n * ```\n */\n static addTicker<TArgs extends TickerArgsType>(canvasElementTag: string | string[], ticker: TickerBase<TArgs>) {\n let tickerName: TickerIdType = ticker.constructor.name\n if (typeof canvasElementTag === \"string\") {\n canvasElementTag = [canvasElementTag]\n }\n let t = geTickerInstanceByClassName<TArgs>(tickerName, ticker.args, ticker.duration, ticker.priority)\n if (!t) {\n console.error(`[Pixi'VN] Ticker ${tickerName} not found`)\n return\n }\n GameWindowManager.removeAssociationBetweenTickerCanvasElement(canvasElementTag, ticker)\n let tickerHistory: IClassWithArgsHistory<TArgs> = {\n fn: () => { },\n className: tickerName,\n args: ticker.args,\n canvasElementTags: canvasElementTag,\n priority: ticker.priority,\n duration: ticker.duration,\n }\n GameWindowManager.pushTicker(tickerHistory, t)\n GameWindowManager.removeTickersWithoutAssociatedCanvasElement()\n if (ticker.duration) {\n let timeout = setTimeout(() => {\n GameWindowManager.removeTickerTimeoutInfo(timeout)\n GameWindowManager.nextTickerStep(canvasElementTag)\n }, ticker.duration);\n GameWindowManager.addTickerTimeoutInfo(canvasElementTag, tickerName, timeout.toString())\n }\n }\n private static pushTicker<TArgs extends TickerArgsType>(tickerData: IClassWithArgsHistory<TArgs>, ticker: TickerBase<TArgs>) {\n GameWindowManager.removeAssociationBetweenTickerCanvasElement(tickerData.canvasElementTags, tickerData)\n GameWindowManager._currentTickers.push(tickerData)\n tickerData.fn = (t: Ticker) => {\n ticker?.fn(t, tickerData.args, tickerData.canvasElementTags)\n }\n GameWindowManager.app.ticker.add(tickerData.fn, undefined, tickerData.priority)\n }\n /**\n * Run a sequence of tickers.\n * @param tag The tag of canvas element that will use the tickers.\n * @param steps The steps of the tickers.\n * @returns\n * @example\n * ```typescript\n * GameWindowManager.addTickersSteps(\"alien\", [\n * new TickerRotate({ speed: 0.1, clockwise: true }, 2000),\n * Pause(500),\n * new TickerRotate({ speed: 0.2, clockwise: false }, 2000),\n * Repeat,\n * ])\n * ```\n */\n static addTickersSteps<TArgs extends TickerArgsType>(tag: string, steps: (ITicker<TArgs> | RepeatType | PauseType)[]) {\n if (steps.length == 0) {\n console.warn(\"[Pixi'VN] The steps of the tickers is empty\")\n return\n }\n let alredyExists = GameWindowManager._currentTickersSteps[tag] !== undefined\n GameWindowManager._currentTickersSteps[tag] = {\n currentStepNumber: 0,\n steps: steps.map((s) => {\n if (s === Repeat) {\n return s\n }\n if (!s.duration) {\n console.warn(\"[Pixi'VN] Duration is not defined, so it will be set to 1000\")\n s.duration = 1000\n }\n if (s.hasOwnProperty(\"type\") && (s as PauseType).type === PauseValueType) {\n return s as PauseType\n }\n let tickerName = s.constructor.name\n return {\n ticker: tickerName,\n args: (s as ITicker<TArgs>).args,\n duration: s.duration,\n }\n })\n }\n if (!alredyExists) {\n GameWindowManager.runTickersSteps(tag)\n }\n }\n private static runTickersSteps<TArgs extends TickerArgsType>(tag: string) {\n let step = GameWindowManager._currentTickersSteps[tag].steps[GameWindowManager._currentTickersSteps[tag].currentStepNumber]\n if (step === Repeat) {\n step = GameWindowManager._currentTickersSteps[tag].steps[0]\n GameWindowManager._currentTickersSteps[tag].currentStepNumber = 0\n if (step === Repeat) {\n console.error(\"[Pixi'VN] TikersSteps has a RepeatType in the first step\")\n return\n }\n }\n if (step.hasOwnProperty(\"type\") && (step as PauseType).type === PauseValueType) {\n let timeout = setTimeout(() => {\n GameWindowManager.removeTickerTimeoutInfo(timeout)\n GameWindowManager.nextTickerStep(tag)\n }, step.duration);\n GameWindowManager.addTickerTimeoutInfo(tag, \"steps\", timeout.toString())\n return\n }\n let ticker = geTickerInstanceByClassName<TArgs>((step as ITickersStep<TArgs>).ticker, (step as ITickersStep<TArgs>).args, step.duration, (step as ITickersStep<TArgs>).priority)\n if (!ticker) {\n console.error(`[Pixi'VN] Ticker ${(step as ITickersStep<TArgs>).ticker} not found`)\n return\n }\n GameWindowManager.addTicker(tag, ticker)\n }\n private static nextTickerStep(tag: string | string[]) {\n if (typeof tag === \"string\") {\n tag = [tag]\n }\n tag.forEach((tag) => {\n if (GameWindowManager._currentTickersSteps[tag]) {\n let steps = GameWindowManager._currentTickersSteps[tag]\n if (steps.currentStepNumber + 1 < steps.steps.length) {\n steps.currentStepNumber++\n GameWindowManager._currentTickersSteps[tag] = steps\n GameWindowManager.runTickersSteps(tag)\n }\n else {\n delete GameWindowManager._currentTickersSteps[tag]\n }\n }\n })\n }\n /**\n * Remove a connection between a canvas element and a ticker.\n * And remove the ticker if there is no canvas element connected to it.\n * @param tag The tag of the canvas element that will use the ticker.\n * @param ticker The ticker class to be removed.\n * @example\n * ```typescript\n * GameWindowManager.removeAssociationBetweenTickerCanvasElement(\"alien\", TickerRotate)\n * ```\n */\n public static removeAssociationBetweenTickerCanvasElement(tag: string | string[], ticker: typeof TickerBase<any> | TickerBase<any>) {\n let tickerName: TickerIdType\n if (ticker instanceof TickerBase) {\n tickerName = ticker.constructor.name\n }\n else {\n tickerName = ticker.name\n }\n if (typeof tag === \"string\") {\n tag = [tag]\n }\n GameWindowManager._currentTickers = GameWindowManager._currentTickers.map((t) => {\n if (t.className === tickerName) {\n t.canvasElementTags = t.canvasElementTags.filter((e) => !tag.includes(e))\n }\n return t\n })\n for (let timeout in GameWindowManager.currentTickersTimeouts) {\n let t = GameWindowManager.currentTickersTimeouts[timeout].tags.filter((e) => !tag.includes(e))\n if (t.length == 0) {\n GameWindowManager.removeTickerTimeoutInfo(timeout)\n }\n else {\n GameWindowManager.currentTickersTimeouts[timeout].tags = t\n }\n }\n GameWindowManager.removeTickersWithoutAssociatedCanvasElement()\n }\n /**\n * Remove all tickers that are not connected to any existing canvas element.\n */\n private static removeTickersWithoutAssociatedCanvasElement() {\n let currentTickers = GameWindowManager._currentTickers\n .map((t) => {\n t.canvasElementTags = t.canvasElementTags.filter((e) => GameWindowManager._children[e])\n return t\n })\n currentTickers.filter((t) => t.canvasElementTags.length === 0).forEach((t) => {\n GameWindowManager.app.ticker.remove(t.fn)\n })\n currentTickers = currentTickers.filter((t) => t.canvasElementTags.length > 0)\n GameWindowManager._currentTickers = currentTickers\n for (let tag in GameWindowManager._currentTickersSteps) {\n if (GameWindowManager._children[tag] === undefined) {\n delete GameWindowManager._currentTickersSteps[tag]\n }\n }\n }\n private static addTickerTimeoutInfo(tags: string | string[], ticker: string, timeout: string) {\n if (typeof tags === \"string\") {\n tags = [tags]\n }\n GameWindowManager.currentTickersTimeouts[timeout] = {\n tags: tags,\n ticker: ticker,\n }\n }\n private static removeTickerTimeoutInfo(timeout: NodeJS.Timeout | string) {\n if (typeof timeout !== \"string\") {\n timeout = timeout.toString()\n }\n if (GameWindowManager.currentTickersTimeouts[timeout]) {\n delete GameWindowManager.currentTickersTimeouts[timeout]\n }\n }\n /**\n * Remove all tickers from the canvas.\n */\n public static removeTickers() {\n GameWindowManager._currentTickersSteps = {}\n GameWindowManager._currentTickers.forEach((t) => {\n GameWindowManager.app.ticker.remove(t.fn)\n })\n GameWindowManager._currentTickers = []\n for (let timeout in GameWindowManager.currentTickersTimeouts) {\n GameWindowManager.removeTickerTimeoutInfo(timeout)\n }\n }\n\n /**\n * Clear the canvas and the tickers.\n */\n static clear() {\n GameWindowManager.removeCanvasElements()\n }\n\n /* Export and Import Methods */\n\n /**\n * Export the canvas and the tickers to a JSON string.\n * @returns The JSON string.\n */\n public static exportJson(): string {\n return JSON.stringify(this.export())\n }\n /**\n * Export the canvas and the tickers to an object.\n * @returns The object.\n */\n public static export(): ExportedCanvas {\n let currentElements: { [tag: string]: ICanvasBaseMemory } = {}\n for (let tag in GameWindowManager._children) {\n currentElements[tag] = exportCanvasElement(GameWindowManager._children[tag])\n }\n return {\n currentTickers: createExportableElement(GameWindowManager._currentTickers),\n currentElements: createExportableElement(currentElements),\n childrenTagsOrder: createExportableElement(GameWindowManager.childrenTagsOrder),\n }\n }\n /**\n * Import the canvas and the tickers from a JSON string.\n * @param dataString The JSON string.\n */\n public static importJson(dataString: string) {\n GameWindowManager.import(JSON.parse(dataString))\n }\n /**\n * Import the canvas and the tickers from an object.\n * @param data The object.\n */\n public static import(data: object) {\n GameWindowManager.clear()\n try {\n if (data.hasOwnProperty(\"childrenTagsOrder\") && data.hasOwnProperty(\"currentElements\")) {\n let currentElements = (data as ExportedCanvas)[\"currentElements\"]\n let childrenTagsOrder = (data as ExportedCanvas)[\"childrenTagsOrder\"]\n childrenTagsOrder.forEach((tag) => {\n if (currentElements[tag]) {\n let element = importCanvasElement(currentElements[tag])\n GameWindowManager.addCanvasElement(tag, element)\n GameWindowManager.childrenTagsOrder.push(tag)\n }\n })\n }\n else {\n console.error(\"[Pixi'VN] The data does not have the properties childrenTagsOrder and currentElements\")\n return\n }\n if (data.hasOwnProperty(\"currentTickers\")) {\n let currentTickers = (data as ExportedCanvas)[\"currentTickers\"]\n currentTickers.forEach((t) => {\n let tags: string[] = t.canvasElementTags\n let ticker = geTickerInstanceByClassName(t.className, t.args, t.duration, t.priority)\n if (ticker) {\n GameWindowManager.addTicker(tags, ticker)\n }\n else {\n console.error(`[Pixi'VN] Ticker ${t.className} not found`)\n }\n })\n }\n }\n catch (e) {\n console.error(\"[Pixi'VN] Error importing data\", e)\n }\n }\n}\n","export function asciiArtLog() {\n console.info(`\n ____ _ _ ___ ___ _ \n | _ \\\\(_)_ _(_| ) \\\\ / / \\\\ | |\n | |_) | \\\\ \\\\/ / |/ \\\\ \\\\ / /| \\\\| |\n | __/| |> <| | \\\\ V / | |\\\\ |\n |_| |_/_/\\\\_\\\\_| \\\\_/ |_| \\\\_|\n `)\n}","import { GameStorageManager } from \"../managers\"\nimport StoredClassModel from \"./StoredClassModel\"\n\n/**\n * CharacterBaseModelProps is an interface that is used to create a character model.\n */\nexport interface CharacterBaseModelProps {\n /**\n * The name of the character.\n */\n name: string\n /**\n * The surname of the character.\n */\n surname?: string\n /**\n * The age of the character.\n */\n age?: number\n /**\n * The icon of the character.\n */\n icon?: string\n /**\n * The color of the character.\n */\n color?: string\n}\n\n/**\n * CharacterBaseModel is a class that is used to create a character model.\n * I suggest you extend this class to create your own character models.\n * You must use the saveCharacter function to save the character in the game.\n * @example\n * ```typescript\n * export const liam = new CharacterBaseModel('liam', {\n * name: 'Liam',\n * surname: 'Smith',\n * age: 25,\n * icon: \"https://pixijs.com/assets/eggHead.png\",\n * color: \"#9e2e12\"\n * });\n * export const alice = new CharacterBaseModel('alice', {\n * name: 'Alice',\n * surname: 'Smith',\n * age: 25,\n * icon: \"https://pixijs.com/assets/eggHead.png\",\n * color: \"#9e2e12\"\n * });\n * saveCharacter([liam, alice]);\n * ```\n */\nexport default class CharacterBaseModel extends StoredClassModel implements CharacterBaseModelProps {\n /**\n * @param id The id of the character.\n * @param props The properties of the character.\n */\n constructor(id: string, props: CharacterBaseModelProps) {\n super(GameStorageManager.keysSystem.CHARACTER_CATEGORY_KEY, id)\n this.defaultName = props.name\n this.defaultSurname = props.surname\n this.defaultAge = props.age\n this._icon = props.icon\n this._color = props.color\n }\n private defaultName: string = \"\"\n /***\n * The name of the character.\n * If you set undefined, it will return the default name.\n */\n get name(): string {\n return this.getStorageProperty<string>(\"name\") || this.defaultName\n }\n set name(value: string | undefined) {\n this.setStorageProperty<string>(\"name\", value)\n }\n private defaultSurname?: string\n /**\n * The surname of the character.\n * If you set undefined, it will return the default surname.\n */\n get surname(): string | undefined {\n return this.getStorageProperty<string>(\"surname\") || this.defaultSurname\n }\n set surname(value: string | undefined) {\n this.setStorageProperty<string>(\"surname\", value)\n }\n private defaultAge?: number | undefined\n /**\n * The age of the character.\n * If you set undefined, it will return the default age.\n */\n get age(): number | undefined {\n return this.getStorageProperty<number>(\"age\") || this.defaultAge\n }\n set age(value: number | undefined) {\n this.setStorageProperty<number>(\"age\", value)\n }\n private _icon?: string\n /**\n * The icon of the character.\n */\n get icon(): string | undefined {\n return this._icon\n }\n private _color?: string | undefined\n /**\n * The color of the character.\n */\n get color(): string | undefined {\n return this._color\n }\n}\n"]}
1
+ {"version":3,"sources":["../../src/managers/StepManager.ts","../../src/functions/StepLabelUtility.ts","../../src/classes/Label.ts","../../src/classes/CloseLabel.ts","../../src/classes/canvas/CanvasBase.ts","../../src/classes/canvas/CanvasContainer.ts","../../src/functions/CanvasUtility.ts","../../src/classes/canvas/CanvasImage.ts","../../src/functions/TextureUtility.ts","../../src/classes/canvas/CanvasSprite.ts","../../src/decorators/EventDecorator.ts","../../src/classes/canvas/CanvasText.ts","../../src/decorators/CanvasElementDecorator.ts","../../src/decorators/TickerDecorator.ts","../../src/types/PauseType.ts","../../src/types/RepeatType.ts","../../src/classes/StoredClassModel.ts","../../src/decorators/LabelDecorator.ts","../../src/functions/DialogueUtility.ts","../../src/classes/ticker/TickerBase.ts","../../src/classes/ticker/TickerFadeAlpha.ts","../../src/classes/ticker/TickerMove.ts","../../src/functions/TickerUtility.ts","../../src/classes/ticker/TickerRotate.ts","../../src/functions/ExportUtility.ts","../../src/functions/DiffUtility.ts","../../src/managers/StorageManager.ts","../../src/managers/WindowManager.ts","../../src/functions/EasterEgg.ts","../../src/classes/CharacterBaseModel.ts"],"names":["Container","Sprite","diff","index","tag"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,YAAY;;;ACArB,OAAO,UAAU;AASV,SAAS,YAAY,MAA0C;AAClE,MAAI,aAAa,KAAK,KAAK,SAAS,EAAE,kBAAkB,CAAC;AACzD,SAAO,WAAW,SAAS;AAC/B;AAOO,SAAS,oBAAoB,OAAiD,OAA0D;AAC3I,SAAO,UAAU;AACrB;;;ACQA,IAAqB,QAArB,MAA8C;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAO1C,YAAY,IAAiB,OAA2B,WAAwC,aAAsB;AAClH,SAAK,MAAM;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ASF,iBAAyB;AATvB,iBAsBF,gBAAgC,CAAC;AAtB/B,iBAiFF,oBAAkD;AAjFrE,IAAqB,kBAArB;;;A6B+BA,IAAqB,qBAArB,cAAgD,iBAAoD;AAAA;AAAA;AAAA;AAAA;AAAA,EAKhG,YAAY,IAAY,OAAgC;AACpD,UAAM,mBAAmB,WAAW,wBAAwB,EAAE;AAOlE,SAAQ,cAAsB;AAN1B,SAAK,cAAc,MAAM;AACzB,SAAK,iBAAiB,MAAM;AAC5B,SAAK,aAAa,MAAM;AACxB,SAAK,QAAQ,MAAM;AACnB,SAAK,SAAS,MAAM;AAAA,EACxB;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,IAAI,OAAe;AACf,WAAO,KAAK,mBAA2B,MAAM,KAAK,KAAK;AAAA,EAC3D;AAAA,EACA,IAAI,KAAK,OAA2B;AAChC,SAAK,mBAA2B,QAAQ,KAAK;AAAA,EACjD;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,IAAI,UAA8B;AAC9B,WAAO,KAAK,mBAA2B,SAAS,KAAK,KAAK;AAAA,EAC9D;AAAA,EACA,IAAI,QAAQ,OAA2B;AACnC,SAAK,mBAA2B,WAAW,KAAK;AAAA,EACpD;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,IAAI,MAA0B;AAC1B,WAAO,KAAK,mBAA2B,KAAK,KAAK,KAAK;AAAA,EAC1D;AAAA,EACA,IAAI,IAAI,OAA2B;AAC/B,SAAK,mBAA2B,OAAO,KAAK;AAAA,EAChD;AAAA;AAAA;AAAA;AAAA,EAKA,IAAI,OAA2B;AAC3B,WAAO,KAAK;AAAA,EAChB;AAAA;AAAA;AAAA;AAAA,EAKA,IAAI,QAA4B;AAC5B,WAAO,KAAK;AAAA,EAChB;AACJ","sourcesContent":["import { diff } from \"deep-diff\"\nimport { DialogueBaseModel, Label } from \"../classes\"\nimport { IStoratedChoiceMenuOption } from \"../classes/ChoiceMenuOption\"\nimport newCloseLabel, { CLOSE_LABEL_ID } from \"../classes/CloseLabel\"\nimport { getLabelById } from \"../decorators/LabelDecorator\"\nimport { getDialogue } from \"../functions\"\nimport { restoreDeepDiffChanges } from \"../functions/DiffUtility\"\nimport { createExportableElement } from \"../functions/ExportUtility\"\nimport { getStepSha1 } from \"../functions/StepLabelUtility\"\nimport ExportedStep from \"../interface/export/ExportedStep\"\nimport IHistoryStep, { IHistoryStepData } from \"../interface/IHistoryStep\"\nimport IOpenedLabel from \"../interface/IOpenedLabel\"\nimport { LabelIdType } from \"../types/LabelIdType\"\nimport { StepHistoryDataType } from \"../types/StepHistoryDataType\"\nimport { StepLabelPropsType, StepLabelResultType, StepLabelType } from \"../types/StepLabelType\"\nimport GameStorageManager from \"./StorageManager\"\nimport GameWindowManager from \"./WindowManager\"\n\n/**\n * GameStepManager is a class that manages the steps and labels of the game.\n */\nexport default class GameStepManager {\n private constructor() { }\n /**\n * stepHistory is a list of label events and steps that occurred during the progression of the steps.\n */\n private static _stepsHistory: IHistoryStep[] = []\n static get stepsHistory() {\n return GameStepManager._stepsHistory\n }\n private static _lastStepIndex: number = 0\n /**\n * lastStepIndex is the last step index that occurred during the progression of the steps. **Not is the length of the stepsHistory - 1.**\n */\n static get lastStepIndex() {\n return GameStepManager._lastStepIndex\n }\n /**\n * Increase the last step index that occurred during the progression of the steps.\n */\n private static increaseLastStepIndex() {\n GameStepManager._lastStepIndex++\n }\n private static _openedLabels: IOpenedLabel[] = []\n static get openedLabels() {\n return GameStepManager._openedLabels\n }\n /**\n * currentLabelId is the current label id that occurred during the progression of the steps.\n */\n private static get currentLabelId(): LabelIdType | undefined {\n if (GameStepManager._openedLabels.length > 0) {\n let item = GameStepManager._openedLabels[GameStepManager._openedLabels.length - 1]\n return item.label\n }\n return undefined\n }\n /**\n * currentLabel is the current label that occurred during the progression of the steps.\n */\n static get currentLabel(): Label | undefined {\n if (GameStepManager.currentLabelId) {\n return getLabelById(GameStepManager.currentLabelId)\n }\n }\n private static get currentLabelStepIndex(): number | null {\n if (GameStepManager._openedLabels.length > 0) {\n let item = GameStepManager._openedLabels[GameStepManager._openedLabels.length - 1]\n return item.currentStepIndex\n }\n return null\n }\n /**\n * currentLabelStep is the current step that occurred during the progression of the steps. It can used to determine the game end.\n */\n static get isLastGameStep(): boolean {\n let stepLabel = GameStepManager.currentLabel?.steps\n if (stepLabel && GameStepManager.currentLabelStepIndex === stepLabel.length) {\n if (this.openedLabels.length <= 1) {\n return true\n }\n else {\n this.openedLabels.forEach((item) => {\n let label = getLabelById(item.label)\n if (label && label.steps.length > item.currentStepIndex) {\n return false\n }\n })\n return true\n }\n }\n return false\n }\n /**\n * lastHistoryStep is the last history step that occurred during the progression of the steps.\n */\n private static get lastHistoryStep(): IHistoryStep | null {\n if (GameStepManager._stepsHistory.length > 0) {\n return GameStepManager._stepsHistory[GameStepManager._stepsHistory.length - 1]\n }\n return null\n }\n private static _originalStepData: IHistoryStepData | undefined = undefined\n private static get originalStepData(): IHistoryStepData {\n if (!GameStepManager._originalStepData) {\n return {\n path: \"\",\n storage: {},\n canvas: {\n childrenTagsOrder: [],\n currentElements: {},\n currentTickers: [],\n },\n labelIndex: -1,\n openedLabels: [],\n }\n }\n return createExportableElement(GameStepManager._originalStepData)\n }\n private static set originalStepData(value: IHistoryStepData) {\n GameStepManager._originalStepData = createExportableElement(value)\n }\n\n /* Edit History Methods */\n\n /**\n * Add a label to the history.\n * @param label The label to add to the history.\n */\n private static addStepHistory(step: StepLabelType<any>, choiseMade?: number) {\n let stepHistory: StepHistoryDataType = getStepSha1(step)\n let historyStep: IHistoryStepData = {\n path: window.location.pathname,\n storage: GameStorageManager.export(),\n canvas: GameWindowManager.export(),\n labelIndex: GameStepManager.currentLabelStepIndex || 0,\n openedLabels: createExportableElement(GameStepManager._openedLabels),\n }\n if (GameStepManager.originalStepData) {\n if (GameStepManager.originalStepData.openedLabels.length === historyStep.openedLabels.length) {\n try {\n let lastStepDataOpenedLabelsString = JSON.stringify(GameStepManager.originalStepData.openedLabels)\n let historyStepOpenedLabelsString = JSON.stringify(historyStep.openedLabels)\n if (\n lastStepDataOpenedLabelsString === historyStepOpenedLabelsString &&\n GameStepManager.originalStepData.path === historyStep.path &&\n GameStepManager.originalStepData.labelIndex === historyStep.labelIndex\n ) {\n return\n }\n }\n catch (e) {\n console.error(\"[Pixi'VN] Error comparing openedLabels\", e)\n }\n }\n }\n let data = diff(GameStepManager.originalStepData, historyStep)\n if (data) {\n let dialoge: DialogueBaseModel | undefined = undefined\n let requiredChoices: IStoratedChoiceMenuOption[] | undefined = undefined\n if (GameStorageManager.getVariable<number>(GameStorageManager.keysSystem.LAST_DIALOGUE_ADDED_IN_STEP_MEMORY_KEY) === GameStepManager.lastStepIndex) {\n dialoge = getDialogue()\n }\n if (GameStorageManager.getVariable<number>(GameStorageManager.keysSystem.LAST_MENU_OPTIONS_ADDED_IN_STEP_MEMORY_KEY) === GameStepManager.lastStepIndex) {\n requiredChoices = GameStorageManager.getVariable<IStoratedChoiceMenuOption[]>(GameStorageManager.keysSystem.CURRENT_MENU_OPTIONS_MEMORY_KEY)\n }\n GameStepManager._stepsHistory.push({\n diff: data,\n currentLabel: GameStepManager.currentLabelId,\n dialoge: dialoge,\n choices: requiredChoices,\n stepSha1: stepHistory,\n index: GameStepManager.lastStepIndex,\n choiceIndexMade: choiseMade\n })\n GameStepManager.originalStepData = historyStep\n }\n GameStepManager.increaseLastStepIndex()\n }\n /**\n * Add a label to the history.\n * @param label The label to add to the history.\n */\n private static pushNewLabel(label: LabelIdType) {\n let currentLabel = getLabelById(label)\n if (!currentLabel) {\n throw new Error(`[Pixi'VN] Label ${label} not found`)\n }\n GameStepManager._openedLabels.push({\n label: label,\n currentStepIndex: 0,\n })\n }\n /**\n * Close the current label and add it to the history.\n * @returns \n */\n static closeCurrentLabel() {\n if (!GameStepManager.currentLabelId) {\n console.warn(\"[Pixi'VN] No label to close\")\n return\n }\n if (!GameStepManager.currentLabel) {\n console.error(\"[Pixi'VN] currentLabel not found\")\n return\n }\n GameStepManager._openedLabels.pop()\n }\n /**\n * Close all labels and add them to the history.\n */\n static closeAllLabels() {\n while (GameStepManager._openedLabels.length > 0) {\n GameStepManager.closeCurrentLabel()\n }\n }\n /**\n * Increase the current step index of the current label.\n */\n private static increaseCurrentStepIndex() {\n let item = GameStepManager._openedLabels[GameStepManager._openedLabels.length - 1]\n GameStepManager._openedLabels[GameStepManager._openedLabels.length - 1] = {\n ...item,\n currentStepIndex: item.currentStepIndex + 1,\n }\n }\n\n /* Run Methods */\n\n /**\n * Execute the next step and add it to the history.\n * @param props The props to pass to the step.\n * @returns StepLabelResultType or undefined.\n * @example\n * ```typescript\n * function nextOnClick() {\n * setLoading(true)\n * GameStepManager.runNextStep(yourParams)\n * .then((result) => {\n * setUpdate((p) => p + 1)\n * setLoading(false)\n * if (result) {\n * // your code\n * }\n * })\n * .catch((e) => {\n * setLoading(false)\n * console.error(e)\n * })\n * }\n * ```\n */\n public static async runNextStep(props: StepLabelPropsType): Promise<StepLabelResultType> {\n if (GameStepManager._openedLabels.length === 0) {\n console.warn(\"[Pixi'VN] There are no labels to run\")\n return\n }\n GameStepManager.increaseCurrentStepIndex()\n return await GameStepManager.runCurrentStep(props)\n }\n /**\n * Execute the current step and add it to the history.\n * @param props The props to pass to the step.\n * @param choiseMade The choise made by the player.\n * @returns StepLabelResultType or undefined.\n */\n private static async runCurrentStep<T extends {}>(props: StepLabelPropsType<T>, choiseMade?: number): Promise<StepLabelResultType> {\n if (GameStepManager.currentLabelId) {\n let lastStepsLength = GameStepManager.currentLabelStepIndex\n if (lastStepsLength === null) {\n console.error(\"[Pixi'VN] currentLabelStepIndex is null\")\n return\n }\n let currentLabel = GameStepManager.currentLabel as Label<T>\n if (!currentLabel) {\n console.error(\"[Pixi'VN] currentLabel not found\")\n return\n }\n let n = currentLabel.steps.length\n if (n > lastStepsLength) {\n let step = currentLabel.steps[lastStepsLength]\n let result = await step(props)\n GameStepManager.addStepHistory(step, choiseMade)\n return result\n }\n else if (n === lastStepsLength) {\n GameStepManager.closeCurrentLabel()\n return await GameStepManager.runNextStep(props)\n }\n else {\n console.warn(\"[Pixi'VN] There are no steps to run\")\n }\n }\n }\n /**\n * Execute the label and add it to the history.\n * Is a call function in Ren'Py.\n * @param label The label to execute or the id of the label\n * @param props The props to pass to the label.\n * @returns StepLabelResultType or undefined.\n * @example\n * ```typescript\n * GameStepManager.callLabel(startLabel, yourParams).then((result) => {\n * if (result) {\n * // your code\n * }\n * })\n * ```\n * @example\n * ```typescript\n * // if you use it in a step label you should return the result.\n * return GameStepManager.callLabel(startLabel).then((result) => {\n * return result\n * })\n * ```\n */\n public static async callLabel<T extends {} = {}>(label: Label<T> | LabelIdType, props: StepLabelPropsType<T>): Promise<StepLabelResultType> {\n let choiseMade: number | undefined = undefined\n let labelId: LabelIdType\n if (typeof label === 'string') {\n labelId = label\n }\n else {\n labelId = label.id\n if (typeof label.choiseIndex === \"number\") {\n choiseMade = label.choiseIndex\n }\n }\n try {\n if (labelId === CLOSE_LABEL_ID) {\n let closeLabel = newCloseLabel(choiseMade)\n return GameStepManager.closeChoiceMenu(closeLabel, props)\n }\n let tempLabel = getLabelById<Label<T>>(labelId)\n if (!tempLabel) {\n throw new Error(`[Pixi'VN] Label ${labelId} not found`)\n }\n GameStepManager.pushNewLabel(tempLabel.id)\n }\n catch (e) {\n console.error(\"[Pixi'VN] Error calling label\", e)\n return\n }\n return await GameStepManager.runCurrentStep<T>(props, choiseMade)\n }\n /**\n * Execute the label, close all labels and add them to the history.\n * Is a jump function in Ren'Py.\n * @param label The label to execute.\n * @param props The props to pass to the label or the id of the label\n * @returns StepLabelResultType or undefined.\n * @example\n * ```typescript\n * GameStepManager.jumpLabel(startLabel, yourParams).then((result) => {\n * if (result) {\n * // your code\n * }\n * })\n * ```\n * @example\n * ```typescript\n * // if you use it in a step label you should return the result.\n * return GameStepManager.jumpLabel(startLabel).then((result) => {\n * return result\n * })\n * ```\n */\n public static async jumpLabel<T extends {}>(label: Label<T> | LabelIdType, props: StepLabelPropsType<T>): Promise<StepLabelResultType> {\n GameStepManager.closeAllLabels()\n let choiseMade: number | undefined = undefined\n let labelId: LabelIdType\n if (typeof label === 'string') {\n labelId = label\n }\n else {\n labelId = label.id\n if (typeof label.choiseIndex === \"number\") {\n choiseMade = label.choiseIndex\n }\n }\n try {\n if (labelId === CLOSE_LABEL_ID) {\n let closeLabel = newCloseLabel(choiseMade)\n return GameStepManager.closeChoiceMenu(closeLabel, props)\n }\n let tempLabel = getLabelById<Label<T>>(labelId)\n if (!tempLabel) {\n throw new Error(`[Pixi'VN] Label ${labelId} not found`)\n }\n GameStepManager.pushNewLabel(tempLabel.id)\n }\n catch (e) {\n console.error(\"[Pixi'VN] Error jumping label\", e)\n return\n }\n return await GameStepManager.runCurrentStep<T>(props, choiseMade)\n }\n /**\n * When the player is in a choice menu, can use this function to exit to the choice menu.\n * @param props The props to pass to the step.\n * @returns StepLabelResultType or undefined.\n * @example\n * ```typescript\n * GameStepManager.closeChoiceMenu(yourParams).then((result) => {\n * if (result) {\n * // your code\n * }\n * })\n * ```\n */\n public static async closeChoiceMenu<T extends {}>(label: Label<T>, props: StepLabelPropsType<T>): Promise<StepLabelResultType> {\n let choiseMade: number | undefined = undefined\n if (typeof label.choiseIndex === \"number\") {\n choiseMade = label.choiseIndex\n }\n GameStepManager.addStepHistory(() => { }, choiseMade)\n return GameStepManager.runNextStep(props)\n }\n\n /* After Update Methods */\n\n // /**\n // * After the update or code edit, some steps or labels may no longer match.\n // * - In case of step mismatch, the game will be updated to the last matching step.\n // * - In case of label mismatch, the game gives an error.\n // * @returns \n // */\n // private static afterUpdate() {\n // // TODO: implement\n // if (!GameStepManager.currentLabel) {\n // // TODO: implement\n // return\n // }\n // let currentLabel = getLabelInstanceByClassName(GameStepManager.currentLabel)\n // if (!currentLabel) {\n // console.error(\"Label not found\")\n // return\n // }\n // let oldSteps = GameStepManager.stepsAfterLastHistoryLabel\n // let currentStepIndex = currentLabel.getCorrespondingStepsNumber(oldSteps)\n // let stepToRemove = oldSteps.length - currentStepIndex\n // GameStepManager.removeLastHistoryNodes(stepToRemove)\n // GameStepManager.loadLastStep()\n // }\n // private static loadLastStep() {\n // // TODO: implement\n // }\n // /**\n // * Remove a number of items from the last of the history.\n // * @param itemNumber The number of items to remove from the last of the history.\n // */\n // private static removeLastHistoryNodes(itemNumber: number) {\n // // TODO: implement\n // for (let i = 0; i < itemNumber; i++) {\n // GameStepManager._stepsHistory.pop()\n // }\n // }\n // /**\n // * stepsAfterLastHistoryLabel is a list of steps that occurred after the last history label.\n // */\n // private static get stepsAfterLastHistoryLabel(): StepHistoryDataType[] {\n // let length = GameStepManager._stepsHistory.length\n // let steps: StepHistoryDataType[] = []\n // for (let i = length - 1; i >= 0; i--) {\n // let element = GameStepManager._stepsHistory[i]\n // if (typeof element === \"object\" && \"stepSha1\" in element) {\n // steps.push(element.stepSha1)\n // }\n // else {\n // break\n // }\n // }\n\n // steps = steps.reverse()\n // return steps\n // }\n\n /* Go Back & Refresh Methods */\n\n /**\n * Go back to the last step and add it to the history.\n * @param navigate The navigate function.\n * @param steps The number of steps to go back.\n * @returns \n * @example\n * ```typescript\n * export function goBack(navigate: (path: string) => void, afterBack?: () => void) {\n * GameStepManager.goBack(navigate)\n * afterBack && afterBack()\n * }\n * ```\n */\n public static goBack(navigate: (path: string) => void, steps: number = 1) {\n if (steps <= 0) {\n console.warn(\"[Pixi'VN] Steps must be greater than 0\")\n return\n }\n if (GameStepManager._stepsHistory.length <= 1) {\n console.warn(\"[Pixi'VN] No steps to go back\")\n return\n }\n let restoredStep = GameStepManager.goBackInternal(steps, GameStepManager.originalStepData)\n if (restoredStep) {\n GameStepManager._originalStepData = restoredStep\n GameStepManager._openedLabels = createExportableElement(restoredStep.openedLabels)\n GameStorageManager.import(createExportableElement(restoredStep.storage))\n GameWindowManager.import(createExportableElement(restoredStep.canvas))\n navigate(restoredStep.path)\n }\n else {\n console.error(\"[Pixi'VN] Error going back\")\n }\n }\n private static goBackInternal(steps: number, restoredStep: IHistoryStepData): IHistoryStepData {\n if (steps <= 0) {\n return restoredStep\n }\n if (GameStepManager._stepsHistory.length == 0) {\n return restoredStep\n }\n let lastHistoryStep = GameStepManager.lastHistoryStep\n if (lastHistoryStep) {\n try {\n let result = restoreDeepDiffChanges(restoredStep, lastHistoryStep.diff)\n GameStepManager._lastStepIndex = lastHistoryStep.index\n GameStepManager._stepsHistory.pop()\n return GameStepManager.goBackInternal(steps - 1, result)\n }\n catch (e) {\n console.error(\"[Pixi'VN] Error applying diff\", e)\n return restoredStep\n }\n }\n else {\n return restoredStep\n }\n }\n\n /**\n * Return true if it is possible to go back.\n */\n public static get canGoBack(): boolean {\n return GameStepManager._stepsHistory.length > 1\n }\n\n /**\n * Add a label to the history.\n */\n public static clear() {\n GameStepManager._stepsHistory = []\n GameStepManager._openedLabels = []\n }\n\n /* Export and Import Methods */\n\n /**\n * Export the history to a JSON string.\n * @returns The history in a JSON string.\n */\n public static exportJson(): string {\n return JSON.stringify(this.export())\n }\n /**\n * Export the history to an object.\n * @returns The history in an object.\n */\n public static export(): ExportedStep {\n return {\n stepsHistory: GameStepManager._stepsHistory,\n openedLabels: GameStepManager._openedLabels,\n lastStepIndex: GameStepManager._lastStepIndex,\n originalStepData: GameStepManager._originalStepData,\n }\n }\n /**\n * Import the history from a JSON string.\n * @param dataString The history in a JSON string.\n */\n public static importJson(dataString: string) {\n GameStepManager.import(JSON.parse(dataString))\n }\n /**\n * Import the history from an object.\n * @param data The history in an object.\n */\n public static import(data: object) {\n GameStepManager.clear()\n try {\n if (data.hasOwnProperty(\"stepsHistory\")) {\n GameStepManager._stepsHistory = (data as ExportedStep)[\"stepsHistory\"]\n }\n else {\n console.warn(\"[Pixi'VN] No stepsHistory data found\")\n }\n if (data.hasOwnProperty(\"openedLabels\")) {\n GameStepManager._openedLabels = (data as ExportedStep)[\"openedLabels\"]\n }\n else {\n console.warn(\"[Pixi'VN] No openedLabels data found\")\n }\n if (data.hasOwnProperty(\"lastStepIndex\")) {\n GameStepManager._lastStepIndex = (data as ExportedStep)[\"lastStepIndex\"]\n }\n else {\n console.warn(\"[Pixi'VN] No lastStepIndex data found\")\n }\n if (data.hasOwnProperty(\"originalStepData\")) {\n GameStepManager._originalStepData = (data as ExportedStep)[\"originalStepData\"]\n }\n else {\n console.warn(\"[Pixi'VN] No originalStepData data found\")\n }\n }\n catch (e) {\n console.error(\"[Pixi'VN] Error importing data\", e)\n }\n }\n}\n","import sha1 from 'crypto-js/sha1';\nimport { StepHistoryDataType } from \"../types/StepHistoryDataType\";\nimport { StepLabelType } from \"../types/StepLabelType\";\n\n/**\n * Convert StepLabel to StepHistoryData\n * @param step\n * @returns\n */\nexport function getStepSha1(step: StepLabelType): StepHistoryDataType {\n let sha1String = sha1(step.toString().toLocaleLowerCase())\n return sha1String.toString()\n}\n/**\n * Check if two steps are equal\n * @param step1\n * @param step2\n * @returns\n */\nexport function checkIfStepsIsEqual(step1: StepHistoryDataType | StepLabelType<any>, step2: StepHistoryDataType | StepLabelType<any>): boolean {\n return step1 === step2\n}\n","import { checkIfStepsIsEqual } from \"../functions/StepLabelUtility\"\nimport { LabelIdType } from \"../types/LabelIdType\"\nimport { StepHistoryDataType } from \"../types/StepHistoryDataType\"\nimport { StepLabelType } from \"../types/StepLabelType\"\n\n/**\n * Label is a class that contains a list of steps, which will be performed as the game continues.\n * For Ren'py this is the equivalent of a label.\n * @example\n * ```typescript\n * const START_LABEL_ID = \"StartLabel\"\n * \n * export const startLabel = newLabel(START_LABEL_ID,\n * [\n * (props) => {\n * GameWindowManager.clear()\n * setDialogue({ character: liam, text: \"Which test do you want to perform?\" })\n * setChoiceMenuOptions([\n * new ChoiceMenuOption(\"Events Test\", eventsTestLabel),\n * new ChoiceMenuOption(\"Show Image Test\", showImageTest),\n * ])\n * },\n * (props) => GameStepManager.jumpLabel(START_LABEL_ID, props),\n * ]\n * )\n * \n * GameStepManager.callLabel(StartLabel)\n * ```\n */\nexport default class Label<T extends {} = {}> {\n /**\n * @param id is the id of the label\n * @param steps is the list of steps that the label will perform\n * @param onStepRun is a function that will be executed before any step is executed, is useful for example to make sure all images used have been cached\n * @param choiseIndex is the index of the choice that the label will perform\n */\n constructor(id: LabelIdType, steps: StepLabelType<T>[], onStepRun?: () => void | Promise<void>, choiseIndex?: number) {\n this._id = id\n this._steps = steps\n this._onStepRun = onStepRun\n this._choiseIndex = choiseIndex\n }\n\n private _id: LabelIdType\n /**\n * Get the id of the label\n */\n public get id(): LabelIdType {\n return this._id\n }\n\n private _steps: StepLabelType<T>[]\n /**\n * Get the steps of the label.\n * This class should be extended and the steps method should be overridden.\n * Every time you update this list will also be updated when the other game versions load.\n */\n public get steps(): StepLabelType<T>[] {\n return this._steps\n }\n\n /**\n * Get the corresponding steps number\n * @param externalSteps\n * @returns Numer of corresponding steps, for example, if externalSteps is [ABC, DEF, GHI] and the steps of the label is [ABC, GHT], the result will be 1\n */\n public getCorrespondingStepsNumber(externalSteps: StepHistoryDataType[] | StepLabelType[]): number {\n if (externalSteps.length === 0) {\n return 0\n }\n let res: number = 0\n externalSteps.forEach((step, index) => {\n if (checkIfStepsIsEqual(step, this.steps[index])) {\n res = index\n }\n })\n return res\n }\n\n private _onStepRun: (() => void | Promise<void>) | undefined\n /**\n * Get the function that will be executed before any step is executed, is useful for example to make sure all images used have been cached\n * @returns Promise<void> or void\n * @example\n * ```typescript\n * newLabel(\"id\", [], () => {\n * Assets.load('path/to/image1.png')\n * Assets.load('path/to/image2.png')\n * })\n * ```\n */\n public get onStepRun(): (() => void | Promise<void>) | undefined {\n return this._onStepRun\n }\n\n private _choiseIndex: number | undefined\n public get choiseIndex(): number | undefined {\n return this._choiseIndex\n }\n}\n","import Label from \"./Label\"\n\nexport const CLOSE_LABEL_ID = \"__close-label-id__\"\n\n/**\n * CloseLabel is a label used for closing the menu.\n */\nexport default function newCloseLabel(choiseIndex?: number) { return new Label(CLOSE_LABEL_ID, [], undefined, choiseIndex) }\n","import { Container } from \"pixi.js\";\nimport { ICanvasBaseMemory } from \"../../interface/canvas\";\n\n/**\n * This class is used to create a canvas element to add into a Pixi Application.\n * You can use GameWindowManager.addCanvasElement() to add this element into the application.\n * This class should be implemented and the memory method should be overridden.\n * You must use the canvasElementDecorator to register the canvas in the game.\n * In Ren'Py is a displayable.\n * @example\n * ```typescript\n * \\@canvasElementDecorator() // this is equivalent to canvasElementDecorator(\"CanvasExample\")\n * export class CanvasExample extends Container implements CanvasBase<ICanvasExampleMemory> {\n * get memory(): ICanvasExampleMemory {\n * return {\n * className: \"CanvasExample\",\n * // ... other properties\n * }\n * }\n * set memory(value: ICanvasExampleMemory) {\n * // ... set other properties\n * }\n * }\n * ```\n */\nexport default class CanvasBase<T2 extends ICanvasBaseMemory> extends Container {\n /**\n * This method return the memory of the canvas element.\n */\n get memory(): T2 { throw new Error(\"[Pixi'VN] The method CanvasBase.memory must be overridden\") }\n /**\n * This method set the memory of the canvas element.\n */\n set memory(_value: T2) { throw new Error(\"[Pixi'VN] The method CanvasBase.memory must be overridden\") }\n}\n","import { Container, ContainerOptions } from \"pixi.js\";\nimport { exportCanvasElement, importCanvasElement } from \"../../functions/CanvasUtility\";\nimport ICanvasContainerMemory from \"../../interface/canvas/ICanvasContainerMemory\";\nimport CanvasBase from \"./CanvasBase\";\n\n/**\n * This class is a extension of the [PIXI.Container class](https://pixijs.com/8.x/examples/basic/container), it has the same properties and methods, \n * but it has the ability to be saved and loaded by the Pixi'VN library.\n * @example\n * ```typescript\n * const container = new CanvasContainer();\n * GameWindowManager.addCanvasElement(container);\n * const texture = await Assets.load('https://pixijs.com/assets/bunny.png');\n * for (let i = 0; i < 25; i++)\n * {\n * const bunny = new CanvasSprite(texture);\n * bunny.x = (i % 5) * 40;\n * bunny.y = Math.floor(i / 5) * 40;\n * container.addChild(bunny);\n * }\n * ```\n */\nexport default class CanvasContainer extends Container implements CanvasBase<ICanvasContainerMemory> {\n get memory(): ICanvasContainerMemory {\n let memory = getMemoryContainer(this)\n this.children.forEach(child => {\n memory.elements.push(exportCanvasElement(child as CanvasBase<any>))\n })\n return memory\n }\n set memory(value: ICanvasContainerMemory) {\n setMemoryContainer(this, value)\n value.elements.forEach(child => {\n this.addChild(importCanvasElement(child))\n })\n }\n}\n\nexport function getMemoryContainer<T extends Container>(element: T): ICanvasContainerMemory {\n return {\n className: \"CanvasContainer\",\n elements: [],\n\n width: element.width,\n height: element.height,\n\n isRenderGroup: element.isRenderGroup,\n blendMode: element.blendMode,\n tint: element.tint,\n alpha: element.alpha,\n angle: element.angle,\n renderable: element.renderable,\n rotation: element.rotation,\n scale: { x: element.scale.x, y: element.scale.y },\n pivot: { x: element.pivot.x, y: element.pivot.y },\n position: { x: element.position.x, y: element.position.y },\n skew: { x: element.skew.x, y: element.skew.y },\n visible: element.visible,\n culled: element.culled,\n x: element.x,\n y: element.y,\n boundsArea: element.boundsArea,\n\n cursor: element.cursor,\n eventMode: element.eventMode,\n interactive: element.interactive,\n interactiveChildren: element.interactiveChildren,\n hitArea: element.hitArea\n }\n}\n\nexport function setMemoryContainer<T extends Container>(element: T | Container, memory: ContainerOptions) {\n memory.width && (element.width = memory.width)\n memory.height && (element.height = memory.height)\n\n memory.isRenderGroup && (element.isRenderGroup = memory.isRenderGroup)\n memory.blendMode && (element.blendMode = memory.blendMode)\n memory.tint && (element.tint = memory.tint)\n memory.alpha && (element.alpha = memory.alpha)\n memory.angle && (element.angle = memory.angle)\n memory.renderable && (element.renderable = memory.renderable)\n memory.rotation && (element.rotation = memory.rotation)\n if (memory.scale) {\n if (typeof memory.scale === \"number\") {\n element.scale.set(memory.scale, memory.scale)\n }\n else {\n element.scale.set(memory.scale.x, memory.scale.y)\n }\n }\n if (memory.pivot) {\n if (typeof memory.pivot === \"number\") {\n element.pivot.set(memory.pivot, memory.pivot)\n }\n else {\n element.pivot.set(memory.pivot.x, memory.pivot.y)\n }\n }\n memory.position && (element.position.set(memory.position.x, memory.position.y))\n memory.skew && (element.skew.set(memory.skew.x, memory.skew.y))\n memory.visible && (element.visible = memory.visible)\n memory.culled && (element.culled = memory.culled)\n memory.x && (element.x = memory.x)\n memory.y && (element.y = memory.y)\n memory.boundsArea && (element.boundsArea = memory.boundsArea)\n\n memory.cursor && (element.cursor = memory.cursor)\n memory.eventMode && (element.eventMode = memory.eventMode)\n memory.interactive && (element.interactive = memory.interactive)\n memory.interactiveChildren && (element.interactiveChildren = memory.interactiveChildren)\n memory.hitArea && (element.hitArea = memory.hitArea)\n}\n","import { Texture } from \"pixi.js\";\nimport { CanvasBase } from \"../classes/canvas\";\nimport { getCanvasElementInstanceByClassName } from \"../decorators/CanvasElementDecorator\";\nimport { ICanvasBaseMemory, ITextureMemory } from \"../interface/canvas\";\n\n/**\n * Get the memory object of the PixiJS texture\n * @param texture PixiJS Texture object\n * @returns Memory object of the texture\n */\nexport function getTextureMemory(texture: Texture): ITextureMemory {\n let sourceTexture = texture.source\n let textureMemory: ITextureMemory = {\n image: sourceTexture.label\n }\n return textureMemory\n}\n\n/**\n * Export a Canvas element to a memory object\n * @param element Canvas element\n * @returns Memory object of the canvas\n */\nexport function exportCanvasElement<T extends CanvasBase<any>>(\n element: T,\n): ICanvasBaseMemory {\n return element.memory\n}\n\n/**\n * Import a Canvas element from a memory object\n * @param memory Memory object of the canvas\n * @returns Canvas element\n */\nexport function importCanvasElement<T extends CanvasBase<any>>(\n memory: ICanvasBaseMemory,\n): T {\n let element = getCanvasElementInstanceByClassName<T>(memory.className)\n if (element) {\n element.memory = memory\n }\n else {\n throw new Error(\"[Pixi'VN] The element \" + memory.className + \" could not be created\")\n }\n\n return element\n}\n","import { Sprite, SpriteOptions, Texture, TextureSourceLike } from \"pixi.js\";\nimport { getTexture } from \"../../functions/TextureUtility\";\nimport ICanvasImageMemory from \"../../interface/canvas/ICanvasImageMemory\";\nimport CanvasSprite, { getMemorySprite, setMemorySprite } from \"./CanvasSprite\";\n\n/**\n * This class is a extension of the CanvasSprite class, it has the same properties and methods,\n * but it has some features that make texture management easier.\n * You need to use CanvasImage.load() to show the image in the canvas.\n * This class is used for functions like addImage, loadImages and showWithDissolveTransition.\n * @example\n * ```typescript\n * let alien = new CanvasImage({\n * anchor: { x: 0.5, y: 0.5 },\n * x: 100,\n * y: 100,\n * }, 'https://pixijs.com/assets/eggHead.png')\n * await alien.load()\n * GameWindowManager.addCanvasElement(\"alien\", alien)\n * ```\n * @example\n * ```typescript\n * let alien = addImage(\"alien\", 'https://pixijs.com/assets/eggHead.png')\n * alien.anchor.set(0.5);\n * alien.x = 100\n * alien.y = 100\n * await alien.load()\n * ```\n */\nexport default class CanvasImage extends CanvasSprite<ICanvasImageMemory> {\n constructor(options?: SpriteOptions | Texture | undefined, imageLink?: string) {\n super(options)\n if (imageLink) {\n this.imageLink = imageLink\n }\n }\n override get memory(): ICanvasImageMemory {\n return {\n ...getMemorySprite(this),\n className: \"CanvasImage\",\n textureImage: { image: this.imageLink },\n }\n }\n override set memory(memory: ICanvasImageMemory) {\n setMemorySprite(this, memory)\n }\n imageLink: string = \"\"\n static override from(source: Texture | TextureSourceLike, skipCache?: boolean) {\n let sprite = Sprite.from(source, skipCache)\n let mySprite = new CanvasImage()\n mySprite.texture = sprite.texture\n return mySprite\n }\n /** \n * Load the image from the link and set the texture of the sprite.\n * @param image The link of the image. If it is not set, it will use the imageLink property.\n * @returns A promise that resolves when the image is loaded.\n */\n async load(image?: string) {\n if (!image) {\n image = this.imageLink\n }\n return getTexture(this.imageLink)\n .then((texture) => {\n if (texture) {\n this.texture = texture\n }\n })\n .catch((e) => {\n console.error(\"[Pixi'VN] Error into CanvasImage.load()\", e)\n })\n }\n}\n","import { Assets, TextStyle, TextStyleOptions, Texture } from 'pixi.js';\n\n/**\n * Get a texture from a url.\n * @param imageUrl is the url of the image.\n * @returns the texture of the image, or a text with the error.\n */\nexport async function getTexture(imageUrl: string): Promise<Texture | void> {\n if (Assets.cache.has(imageUrl)) {\n return Assets.get(imageUrl)\n }\n return Assets.load(imageUrl)\n .then((texture) => {\n if (!texture) {\n console.error(\"[Pixi'VN] Texture not found\", imageUrl)\n return\n }\n // if texture not is a Texture, then it is a TextureResource\n if (!(texture instanceof Texture)) {\n console.error(\"[Pixi'VN] File not is a image\", imageUrl)\n return\n }\n\n return texture\n })\n .catch((e) => {\n console.error(\"[Pixi'VN] Error loading image\", e)\n return\n })\n}\n\nexport function getTextStyle(style: TextStyle): TextStyleOptions {\n let fill = style.fill\n if (fill instanceof Object) {\n // TODO: FillGradient and FillPattern are not supported yet\n console.warn(\"[Pixi'VN] CanvasText.style.fill is a FillGradient or FillPattern, this is not supported yet.\", fill)\n fill = \"#00FF00\"\n }\n return {\n align: style.align,\n breakWords: style.breakWords,\n dropShadow: style.dropShadow,\n fill: fill,\n fontFamily: style.fontFamily,\n fontSize: style.fontSize,\n fontStyle: style.fontStyle,\n fontVariant: style.fontVariant,\n fontWeight: style.fontWeight,\n leading: style.leading,\n letterSpacing: style.letterSpacing,\n lineHeight: style.lineHeight,\n padding: style.padding,\n stroke: style.stroke,\n textBaseline: style.textBaseline,\n trim: style.trim,\n whiteSpace: style.whiteSpace,\n wordWrap: style.wordWrap,\n wordWrapWidth: style.wordWrapWidth,\n }\n}\n","import { ContainerChild, ContainerEvents, EventEmitter, Sprite, SpriteOptions, Texture, TextureSourceLike } from \"pixi.js\";\nimport { getEventInstanceByClassName, getEventTypeByClassName } from \"../../decorators/EventDecorator\";\nimport { getTextureMemory } from \"../../functions/CanvasUtility\";\nimport { getTexture } from \"../../functions/TextureUtility\";\nimport ICanvasBaseMemory from \"../../interface/canvas/ICanvasBaseMemory\";\nimport ICanvasSpriteMemory, { ICanvasSpriteBaseMemory } from \"../../interface/canvas/ICanvasSpriteMemory\";\nimport { CanvasEventNamesType } from \"../../types/CanvasEventNamesType\";\nimport { EventIdType } from \"../../types/EventIdType\";\nimport CanvasEvent from \"../CanvasEvent\";\nimport CanvasBase from \"./CanvasBase\";\nimport { getMemoryContainer, setMemoryContainer } from \"./CanvasContainer\";\n\n/**\n * This class is a extension of the [PIXI.Sprite class](https://pixijs.com/8.x/examples/sprite/basic), it has the same properties and methods,\n * but it has the ability to be saved and loaded by the Pixi'VN library.\n * @example\n * ```typescript\n * const texture = await Assets.load('https://pixijs.com/assets/bunny.png');\n * const sprite = CanvasSprite.from(texture);\n *\n * sprite.anchor.set(0.5);\n * sprite.x = GameWindowManager.screen.width / 2;\n * sprite.y = GameWindowManager.screen.height / 2;\n *\n * sprite.eventMode = 'static';\n * sprite.cursor = 'pointer';\n * sprite.onEvent('pointerdown', EventTest);\n *\n * GameWindowManager.addCanvasElement(\"bunny\", sprite);\n * ```\n */\nexport default class CanvasSprite<Memory extends SpriteOptions & ICanvasBaseMemory = ICanvasSpriteMemory> extends Sprite implements CanvasBase<Memory | ICanvasSpriteMemory> {\n get memory(): Memory | ICanvasSpriteMemory {\n return getMemorySprite(this)\n }\n set memory(value: ICanvasSpriteMemory) {\n setMemorySprite(this, value)\n }\n private _onEvents: { [name: CanvasEventNamesType]: EventIdType } = {}\n get onEvents() {\n return this._onEvents\n }\n /**\n * is same function as on(), but it keeps in memory the children.\n * @param event The event type, e.g., 'click', 'mousedown', 'mouseup', 'pointerdown', etc.\n * @param eventClass The class that extends CanvasEvent.\n * @returns \n * @example\n * ```typescript\n * \\@eventDecorator()\n * export class EventTest extends CanvasEvent<CanvasSprite> {\n * override fn(event: CanvasEventNamesType, sprite: CanvasSprite): void {\n * if (event === 'pointerdown') {\n * sprite.scale.x *= 1.25;\n * sprite.scale.y *= 1.25;\n * }\n * }\n * }\n * ```\n * \n * ```typescript\n * let sprite = addImage(\"alien\", 'https://pixijs.com/assets/eggHead.png')\n * await sprite.load()\n *\n * sprite.eventMode = 'static';\n * sprite.cursor = 'pointer';\n * sprite.onEvent('pointerdown', EventTest);\n *\n * GameWindowManager.addCanvasElement(\"bunny\", sprite);\n * ```\n */\n onEvent<T extends CanvasEventNamesType, T2 extends typeof CanvasEvent<typeof this>>(event: T, eventClass: T2) {\n let className = eventClass.name\n let instance = getEventInstanceByClassName(className)\n this._onEvents[event] = className\n if (instance) {\n super.on(event, () => {\n (instance as CanvasEvent<CanvasBase<any>>).fn(event, this)\n })\n }\n return this\n }\n /**\n * on() does not keep in memory the event class, use onEvent() instead\n * @deprecated\n * @private\n * @param event \n * @param fn \n * @param context \n */\n override on<T extends keyof ContainerEvents<ContainerChild> | keyof { [K: symbol]: any;[K: {} & string]: any; }>(event: T, fn: (...args: EventEmitter.ArgumentMap<ContainerEvents<ContainerChild> & { [K: symbol]: any;[K: {} & string]: any; }>[Extract<T, keyof ContainerEvents<ContainerChild> | keyof { [K: symbol]: any;[K: {} & string]: any; }>]) => void, context?: any): this {\n return super.on(event, fn, context)\n }\n static override from(source: Texture | TextureSourceLike, skipCache?: boolean): CanvasSprite<any> {\n let sprite = Sprite.from(source, skipCache)\n let mySprite = new CanvasSprite()\n mySprite.texture = sprite.texture\n return mySprite\n }\n}\n\nexport function getMemorySprite<T extends CanvasSprite<any>>(element: T | CanvasSprite<any>): ICanvasSpriteMemory {\n let temp = getMemoryContainer(element)\n return {\n ...temp,\n className: \"CanvasSprite\",\n textureImage: getTextureMemory((element as any).texture),\n anchor: { x: element.anchor.x, y: element.anchor.y },\n roundPixels: element.roundPixels,\n onEvents: element.onEvents,\n }\n}\n\nexport function setMemorySprite<Memory extends ICanvasSpriteBaseMemory>(element: CanvasSprite<any>, memory: Memory) {\n setMemoryContainer(element, memory)\n getTexture(memory.textureImage.image).then((texture) => {\n if (texture) {\n element.texture = texture\n }\n })\n if (memory.anchor) {\n if (typeof memory.anchor === \"number\") {\n element.anchor.set(memory.anchor, memory.anchor)\n }\n else {\n element.anchor.set(memory.anchor.x, memory.anchor.y)\n }\n }\n memory.roundPixels && (element.roundPixels = memory.roundPixels)\n for (let event in memory.onEvents) {\n let className = memory.onEvents[event]\n let instance = getEventTypeByClassName(className)\n if (instance) {\n element.onEvent(event, instance)\n }\n }\n}\n","import { CanvasEvent } from \"../classes\"\nimport CanvasBase from \"../classes/canvas/CanvasBase\"\nimport { CanvasEventNamesType } from \"../types/CanvasEventNamesType\"\nimport { EventIdType } from \"../types/EventIdType\"\n\n/**\n * Canvas Event Register\n */\nexport const registeredEvents: { [name: EventIdType]: typeof CanvasEvent<CanvasEventNamesType> } = {}\n/**\n * Is a decorator that register a event in the game.\n * Is a required decorator for use the event in the game.\n * Thanks to this decoration the game has the possibility of updating the events to the latest modification and saving the game.\n * @param name is th identifier of the event, by default is the name of the class\n * @returns \n */\nexport default function eventDecorator(name?: EventIdType) {\n return function (target: typeof CanvasEvent<any>) {\n if (!name) {\n name = target.name\n }\n if (registeredEvents[name]) {\n console.warn(`[Pixi'VN] Event ${name} already exists, it will be overwritten`)\n }\n registeredEvents[name] = target\n }\n}\n\n/**\n * Get an event type by the class name.\n * @param eventName The name of the class.\n * @returns The event type.\n */\nexport function getEventTypeByClassName<T = typeof CanvasEvent<CanvasBase<any>>>(eventName: EventIdType): T | undefined {\n try {\n let eventType = registeredEvents[eventName]\n if (!eventType) {\n console.error(`[Pixi'VN] Event ${eventName} not found`)\n return\n }\n new eventType()\n return eventType as T\n }\n catch (e) {\n console.error(`[Pixi'VN] Error while getting Event ${eventName}`, e)\n return\n }\n}\n\n/**\n * Get an event instance by the class name.\n * @param eventName The name of the class.\n * @returns The event instance.\n */\nexport function getEventInstanceByClassName<T = CanvasEvent<CanvasBase<any>>>(eventName: EventIdType): T | undefined {\n try {\n let eventType = registeredEvents[eventName]\n if (!eventType) {\n console.error(`[Pixi'VN] Event ${eventName} not found`)\n return\n }\n let event = new eventType()\n return event as T\n }\n catch (e) {\n console.error(`[Pixi'VN] Error while getting Event ${eventName}`, e)\n return\n }\n}\n","import { ContainerChild, ContainerEvents, EventEmitter, Text } from \"pixi.js\";\nimport { getEventInstanceByClassName, getEventTypeByClassName } from \"../../decorators/EventDecorator\";\nimport { getTextStyle } from \"../../functions/TextureUtility\";\nimport ICanvasTextMemory from \"../../interface/canvas/ICanvasTextTextMemory\";\nimport { CanvasEventNamesType } from \"../../types/CanvasEventNamesType\";\nimport { EventIdType } from \"../../types/EventIdType\";\nimport CanvasEvent from \"../CanvasEvent\";\nimport CanvasBase from \"./CanvasBase\";\nimport { getMemoryContainer, setMemoryContainer } from \"./CanvasContainer\";\n\n/**\n * This class is a extension of the [PIXI.Text class](https://pixijs.com/8.x/examples/text/pixi-text), it has the same properties and methods,\n * but it has the ability to be saved and loaded by the Pixi'VN library.\n * @example\n * ```typescript\n * const text = new CanvasText();\n * text.text = \"Hello World\"\n * GameWindowManager.addCanvasElement(\"text\", text);\n * ```\n */\nexport default class CanvasText extends Text implements CanvasBase<ICanvasTextMemory> {\n get memory(): ICanvasTextMemory {\n return getMemoryText(this)\n }\n set memory(value: ICanvasTextMemory) {\n setMemoryText(this, value)\n }\n private _onEvents: { [name: CanvasEventNamesType]: EventIdType } = {}\n get onEvents() {\n return this._onEvents\n }\n /**\n * is same function as on(), but it keeps in memory the children.\n * @param event The event type, e.g., 'click', 'mousedown', 'mouseup', 'pointerdown', etc.\n * @param eventClass The class that extends CanvasEvent.\n * @returns \n * @example\n * ```typescript\n * \\@eventDecorator()\n * export class EventTest extends CanvasEvent<CanvasText> {\n * override fn(event: CanvasEventNamesType, text: CanvasText): void {\n * if (event === 'pointerdown') {\n * text.scale.x *= 1.25;\n * text.scale.y *= 1.25;\n * }\n * }\n * }\n * ```\n * \n * ```typescript\n * const text = new CanvasText();\n * text.text = \"Hello World\"\n *\n * text.eventMode = 'static';\n * text.cursor = 'pointer';\n * text.onEvent('pointerdown', EventTest);\n *\n * GameWindowManager.addCanvasElement(\"text\", text);\n * ```\n */\n onEvent<T extends CanvasEventNamesType, T2 extends typeof CanvasEvent<typeof this>>(event: T, eventClass: T2) {\n let className = eventClass.name\n let instance = getEventInstanceByClassName(className)\n this._onEvents[event] = className\n if (instance) {\n super.on(event, () => {\n (instance as CanvasEvent<CanvasBase<any>>).fn(event, this)\n })\n }\n return this\n }\n /**\n * on() does not keep in memory the event class, use onEvent() instead\n * @deprecated\n * @private\n * @param event \n * @param fn \n * @param context \n */\n override on<T extends keyof ContainerEvents<ContainerChild> | keyof { [K: symbol]: any;[K: {} & string]: any; }>(event: T, fn: (...args: EventEmitter.ArgumentMap<ContainerEvents<ContainerChild> & { [K: symbol]: any;[K: {} & string]: any; }>[Extract<T, keyof ContainerEvents<ContainerChild> | keyof { [K: symbol]: any;[K: {} & string]: any; }>]) => void, context?: any): this {\n return super.on(event, fn, context)\n }\n}\n\nexport function getMemoryText<T extends CanvasText>(element: T | CanvasText): ICanvasTextMemory {\n let temp = getMemoryContainer(element)\n return {\n ...temp,\n className: \"CanvasText\",\n anchor: { x: element.anchor.x, y: element.anchor.y },\n text: element.text,\n resolution: element.resolution,\n style: getTextStyle(element.style),\n roundPixels: element.roundPixels,\n onEvents: element.onEvents,\n }\n}\n\nexport function setMemoryText(element: CanvasText, memory: ICanvasTextMemory) {\n setMemoryContainer(element, memory)\n if (memory.anchor) {\n if (typeof memory.anchor === \"number\") {\n element.anchor.set(memory.anchor, memory.anchor)\n }\n else {\n element.anchor.set(memory.anchor.x, memory.anchor.y)\n }\n }\n memory.text && (element.text = memory.text)\n memory.resolution && (element.resolution = memory.resolution)\n memory.style && (element.style = memory.style)\n memory.roundPixels && (element.roundPixels = memory.roundPixels)\n for (let event in memory.onEvents) {\n let className = memory.onEvents[event]\n let instance = getEventTypeByClassName(className)\n if (instance) {\n element.onEvent(event as CanvasEventNamesType, instance)\n }\n }\n}\n","import { CanvasContainer, CanvasImage, CanvasSprite, CanvasText } from \"../classes/canvas\"\nimport CanvasBase from \"../classes/canvas/CanvasBase\"\nimport { CanvasElementTagType } from \"../types/CanvasElementTagType\"\n\nexport const registeredCanvasElement: { [name: CanvasElementTagType]: typeof CanvasBase<any> } = {}\n/**\n * Is a decorator that register a canvas element in the game.\n * @param name Name of the canvas element, by default it will use the class name. If the name is already registered, it will show a warning\n * @returns \n */\nexport default function canvasElementDecorator(name?: CanvasElementTagType) {\n return function (target: typeof CanvasBase<any>) {\n if (!name) {\n name = target.name\n }\n if (registeredCanvasElement[name]) {\n console.warn(`[Pixi'VN] CanvasElement ${name} already registered`)\n }\n registeredCanvasElement[name] = target\n }\n}\n\nexport function getCanvasElementTypeByClassName<T extends typeof CanvasBase<any>>(canvasName: CanvasElementTagType): T | undefined {\n try {\n let eventType = registeredCanvasElement[canvasName]\n if (!eventType) {\n console.error(`[Pixi'VN] CanvasElement ${canvasName} not found`)\n return\n }\n new eventType()\n return eventType as T\n }\n catch (e) {\n console.error(`[Pixi'VN] Error while getting CanvasElement ${canvasName}`, e)\n return\n }\n}\n\nexport function getCanvasElementInstanceByClassName<T extends CanvasBase<any>>(canvasName: CanvasElementTagType): T | undefined {\n try {\n let eventType = registeredCanvasElement[canvasName]\n if (!eventType) {\n if (canvasName === \"CanvasContainer\") {\n eventType = CanvasContainer\n }\n else if (canvasName === \"CanvasImage\") {\n eventType = CanvasImage\n }\n else if (canvasName === \"CanvasSprite\") {\n eventType = CanvasSprite\n }\n else if (canvasName === \"CanvasText\") {\n eventType = CanvasText\n }\n }\n\n if (!eventType) {\n console.error(`[Pixi'VN] CanvasElement ${canvasName} not found`)\n return\n }\n let canvasElement = new eventType()\n return canvasElement as T\n }\n catch (e) {\n console.error(`[Pixi'VN] Error while getting CanvasElement ${canvasName}`, e)\n return\n }\n}\n","import { UPDATE_PRIORITY } from \"pixi.js\"\nimport TickerBase, { TickerArgsType } from \"../classes/ticker/TickerBase\"\nimport { TickerIdType } from \"../types/TickerIdType\"\n\n/**\n * A dictionary that contains all tickers registered and avvailable to be used.\n */\nexport const registeredTickers: { [name: TickerIdType]: typeof TickerBase } = {}\n/**\n * Is a decorator that register a ticker in the game.\n * Is a required decorator for use the ticker in the game.\n * Thanks to this decoration the game has the possibility of updating the tickers to the latest modification and saving the game.\n * @param name is th identifier of the label, by default is the name of the class\n * @returns \n */\nexport default function tickerDecorator(name?: TickerIdType) {\n return function (target: typeof TickerBase<any>) {\n if (!name) {\n name = target.name\n }\n if (registeredTickers[name]) {\n console.warn(`[Pixi'VN] Ticker ${name} already exists, it will be overwritten`)\n }\n registeredTickers[name] = target\n }\n}\n\n/**\n * Get a ticker instance by the class name.\n * @param tickerName The name of the class.\n * @returns The ticker instance.\n */\nexport function geTickerInstanceByClassName<TArgs extends TickerArgsType>(tickerName: TickerIdType, args: TArgs, duration?: number, priority?: UPDATE_PRIORITY): TickerBase<TArgs> | undefined {\n try {\n let ticker = registeredTickers[tickerName]\n if (!ticker) {\n console.error(`[Pixi'VN] Ticker ${tickerName} not found`)\n return\n }\n return new ticker(args, duration, priority)\n }\n catch (e) {\n console.error(`[Pixi'VN] Error while getting Ticker ${tickerName}`, e)\n return\n }\n}\n","export const PauseValueType = \"pause\"\nexport type PauseType = {\n type: typeof PauseValueType,\n duration: number,\n}\nexport function Pause(duration: number): PauseType {\n return {\n type: PauseValueType,\n duration: duration,\n }\n}","export type RepeatType = \"repeat\"\nexport const Repeat: RepeatType = \"repeat\"","import { GameStorageManager } from \"../managers\"\n\n/**\n * StoredClassModel is a abstract class that contains the methods to store a class in the game.\n * I suggest you extend this class to create your own stored class.\n * @example\n * ```typescript\n * export class CharacterBaseModel extends StoredClassModel implements CharacterBaseModelProps {\n * constructor(id: string, props: CharacterBaseModelProps) {\n * super(\"___character___\", id)\n * this.defaultName = props.name\n * this.defaultSurname = props.surname\n * }\n * private defaultName: string = \"\"\n * get name(): string {\n * return this.getStorageProperty<string>(\"name\") || this.defaultName\n * }\n * set name(value: string) {\n * this.setStorageProperty<string>(\"name\", value)\n * }\n * private defaultSurname?: string\n * get surname(): string | undefined {\n * return this.getStorageProperty<string>(\"surname\") || this.defaultSurname\n * }\n * set surname(value: string | undefined) {\n * this.setStorageProperty<string>(\"surname\", value)\n * }\n * }\n * ```\n */\nexport default class StoredClassModel {\n /**\n * @param categoryId The id of the category. For example if you are storing a character class, you can use \"characters\" as categoryId. so all instances of the character class will be stored in the \"characters\" category.\n * @param id The id of instance of the class. This id must be unique for the category.\n */\n constructor(categoryId: string, id: string) {\n this.categoryId = categoryId\n this._id = id\n }\n private _id: string\n /**\n * Is id of the stored class. is unique for this class.\n */\n get id(): string {\n return this._id\n }\n private categoryId: string\n /**\n * Update a property in the storage.\n * @param propertyName The name of the property to set.\n * @param value The value to set. If is undefined, the property will be removed from the storage.\n */\n setStorageProperty<T>(propertyName: string, value: T | undefined): void {\n let storage = GameStorageManager.getVariable<any>(this.categoryId)\n if (!storage) {\n storage = {}\n }\n // if storage not have a key with the id\n if (!storage.hasOwnProperty(this.id)) {\n storage[this.id] = {}\n }\n\n if (value === undefined || value === null) {\n if (storage[this.id].hasOwnProperty(propertyName)) {\n delete storage[this.id][propertyName]\n }\n }\n else {\n storage[this.id] = { ...storage[this.id], [propertyName]: value }\n }\n\n if (Object.keys(storage[this.id]).length === 0) {\n delete storage[this.id]\n }\n\n GameStorageManager.setVariable(this.categoryId, storage)\n }\n /**\n * Get a property from the storage.\n * @param propertyName The name of the property to get.\n * @returns The value of the property. If the property is not found, returns undefined.\n */\n getStorageProperty<T>(propertyName: string): T | undefined {\n let storage = GameStorageManager.getVariable<any>(this.categoryId)\n if (storage && storage.hasOwnProperty(this.id) && storage[this.id].hasOwnProperty(propertyName)) {\n return storage[this.id][propertyName]\n }\n return undefined\n }\n}\n","import { Label } from \"../classes\"\nimport { StepLabelType } from \"../types\"\nimport { LabelIdType } from \"../types/LabelIdType\"\n\nexport const registeredLabels: { [key: LabelIdType]: Label<any> } = {}\n\n/**\n * Creates a new label and registers it in the system\n * @param id The id of the label, it must be unique\n * @param steps The steps of the label\n * @param onStepRun is a function that will be executed before any step is executed, is useful for example to make sure all images used have been cached\n * @returns The created label\n */\nexport function newLabel<T extends {} = {}>(id: LabelIdType, steps: StepLabelType<T>[], onStepRun?: () => void | Promise<void>): Label<T> {\n if (registeredLabels[id]) {\n console.warn(`[Pixi'VN] Label ${id} already exists, it will be overwritten`)\n }\n let label = new Label<T>(id, steps, onStepRun)\n registeredLabels[id] = label\n return label\n}\n\n/**\n * Gets a label by its id\n * @param id The id of the label\n * @returns The label or undefined if it does not exist\n */\nexport function getLabelById<T = Label<any>>(id: LabelIdType): T | undefined {\n let label = registeredLabels[id]\n if (!label) {\n console.error(`[Pixi'VN] Label ${id} not found`)\n return\n }\n return label as T\n}\n","import { CharacterBaseModel, DialogueBaseModel, Label } from \"../classes\";\nimport { ChoiceMenuOptionClose, HistoryChoiceMenuOption, IStoratedChoiceMenuOption } from \"../classes/ChoiceMenuOption\";\nimport newCloseLabel from \"../classes/CloseLabel\";\nimport { DialogueData } from \"../classes/DialogueBaseModel\";\nimport { getLabelById } from \"../decorators\";\nimport { DialogueHistory } from \"../interface\";\nimport { GameStepManager, GameStorageManager } from \"../managers\";\nimport { Close } from \"../types\";\nimport { ChoiceMenuOptionsType } from \"../types/ChoiceMenuOptionsType\";\n\n/**\n * Set the dialogue to be shown in the game\n * @param text Text of the dialogue\n * @example\n * ```typescript\n * setDialogue(\"Hello World\")\n * setDialogue({\n * character: \"characterId\",\n * text: \"Hello World\"\n * })\n * setDialogue(new DialogueBaseModel(\"Hello World\", character))\n * ```\n */\nexport function setDialogue<TCharacter extends CharacterBaseModel = CharacterBaseModel, TDialogue extends DialogueBaseModel = DialogueBaseModel>(props: {\n character: string | TCharacter,\n text: string,\n} | string | TDialogue): void {\n let text = ''\n let characterId: string | undefined = undefined\n let dialogue: TDialogue | DialogueBaseModel\n if (typeof props === 'string') {\n text = props\n dialogue = new DialogueBaseModel(text, characterId)\n }\n else if (!(props instanceof DialogueBaseModel)) {\n text = props.text\n if (props.character) {\n if (typeof props.character === 'string') {\n characterId = props.character\n }\n else {\n characterId = props.character.id\n }\n }\n dialogue = new DialogueBaseModel(text, characterId)\n }\n else {\n dialogue = props\n }\n\n GameStorageManager.setVariable(GameStorageManager.keysSystem.CURRENT_DIALOGUE_MEMORY_KEY, dialogue as DialogueData)\n GameStorageManager.setVariable(GameStorageManager.keysSystem.LAST_DIALOGUE_ADDED_IN_STEP_MEMORY_KEY, GameStepManager.lastStepIndex)\n}\n\n/**\n * Get the dialogue to be shown in the game\n * @returns Dialogue to be shown in the game\n */\nexport function getDialogue<T extends DialogueBaseModel = DialogueBaseModel>(): T | undefined {\n return GameStorageManager.getVariable<DialogueData>(GameStorageManager.keysSystem.CURRENT_DIALOGUE_MEMORY_KEY) as T\n}\n\n/**\n * Clear the dialogue to be shown in the game\n */\nexport function clearDialogue(): void {\n GameStorageManager.setVariable(GameStorageManager.keysSystem.CURRENT_DIALOGUE_MEMORY_KEY, undefined)\n}\n\n/**\n * Set the options to be shown in the game\n * @param options Options to be shown in the game\n * @example\n * ```typescript\n * setChoiceMenuOptions([\n * new ChoiceMenuOption(\"Events Test\", EventsTestLabel),\n * new ChoiceMenuOption(\"Show Image Test\", ShowImageTest, \"call\", { image: \"imageId\" }),\n * new ChoiceMenuOption(\"Ticker Test\", TickerTestLabel),\n * new ChoiceMenuOption(\"Tinting Test\", TintingTestLabel, \"jump\"),\n * new ChoiceMenuOption(\"Base Canvas Element Test Label\", BaseCanvasElementTestLabel)\n * ])\n * ```\n */\nexport function setChoiceMenuOptions<T extends {} = {}>(options: ChoiceMenuOptionsType<T>): void {\n let value: IStoratedChoiceMenuOption[] = options.map((option) => {\n if (option instanceof ChoiceMenuOptionClose) {\n return {\n text: option.text,\n type: Close\n }\n }\n return {\n ...option,\n label: option.label.id,\n }\n })\n GameStorageManager.setVariable(GameStorageManager.keysSystem.CURRENT_MENU_OPTIONS_MEMORY_KEY, value)\n GameStorageManager.setVariable(GameStorageManager.keysSystem.LAST_MENU_OPTIONS_ADDED_IN_STEP_MEMORY_KEY, GameStepManager.lastStepIndex)\n}\n\n/**\n * Get the options to be shown in the game\n * @returns Options to be shown in the game\n */\nexport function getChoiceMenuOptions<TChoice extends ChoiceMenuOptionsType = ChoiceMenuOptionsType<{ [key: string | number | symbol]: any }>>(): TChoice | undefined {\n let d = GameStorageManager.getVariable<IStoratedChoiceMenuOption[]>(GameStorageManager.keysSystem.CURRENT_MENU_OPTIONS_MEMORY_KEY)\n if (d) {\n let options: ChoiceMenuOptionsType = []\n d.forEach((option, index) => {\n if (option.type === Close) {\n let itemLabel = newCloseLabel(index)\n options.push({\n text: option.text,\n label: itemLabel,\n type: Close,\n props: {}\n })\n return\n }\n let label = getLabelById(option.label)\n if (label) {\n let itemLabel = new Label(label.id, label.steps, label.onStepRun, index)\n options.push({\n ...option,\n label: itemLabel\n })\n }\n })\n return options as TChoice\n }\n return undefined\n}\n\n/**\n * Clear the options to be shown in the game\n */\nexport function clearChoiceMenuOptions(): void {\n GameStorageManager.setVariable(GameStorageManager.keysSystem.CURRENT_MENU_OPTIONS_MEMORY_KEY, undefined)\n}\n\n/**\n * Get the history of the dialogues\n * @returns the history of the dialogues\n */\nexport function getDialogueHistory<T extends DialogueBaseModel = DialogueBaseModel>(): DialogueHistory<T>[] {\n let list: DialogueHistory<T>[] = []\n GameStepManager.stepsHistory.forEach((step) => {\n let dialoge = step.dialoge\n let requiredChoices = step.choices\n if (\n list.length > 0 &&\n list[list.length - 1].choices &&\n !list[list.length - 1].playerMadeChoice &&\n step.currentLabel\n ) {\n let oldChoices = list[list.length - 1].choices\n if (oldChoices) {\n let choiceMade = false\n if (step.choiceIndexMade !== undefined && oldChoices.length > step.choiceIndexMade) {\n oldChoices[step.choiceIndexMade].isResponse = true\n choiceMade = true\n }\n list[list.length - 1].playerMadeChoice = choiceMade\n list[list.length - 1].choices = oldChoices\n }\n }\n if (dialoge || requiredChoices) {\n let choices: HistoryChoiceMenuOption[] | undefined = requiredChoices?.map((choice) => {\n return {\n text: choice.text,\n type: choice.type,\n isResponse: false\n }\n })\n list.push({\n dialoge: dialoge as T,\n playerMadeChoice: false,\n choices: choices,\n stepIndex: step.index\n })\n }\n })\n return list\n}\n","import { Ticker, UPDATE_PRIORITY } from \"pixi.js\"\nimport ITicker from \"../../interface/ITicker\"\nimport { StorageElementType } from \"../../types/StorageElementType\"\n\nexport type TickerArgsType = { [id: string]: StorageElementType }\n\n/**\n * A class is used to create a ticker element to add into a Pixi Application.\n * You can use GameWindowManager.addTicker() to add this element into the application.\n * This class should be extended and the fn method should be overridden.\n * You must use the tickerDecorator to register the ticker in the game.\n * In Ren'Py is a transform.\n * @example\n * ```typescript\n * \\@tickerDecorator() // this is equivalent to tickerDecorator(\"TickerRotate\")\n * export class TickerRotate extends TickerBase<{ speed?: number }> {\n * override fn(\n * t: Ticker,\n * args: {\n * speed?: number,\n * },\n * tags: string[]\n * ): void {\n * let speed = args.speed === undefined ? 0.1 : args.speed\n * tags.forEach((tag) => {\n * let element = GameWindowManager.getCanvasElement(tag)\n * if (element && element instanceof Container) {\n * if (clockwise)\n * element.rotation += speed * t.deltaTime\n * else\n * element.rotation -= speed * t.deltaTime\n * }\n * })\n * }\n * }\n * ```\n */\nexport default class TickerBase<TArgs extends TickerArgsType> implements ITicker<TArgs> {\n /**\n * @param args The arguments that you want to pass to the ticker.\n * @param duration The duration of the ticker. If is undefined, the ticker will be called every frame.\n * @param priority The priority of the ticker. If is undefined, the priority will be UPDATE_PRIORITY.NORMAL.\n */\n constructor(args: TArgs, duration?: number, priority?: UPDATE_PRIORITY) {\n this.args = args\n this.duration = duration\n this.priority = priority\n }\n args: TArgs\n duration?: number\n priority?: UPDATE_PRIORITY\n /**\n * The method that will be called every frame.\n * This method should be overridden and you can use GameWindowManager.addCanvasElement() to get the canvas element of the canvas, and edit them.\n * @param t The ticker that is calling this method\n * @param args The arguments that you passed when you added the ticker\n * @param tags The tags of the canvas elements that are connected to this ticker\n */\n fn(_t: Ticker, _args: TArgs, _tags: string | string[]): void { throw new Error(\"[Pixi'VN] The method TickerBase.fn() must be overridden\") }\n}\n","import { Container, Sprite, Ticker } from \"pixi.js\";\nimport { tickerDecorator } from \"../../decorators\";\nimport { GameWindowManager } from \"../../managers\";\nimport { TickerFadeAlphaProps } from \"../../types/ticker/TickerFadeAlphaProps\";\nimport TickerBase from \"./TickerBase\";\n\n/**\n * A ticker that fades the alpha of the canvas element of the canvas.\n * @example\n * ```typescript\n * let bunny = addImage(\"bunny1\", \"https://pixijs.com/assets/eggHead.png\")\n * await bunny.load()\n * GameWindowManager.addCanvasElement(\"bunny\", bunny);\n * // ...\n * const ticker = new TickerFadeAlpha({\n * speed: 0.01,\n * type: \"hide\",\n * }),\n * GameWindowManager.addTicker(\"bunny\", ticker)\n * ```\n */\n@tickerDecorator()\nexport default class TickerFadeAlpha extends TickerBase<TickerFadeAlphaProps> {\n /**\n * The method that will be called every frame to fade the alpha of the canvas element of the canvas.\n * @param delta The delta time\n * @param args The arguments that are passed to the ticker\n * @param tags The tags of the canvas element that are connected to this ticker\n */\n override fn(\n t: Ticker,\n args: TickerFadeAlphaProps,\n tags: string[]\n ): void {\n let type = args.type === undefined ? \"hide\" : args.type\n let speed = args.speed === undefined ? 0.1 : args.speed\n let limit = args.limit === undefined ? type === \"hide\" ? 0 : 1 : args.limit\n let removeElementAfter = args.tagToRemoveAfter || []\n if (typeof removeElementAfter === \"string\") {\n removeElementAfter = [removeElementAfter]\n }\n if (type === \"hide\" && limit < 0) {\n limit = 0\n }\n if (type === \"show\" && limit > 1) {\n limit = 1\n }\n tags\n .filter((tag) => {\n let element = GameWindowManager.getCanvasElement(tag)\n if (args.startOnlyIfHaveTexture) {\n if (element && element instanceof Sprite && element.texture?.label == \"EMPTY\") {\n return false\n }\n }\n return true\n })\n .forEach((tag) => {\n let element = GameWindowManager.getCanvasElement(tag)\n if (element && element instanceof Container) {\n if (type === \"show\" && element.alpha < limit) {\n element.alpha += speed * t.deltaTime\n }\n else if (type === \"hide\" && element.alpha > limit) {\n element.alpha -= speed * t.deltaTime\n }\n else {\n element.alpha = limit\n GameWindowManager.removeAssociationBetweenTickerCanvasElement(tag, this)\n GameWindowManager.removeCanvasElement(removeElementAfter)\n }\n }\n })\n }\n}\n","import { Container, Sprite, Ticker } from \"pixi.js\";\nimport { tickerDecorator } from \"../../decorators\";\nimport { updateTickerProgression } from \"../../functions/TickerUtility\";\nimport { GameWindowManager } from \"../../managers\";\nimport { TickerMoveProps } from \"../../types/ticker/TickerMoveProps\";\nimport TickerBase from \"./TickerBase\";\n\n/**\n * A ticker that moves the canvas element of the canvas.\n * @example\n * ```typescript\n * let alien = addImage(\"alien\", 'https://pixijs.com/assets/eggHead.png')\n * GameWindowManager.addCanvasElement(\"alien\", alien);\n * const ticker = new TickerMove({\n * speed: 0.1,\n * destination: { x: 100, y: 100 },\n * }),\n * ```\n */\n@tickerDecorator()\nexport default class TickerMove extends TickerBase<TickerMoveProps> {\n /**\n * The method that will be called every frame to move the canvas element of the canvas.\n * @param t The ticker that is calling this method\n * @param args The arguments that are passed to the ticker\n * @param tags The tags of the canvas element that are connected to this ticker\n */\n override fn(\n t: Ticker,\n args: TickerMoveProps,\n tags: string[]\n ): void {\n let speed = args.speed === undefined ? 0.1 : args.speed\n let destination = args.destination\n tags\n .filter((tag) => {\n let element = GameWindowManager.getCanvasElement(tag)\n if (args.startOnlyIfHaveTexture) {\n if (element && element instanceof Sprite && element.texture?.label == \"EMPTY\") {\n return false\n }\n }\n return true\n })\n .forEach((tag) => {\n let element = GameWindowManager.getCanvasElement(tag)\n if (element && element instanceof Container) {\n let xDistance = destination.x - element.x\n if (xDistance != 0) {\n element.x += xDistance / speed * t.deltaTime\n let newDistance = destination.x - element.x\n if (xDistance < 0 && newDistance > 0 ||\n xDistance > 0 && newDistance < 0\n ) {\n element.x = destination.x\n }\n }\n let yDistance = destination.y - element.y\n if (yDistance != 0) {\n element.y += yDistance / speed * t.deltaTime\n let newDistance = destination.y - element.y\n if (yDistance < 0 && newDistance > 0 ||\n yDistance > 0 && newDistance < 0\n ) {\n element.y = destination.y\n }\n }\n }\n })\n if (args.speedProgression)\n updateTickerProgression(args, \"speed\", args.speedProgression)\n }\n}\n","import { TickerProgrationType } from \"../interface/TickerProgrationType\"\n\n/**\n * This function updates the progression of the ticker.\n * For example, if the speed of the ticker is 0.1 and the progression is 0.01, then the speed will be 0.11.\n * @param args The arguments that are passed to the ticker\n * @param propertyName The property name that will be updated \n * @param progression The progression of the ticker\n * @returns \n */\nexport function updateTickerProgression(args: any, propertyName: string, progression: TickerProgrationType) {\n if (args.hasOwnProperty(propertyName) && typeof args[propertyName] !== \"number\") {\n return\n }\n if (args[propertyName] !== undefined\n && progression\n && args[propertyName] !== progression.limit\n ) {\n if (progression.type === \"linear\") {\n args[propertyName] += progression.amt\n if (progression.limit !== undefined) {\n if (args[propertyName] > progression.limit && progression.amt > 0) {\n args[propertyName] = progression.limit\n }\n else if (args[propertyName] < progression.limit && progression.amt < 0) {\n args[propertyName] = progression.limit\n }\n }\n }\n else if (progression.type === \"exponential\") {\n args[propertyName] += args[propertyName] * progression.percentage\n if (progression.limit !== undefined) {\n if (args[propertyName] > progression.limit && progression.percentage > 0) {\n args[propertyName] = progression.limit\n }\n else if (args[propertyName] < progression.limit && progression.percentage < 0) {\n args[propertyName] = progression.limit\n }\n }\n }\n }\n}\n","import { Container, Sprite, Ticker } from \"pixi.js\";\nimport { tickerDecorator } from \"../../decorators\";\nimport { updateTickerProgression } from \"../../functions/TickerUtility\";\nimport { GameWindowManager } from \"../../managers\";\nimport { TickerRotateProps } from \"../../types/ticker/TickerRotateProps\";\nimport TickerBase from \"./TickerBase\";\n\n/**\n * A ticker that rotates the canvas element of the canvas.\n * @example\n * ```typescript\n * let alien = addImage(\"alien\", 'https://pixijs.com/assets/eggHead.png')\n * GameWindowManager.addCanvasElement(\"alien\", alien);\n * const ticker = new TickerRotate({\n * speed: 0.1,\n * clockwise: true,\n * }),\n * GameWindowManager.addTicker(\"alien\", ticker)\n * ```\n */\n@tickerDecorator()\nexport default class TickerRotate extends TickerBase<TickerRotateProps> {\n /**\n * The method that will be called every frame to rotate the canvas element of the canvas.\n * @param delta The delta time\n * @param args The arguments that are passed to the ticker\n * @param tags The tags of the canvas element that are connected to this ticker\n */\n override fn(\n t: Ticker,\n args: TickerRotateProps,\n tags: string[]\n ): void {\n let speed = args.speed === undefined ? 0.1 : args.speed\n let clockwise = args.clockwise === undefined ? true : args.clockwise\n tags\n .filter((tag) => {\n let element = GameWindowManager.getCanvasElement(tag)\n if (args.startOnlyIfHaveTexture) {\n if (element && element instanceof Sprite && element.texture?.label == \"EMPTY\") {\n return false\n }\n }\n return true\n })\n .forEach((tag) => {\n let element = GameWindowManager.getCanvasElement(tag)\n if (element && element instanceof Container) {\n if (clockwise)\n element.rotation += speed * t.deltaTime\n else\n element.rotation -= speed * t.deltaTime\n }\n })\n if (args.speedProgression)\n updateTickerProgression(args, \"speed\", args.speedProgression)\n }\n}\n","/**\n * This function is used to create a deep copy of the element\n * @param element The element to be copied\n * @returns The copied element\n */\nexport function createExportableElement<T>(element: T): T {\n try {\n let elementString = JSON.stringify(element)\n return JSON.parse(elementString)\n }\n catch (e) {\n console.error(\"[Pixi'VN] Error creating exportable element\", e)\n throw new Error(\"[Pixi'VN] Error creating exportable element\")\n }\n}\n","import deepDiff from \"deep-diff\"\nimport { createExportableElement } from \"./ExportUtility\"\n\nexport function restoreDeepDiffChanges<T extends object = object>(data: T, differences: deepDiff.Diff<T, T>[]): T {\n let result = createExportableElement(data)\n differences.forEach((diff) => {\n let dataToEdit: any = result\n if (diff.path && diff.path.length > 0) {\n diff.path.forEach((path, index) => {\n if (diff.path && index === diff.path.length - 1) {\n if (diff.kind === \"E\" || diff.kind === \"D\") {\n dataToEdit[path] = diff.lhs\n }\n else if (diff.kind === \"N\") {\n // if path is a number, dataToEdit is an array\n if (Number.isInteger(path)) {\n // remove index from array\n if (Array.isArray(dataToEdit)) {\n dataToEdit.splice(path, 1)\n }\n }\n // if path is a string, dataToEdit is an object\n else if (typeof path === \"string\") {\n // remove key from object\n delete dataToEdit[path]\n }\n }\n else if (diff.kind === \"A\") {\n let index = diff.index\n if (diff.item.kind === \"N\") {\n // remove index from array\n (dataToEdit[path] as any[]).splice(index, 1)\n }\n else if (diff.item.kind === \"E\" || diff.item.kind === \"D\") {\n // edit index in array\n (dataToEdit[path] as any[])[index] = diff.item.lhs\n }\n else if (diff.item.kind === \"A\") {\n console.warn(\"[Pixi'VN] Nested array found, skipping diff\", diff)\n }\n else {\n console.warn(\"[Pixi'VN] No array found, skipping diff\", diff)\n }\n }\n }\n else {\n dataToEdit = dataToEdit[path]\n }\n })\n }\n else {\n console.warn(\"[Pixi'VN] No path found, skipping diff\", diff)\n }\n })\n return result\n}","import { createExportableElement } from \"../functions/ExportUtility\"\nimport { ExportedStorage } from \"../interface/export\"\nimport { StorageElementType } from \"../types/StorageElementType\"\n\nexport default class GameStorageManager {\n private static storage: { [key: string]: StorageElementType } = {}\n private constructor() { }\n public static get keysSystem() {\n return {\n CURRENT_DIALOGUE_MEMORY_KEY: \"___current_dialogue_memory___\",\n LAST_DIALOGUE_ADDED_IN_STEP_MEMORY_KEY: \"___last_dialogue_added_in_step_memory___\",\n CURRENT_MENU_OPTIONS_MEMORY_KEY: \"___current_menu_options_memory___\",\n LAST_MENU_OPTIONS_ADDED_IN_STEP_MEMORY_KEY: \"___last_menu_options_added_in_step_memory___\",\n CHARACTER_CATEGORY_KEY: \"___character___\",\n FLAGS_CATEGORY_KEY: \"___flags___\",\n }\n }\n /**\n * Set a variable in the storage\n * @param key The key of the variable\n * @param value The value of the variable. If undefined, the variable will be removed\n * @returns\n */\n public static setVariable(key: string, value: StorageElementType) {\n key = key.toLowerCase()\n if (value === undefined || value === null) {\n if (GameStorageManager.storage.hasOwnProperty(key)) {\n delete GameStorageManager.storage[key]\n }\n return\n }\n GameStorageManager.storage[key] = value\n }\n /**\n * Get a variable from the storage\n * @param key The key of the variable\n * @returns The value of the variable. If the variable does not exist, it will return undefined\n */\n public static getVariable<T extends StorageElementType>(key: string): T | undefined {\n key = key.toLowerCase()\n if (GameStorageManager.storage.hasOwnProperty(key)) {\n return GameStorageManager.storage[key] as T\n }\n return undefined\n }\n /**\n * Remove a variable from the storage\n * @param key The key of the variable\n * @returns\n */\n public static removeVariable(key: string) {\n key = key.toLowerCase()\n if (GameStorageManager.storage.hasOwnProperty(key)) {\n delete GameStorageManager.storage[key]\n }\n }\n /**\n * Clear the storage and the oidsUsed\n * @returns\n */\n public static clear() {\n GameStorageManager.storage = {}\n }\n public static exportJson(): string {\n return JSON.stringify(this.export())\n }\n public static export(): ExportedStorage {\n return createExportableElement(GameStorageManager.storage)\n }\n public static importJson(dataString: string) {\n GameStorageManager.import(JSON.parse(dataString))\n }\n public static import(data: object) {\n GameStorageManager.clear()\n try {\n if (data) {\n GameStorageManager.storage = (data as ExportedStorage)\n }\n else {\n console.warn(\"[Pixi'VN] No storage data found\")\n }\n }\n catch (e) {\n console.error(\"[Pixi'VN] Error importing data\", e)\n }\n }\n}\n","import { Application, ApplicationOptions, Container, Ticker } from \"pixi.js\";\nimport CanvasBase from \"../classes/canvas/CanvasBase\";\nimport TickerBase, { TickerArgsType } from \"../classes/ticker/TickerBase\";\nimport { geTickerInstanceByClassName } from \"../decorators/TickerDecorator\";\nimport { exportCanvasElement, importCanvasElement } from \"../functions/CanvasUtility\";\nimport { asciiArtLog } from \"../functions/EasterEgg\";\nimport { createExportableElement } from \"../functions/ExportUtility\";\nimport { ITicker, ITickersSteps } from \"../interface\";\nimport { IClassWithArgsHistory } from \"../interface/IClassWithArgsHistory\";\nimport { ITickersStep } from \"../interface/ITickersSteps\";\nimport { ICanvasBaseMemory } from \"../interface/canvas\";\nimport { ExportedCanvas } from \"../interface/export\";\nimport { PauseType, PauseValueType } from \"../types/PauseType\";\nimport { Repeat, RepeatType } from \"../types/RepeatType\";\nimport { TickerIdType } from \"../types/TickerIdType\";\n\n/**\n * This class is responsible for managing the canvas, the tickers, the events, and the window size and the children of the window.\n */\nexport default class GameWindowManager {\n private constructor() { }\n\n private static _app: Application | undefined = undefined\n /**\n * The PIXI Application instance.\n * It not recommended to use this property directly.\n */\n static get app() {\n if (!GameWindowManager._app) {\n throw new Error(\"[Pixi'VN] GameWindowManager.app is undefined\")\n }\n return GameWindowManager._app\n }\n private static _isInitialized: boolean = false\n /**\n * If the manager is initialized.\n */\n static get isInitialized() {\n return GameWindowManager._isInitialized\n }\n /**\n * This is the div that have same size of the canvas.\n * This is useful to put interface elements.\n * You can use React or other framework to put elements in this div.\n */\n static htmlLayout: HTMLElement\n static canvasWidth: number\n static canvasHeight: number\n static get screen() {\n return GameWindowManager.app.screen\n }\n\n /**\n * Initialize the PIXI Application and the interface div.\n * This method should be called before any other method.\n * @param element The html element where I will put the canvas. Example: document.body\n * @param width The width of the canvas\n * @param height The height of the canvas\n * @param options The options of PIXI Application\n * @example\n * ```typescript\n * const body = document.body\n * if (!body) {\n * throw new Error('body element not found')\n * }\n * await GameWindowManager.initialize(body, 1920, 1080, {\n * backgroundColor: \"#303030\"\n * })\n * ```\n */\n public static async initialize(element: HTMLElement, width: number, height: number, options?: Partial<ApplicationOptions>): Promise<void> {\n GameWindowManager.canvasWidth = width\n GameWindowManager.canvasHeight = height\n GameWindowManager._app = new Application()\n return GameWindowManager.app.init({\n resolution: window.devicePixelRatio || 1,\n autoDensity: true,\n width: width,\n height: height,\n ...options\n }).then(() => {\n GameWindowManager._isInitialized = true\n // Manager.app.ticker.add(Manager.update)\n this.addCanvasIntoElement(element)\n // listen for the browser telling us that the screen size changed\n window.addEventListener(\"resize\", GameWindowManager.resize)\n\n // call it manually once so we are sure we are the correct size after starting\n GameWindowManager.resize()\n\n asciiArtLog()\n });\n }\n\n /**\n * Add the canvas into a html element.\n * @param element it is the html element where I will put the canvas. Example: document.body\n */\n private static addCanvasIntoElement(element: HTMLElement) {\n if (GameWindowManager.isInitialized) {\n element.appendChild(GameWindowManager.app.canvas as HTMLCanvasElement)\n }\n else {\n console.error(\"[Pixi'VN] GameWindowManager is not initialized\")\n }\n }\n /**\n * Initialize the interface div and add it into a html element.\n * @param element it is the html element where I will put the interface div. Example: document.getElementById('root')\n * @example\n * ```typescript\n * const root = document.getElementById('root')\n * if (!root) {\n * throw new Error('root element not found')\n * }\n * GameWindowManager.initializeHTMLLayout(root)\n * const reactRoot = createRoot(GameWindowManager.htmlLayout)\n * reactRoot.render(\n * <App />\n * )\n * ```\n */\n public static initializeHTMLLayout(element: HTMLElement) {\n let div = document.createElement('div')\n div.style.position = 'absolute'\n div.style.pointerEvents = 'none'\n element.appendChild(div)\n GameWindowManager.htmlLayout = div\n GameWindowManager.resize()\n }\n\n /* Resize Metods */\n\n /**\n * This method returns the scale of the screen.\n */\n public static get screenScale() {\n let screenWidth = Math.max(document.documentElement.clientWidth, window.innerWidth || 0)\n let screenHeight = Math.max(document.documentElement.clientHeight, window.innerHeight || 0)\n return Math.min(screenWidth / GameWindowManager.canvasWidth, screenHeight / GameWindowManager.canvasHeight)\n }\n /**\n * This method returns the width of the screen enlarged by the scale.\n */\n public static get screenWidth() {\n return Math.floor(GameWindowManager.screenScale * GameWindowManager.canvasWidth)\n }\n /**\n * This method returns the height of the screen enlarged by the scale.\n */\n public static get screenHeight() {\n return Math.floor(GameWindowManager.screenScale * GameWindowManager.canvasHeight)\n }\n /**\n * This method returns the horizontal margin of the screen.\n */\n public static get horizontalMargin() {\n let screenWidth = Math.max(document.documentElement.clientWidth, window.innerWidth || 0)\n return (screenWidth - GameWindowManager.screenWidth) / 2\n }\n /**\n * This method returns the vertical margin of the screen.\n */\n public static get verticalMargin() {\n let screenHeight = Math.max(document.documentElement.clientHeight, window.innerHeight || 0)\n return (screenHeight - GameWindowManager.screenHeight) / 2\n }\n /**\n * This method is called when the screen is resized.\n */\n private static resize(): void {\n // now we use css trickery to set the sizes and margins\n if (GameWindowManager.isInitialized) {\n let style = GameWindowManager.app.canvas.style;\n style.width = `${GameWindowManager.screenWidth}px`;\n style.height = `${GameWindowManager.screenHeight}px`;\n (style as any).marginLeft = `${GameWindowManager.horizontalMargin}px`;\n (style as any).marginRight = `${GameWindowManager.horizontalMargin}px`;\n (style as any).marginTop = `${GameWindowManager.verticalMargin}px`;\n (style as any).marginBottom = `${GameWindowManager.verticalMargin}px`;\n }\n\n if (GameWindowManager.htmlLayout) {\n GameWindowManager.htmlLayout.style.width = `${GameWindowManager.screenWidth}px`\n GameWindowManager.htmlLayout.style.height = `${GameWindowManager.screenHeight}px`\n GameWindowManager.htmlLayout.style.marginLeft = `${GameWindowManager.horizontalMargin}px`\n GameWindowManager.htmlLayout.style.marginRight = `${GameWindowManager.horizontalMargin}px`\n GameWindowManager.htmlLayout.style.marginTop = `${GameWindowManager.verticalMargin}px`\n GameWindowManager.htmlLayout.style.marginBottom = `${GameWindowManager.verticalMargin}px`\n }\n }\n\n /* Edit Canvas Elements Methods */\n\n /**\n * This is a dictionary that contains all Canvas Elements of Canvas, currently.\n */\n static get currentCanvasElements() {\n return GameWindowManager._children\n }\n private static _children: { [tag: string]: CanvasBase<any> } = {}\n /**\n * The order of the children tags.\n */\n private static childrenTagsOrder: string[] = []\n /**\n * Add a canvas element to the canvas.\n * If there is a canvas element with the same tag, it will be removed.\n * @param tag The tag of the canvas element.\n * @param canvasElement The canvas elements to be added.\n * @example\n * ```typescript\n * const texture = await Assets.load('https://pixijs.com/assets/bunny.png');\n * const sprite = CanvasSprite.from(texture);\n * GameWindowManager.addCanvasElement(\"bunny\", sprite);\n * ```\n */\n public static addCanvasElement(tag: string, canvasElement: CanvasBase<any>) {\n if (GameWindowManager._children[tag]) {\n GameWindowManager.removeCanvasElement(tag)\n }\n GameWindowManager.app.stage.addChild(canvasElement)\n GameWindowManager._children[tag] = canvasElement\n GameWindowManager.childrenTagsOrder.push(tag)\n }\n /**\n * Remove a canvas element from the canvas.\n * And remove all tickers that are not connected to any canvas element.\n * @param tag The tag of the canvas element to be removed.\n * @returns \n * @example\n * ```typescript\n * GameWindowManager.removeCanvasElement(\"bunny\");\n * ```\n */\n public static removeCanvasElement(tag: string | string[]) {\n if (typeof tag === \"string\") {\n tag = [tag]\n }\n tag.forEach((t) => {\n if (GameWindowManager._children[t]) {\n GameWindowManager.app.stage.removeChild(GameWindowManager._children[t])\n delete GameWindowManager._children[t]\n }\n })\n GameWindowManager.removeTickersWithoutAssociatedCanvasElement()\n GameWindowManager.childrenTagsOrder = GameWindowManager.childrenTagsOrder.filter((t) => !tag.includes(t))\n }\n /**\n * Get a canvas element by the tag.\n * @param tag The tag of the canvas element.\n * @returns The canvas element.\n * @example\n * ```typescript\n * const sprite = GameWindowManager.getCanvasElement<CanvasSprite>(\"bunny\");\n * ```\n */\n public static getCanvasElement<T extends CanvasBase<any>>(tag: string): T | undefined {\n return GameWindowManager._children[tag] as T | undefined\n }\n /**\n * Check if a DisplayObject is on the canvas.\n * @param pixiElement The DisplayObject to be checked.\n * @returns If the DisplayObject is on the canvas.\n */\n public static canvasElementIsOnCanvas<T extends Container>(pixiElement: T) {\n return GameWindowManager.app.stage.children.includes(pixiElement)\n }\n /**\n * Remove all canvas elements from the canvas.\n * And remove all tickers that are not connected to any canvas element.\n */\n public static removeCanvasElements() {\n GameWindowManager.app.stage.removeChildren()\n GameWindowManager._children = {}\n GameWindowManager.childrenTagsOrder = []\n GameWindowManager.removeTickers()\n }\n /**\n * Edit the tag of a canvas element.\n * @param oldTag The old tag of the canvas element.\n * @param newTag The new tag of the canvas element.\n */\n public static editTagCanvasElement(oldTag: string, newTag: string) {\n if (GameWindowManager._children[oldTag]) {\n GameWindowManager._children[newTag] = GameWindowManager._children[oldTag]\n delete GameWindowManager._children[oldTag]\n }\n }\n\n /** Edit Tickers Methods */\n\n /**\n * Currently tickers that are running.\n */\n public static get currentTickers() {\n return GameWindowManager._currentTickers\n }\n private static _currentTickers: IClassWithArgsHistory<any>[] = []\n /**\n * The steps of the tickers\n */\n public static get currentTickersSteps() {\n return GameWindowManager._currentTickersSteps\n }\n private static _currentTickersSteps: { [tag: string]: ITickersSteps } = {}\n static currentTickersTimeouts: { [timeout: string]: { tags: string[], ticker: string } } = {}\n /**\n * Run a ticker.\n * @param canvasEslementTag The tag of the canvas element that will use the ticker.\n * @param ticker The ticker class to be run.\n * @param args The arguments to be used in the ticker.\n * @param duration The time to be used in the ticker. This number is in milliseconds. If it is undefined, the ticker will run forever.\n * @param priority The priority to be used in the ticker.\n * @returns \n * @example\n * ```typescript\n * GameWindowManager.addTicker(\"alien\", new TickerRotate({ speed: 0.2 }))\n * ```\n */\n static addTicker<TArgs extends TickerArgsType>(canvasElementTag: string | string[], ticker: TickerBase<TArgs>) {\n let tickerName: TickerIdType = ticker.constructor.name\n if (typeof canvasElementTag === \"string\") {\n canvasElementTag = [canvasElementTag]\n }\n let t = geTickerInstanceByClassName<TArgs>(tickerName, ticker.args, ticker.duration, ticker.priority)\n if (!t) {\n console.error(`[Pixi'VN] Ticker ${tickerName} not found`)\n return\n }\n GameWindowManager.removeAssociationBetweenTickerCanvasElement(canvasElementTag, ticker)\n let tickerHistory: IClassWithArgsHistory<TArgs> = {\n fn: () => { },\n className: tickerName,\n args: ticker.args,\n canvasElementTags: canvasElementTag,\n priority: ticker.priority,\n duration: ticker.duration,\n }\n GameWindowManager.pushTicker(tickerHistory, t)\n GameWindowManager.removeTickersWithoutAssociatedCanvasElement()\n if (ticker.duration) {\n let timeout = setTimeout(() => {\n GameWindowManager.removeTickerTimeoutInfo(timeout)\n GameWindowManager.nextTickerStep(canvasElementTag)\n }, ticker.duration);\n GameWindowManager.addTickerTimeoutInfo(canvasElementTag, tickerName, timeout.toString())\n }\n }\n private static pushTicker<TArgs extends TickerArgsType>(tickerData: IClassWithArgsHistory<TArgs>, ticker: TickerBase<TArgs>) {\n GameWindowManager.removeAssociationBetweenTickerCanvasElement(tickerData.canvasElementTags, tickerData)\n GameWindowManager._currentTickers.push(tickerData)\n tickerData.fn = (t: Ticker) => {\n ticker?.fn(t, tickerData.args, tickerData.canvasElementTags)\n }\n GameWindowManager.app.ticker.add(tickerData.fn, undefined, tickerData.priority)\n }\n /**\n * Run a sequence of tickers.\n * @param tag The tag of canvas element that will use the tickers.\n * @param steps The steps of the tickers.\n * @returns\n * @example\n * ```typescript\n * GameWindowManager.addTickersSteps(\"alien\", [\n * new TickerRotate({ speed: 0.1, clockwise: true }, 2000),\n * Pause(500),\n * new TickerRotate({ speed: 0.2, clockwise: false }, 2000),\n * Repeat,\n * ])\n * ```\n */\n static addTickersSteps<TArgs extends TickerArgsType>(tag: string, steps: (ITicker<TArgs> | RepeatType | PauseType)[]) {\n if (steps.length == 0) {\n console.warn(\"[Pixi'VN] The steps of the tickers is empty\")\n return\n }\n let alredyExists = GameWindowManager._currentTickersSteps[tag] !== undefined\n GameWindowManager._currentTickersSteps[tag] = {\n currentStepNumber: 0,\n steps: steps.map((s) => {\n if (s === Repeat) {\n return s\n }\n if (!s.duration) {\n console.warn(\"[Pixi'VN] Duration is not defined, so it will be set to 1000\")\n s.duration = 1000\n }\n if (s.hasOwnProperty(\"type\") && (s as PauseType).type === PauseValueType) {\n return s as PauseType\n }\n let tickerName = s.constructor.name\n return {\n ticker: tickerName,\n args: (s as ITicker<TArgs>).args,\n duration: s.duration,\n }\n })\n }\n if (!alredyExists) {\n GameWindowManager.runTickersSteps(tag)\n }\n }\n private static runTickersSteps<TArgs extends TickerArgsType>(tag: string) {\n let step = GameWindowManager._currentTickersSteps[tag].steps[GameWindowManager._currentTickersSteps[tag].currentStepNumber]\n if (step === Repeat) {\n step = GameWindowManager._currentTickersSteps[tag].steps[0]\n GameWindowManager._currentTickersSteps[tag].currentStepNumber = 0\n if (step === Repeat) {\n console.error(\"[Pixi'VN] TikersSteps has a RepeatType in the first step\")\n return\n }\n }\n if (step.hasOwnProperty(\"type\") && (step as PauseType).type === PauseValueType) {\n let timeout = setTimeout(() => {\n GameWindowManager.removeTickerTimeoutInfo(timeout)\n GameWindowManager.nextTickerStep(tag)\n }, step.duration);\n GameWindowManager.addTickerTimeoutInfo(tag, \"steps\", timeout.toString())\n return\n }\n let ticker = geTickerInstanceByClassName<TArgs>((step as ITickersStep<TArgs>).ticker, (step as ITickersStep<TArgs>).args, step.duration, (step as ITickersStep<TArgs>).priority)\n if (!ticker) {\n console.error(`[Pixi'VN] Ticker ${(step as ITickersStep<TArgs>).ticker} not found`)\n return\n }\n GameWindowManager.addTicker(tag, ticker)\n }\n private static nextTickerStep(tag: string | string[]) {\n if (typeof tag === \"string\") {\n tag = [tag]\n }\n tag.forEach((tag) => {\n if (GameWindowManager._currentTickersSteps[tag]) {\n let steps = GameWindowManager._currentTickersSteps[tag]\n if (steps.currentStepNumber + 1 < steps.steps.length) {\n steps.currentStepNumber++\n GameWindowManager._currentTickersSteps[tag] = steps\n GameWindowManager.runTickersSteps(tag)\n }\n else {\n delete GameWindowManager._currentTickersSteps[tag]\n }\n }\n })\n }\n /**\n * Remove a connection between a canvas element and a ticker.\n * And remove the ticker if there is no canvas element connected to it.\n * @param tag The tag of the canvas element that will use the ticker.\n * @param ticker The ticker class to be removed.\n * @example\n * ```typescript\n * GameWindowManager.removeAssociationBetweenTickerCanvasElement(\"alien\", TickerRotate)\n * ```\n */\n public static removeAssociationBetweenTickerCanvasElement(tag: string | string[], ticker: typeof TickerBase<any> | TickerBase<any>) {\n let tickerName: TickerIdType\n if (ticker instanceof TickerBase) {\n tickerName = ticker.constructor.name\n }\n else {\n tickerName = ticker.name\n }\n if (typeof tag === \"string\") {\n tag = [tag]\n }\n GameWindowManager._currentTickers = GameWindowManager._currentTickers.map((t) => {\n if (t.className === tickerName) {\n t.canvasElementTags = t.canvasElementTags.filter((e) => !tag.includes(e))\n }\n return t\n })\n for (let timeout in GameWindowManager.currentTickersTimeouts) {\n let t = GameWindowManager.currentTickersTimeouts[timeout].tags.filter((e) => !tag.includes(e))\n if (t.length == 0) {\n GameWindowManager.removeTickerTimeoutInfo(timeout)\n }\n else {\n GameWindowManager.currentTickersTimeouts[timeout].tags = t\n }\n }\n GameWindowManager.removeTickersWithoutAssociatedCanvasElement()\n }\n /**\n * Remove all tickers that are not connected to any existing canvas element.\n */\n private static removeTickersWithoutAssociatedCanvasElement() {\n let currentTickers = GameWindowManager._currentTickers\n .map((t) => {\n t.canvasElementTags = t.canvasElementTags.filter((e) => GameWindowManager._children[e])\n return t\n })\n currentTickers.filter((t) => t.canvasElementTags.length === 0).forEach((t) => {\n GameWindowManager.app.ticker.remove(t.fn)\n })\n currentTickers = currentTickers.filter((t) => t.canvasElementTags.length > 0)\n GameWindowManager._currentTickers = currentTickers\n for (let tag in GameWindowManager._currentTickersSteps) {\n if (GameWindowManager._children[tag] === undefined) {\n delete GameWindowManager._currentTickersSteps[tag]\n }\n }\n }\n private static addTickerTimeoutInfo(tags: string | string[], ticker: string, timeout: string) {\n if (typeof tags === \"string\") {\n tags = [tags]\n }\n GameWindowManager.currentTickersTimeouts[timeout] = {\n tags: tags,\n ticker: ticker,\n }\n }\n private static removeTickerTimeoutInfo(timeout: NodeJS.Timeout | string) {\n if (typeof timeout !== \"string\") {\n timeout = timeout.toString()\n }\n if (GameWindowManager.currentTickersTimeouts[timeout]) {\n delete GameWindowManager.currentTickersTimeouts[timeout]\n }\n }\n /**\n * Remove all tickers from the canvas.\n */\n public static removeTickers() {\n GameWindowManager._currentTickersSteps = {}\n GameWindowManager._currentTickers.forEach((t) => {\n GameWindowManager.app.ticker.remove(t.fn)\n })\n GameWindowManager._currentTickers = []\n for (let timeout in GameWindowManager.currentTickersTimeouts) {\n GameWindowManager.removeTickerTimeoutInfo(timeout)\n }\n }\n\n /**\n * Clear the canvas and the tickers.\n */\n static clear() {\n GameWindowManager.removeCanvasElements()\n }\n\n /* Export and Import Methods */\n\n /**\n * Export the canvas and the tickers to a JSON string.\n * @returns The JSON string.\n */\n public static exportJson(): string {\n return JSON.stringify(this.export())\n }\n /**\n * Export the canvas and the tickers to an object.\n * @returns The object.\n */\n public static export(): ExportedCanvas {\n let currentElements: { [tag: string]: ICanvasBaseMemory } = {}\n for (let tag in GameWindowManager._children) {\n currentElements[tag] = exportCanvasElement(GameWindowManager._children[tag])\n }\n return {\n currentTickers: createExportableElement(GameWindowManager._currentTickers),\n currentElements: createExportableElement(currentElements),\n childrenTagsOrder: createExportableElement(GameWindowManager.childrenTagsOrder),\n }\n }\n /**\n * Import the canvas and the tickers from a JSON string.\n * @param dataString The JSON string.\n */\n public static importJson(dataString: string) {\n GameWindowManager.import(JSON.parse(dataString))\n }\n /**\n * Import the canvas and the tickers from an object.\n * @param data The object.\n */\n public static import(data: object) {\n GameWindowManager.clear()\n try {\n if (data.hasOwnProperty(\"childrenTagsOrder\") && data.hasOwnProperty(\"currentElements\")) {\n let currentElements = (data as ExportedCanvas)[\"currentElements\"]\n let childrenTagsOrder = (data as ExportedCanvas)[\"childrenTagsOrder\"]\n childrenTagsOrder.forEach((tag) => {\n if (currentElements[tag]) {\n let element = importCanvasElement(currentElements[tag])\n GameWindowManager.addCanvasElement(tag, element)\n GameWindowManager.childrenTagsOrder.push(tag)\n }\n })\n }\n else {\n console.error(\"[Pixi'VN] The data does not have the properties childrenTagsOrder and currentElements\")\n return\n }\n if (data.hasOwnProperty(\"currentTickers\")) {\n let currentTickers = (data as ExportedCanvas)[\"currentTickers\"]\n currentTickers.forEach((t) => {\n let tags: string[] = t.canvasElementTags\n let ticker = geTickerInstanceByClassName(t.className, t.args, t.duration, t.priority)\n if (ticker) {\n GameWindowManager.addTicker(tags, ticker)\n }\n else {\n console.error(`[Pixi'VN] Ticker ${t.className} not found`)\n }\n })\n }\n }\n catch (e) {\n console.error(\"[Pixi'VN] Error importing data\", e)\n }\n }\n}\n","export function asciiArtLog() {\n console.info(`\n ____ _ _ ___ ___ _ \n | _ \\\\(_)_ _(_| ) \\\\ / / \\\\ | |\n | |_) | \\\\ \\\\/ / |/ \\\\ \\\\ / /| \\\\| |\n | __/| |> <| | \\\\ V / | |\\\\ |\n |_| |_/_/\\\\_\\\\_| \\\\_/ |_| \\\\_|\n `)\n}","import { GameStorageManager } from \"../managers\"\nimport StoredClassModel from \"./StoredClassModel\"\n\n/**\n * CharacterBaseModelProps is an interface that is used to create a character model.\n */\nexport interface CharacterBaseModelProps {\n /**\n * The name of the character.\n */\n name: string\n /**\n * The surname of the character.\n */\n surname?: string\n /**\n * The age of the character.\n */\n age?: number\n /**\n * The icon of the character.\n */\n icon?: string\n /**\n * The color of the character.\n */\n color?: string\n}\n\n/**\n * CharacterBaseModel is a class that is used to create a character model.\n * I suggest you extend this class to create your own character models.\n * You must use the saveCharacter function to save the character in the game.\n * @example\n * ```typescript\n * export const liam = new CharacterBaseModel('liam', {\n * name: 'Liam',\n * surname: 'Smith',\n * age: 25,\n * icon: \"https://pixijs.com/assets/eggHead.png\",\n * color: \"#9e2e12\"\n * });\n * export const alice = new CharacterBaseModel('alice', {\n * name: 'Alice',\n * surname: 'Smith',\n * age: 25,\n * icon: \"https://pixijs.com/assets/eggHead.png\",\n * color: \"#9e2e12\"\n * });\n * saveCharacter([liam, alice]);\n * ```\n */\nexport default class CharacterBaseModel extends StoredClassModel implements CharacterBaseModelProps {\n /**\n * @param id The id of the character.\n * @param props The properties of the character.\n */\n constructor(id: string, props: CharacterBaseModelProps) {\n super(GameStorageManager.keysSystem.CHARACTER_CATEGORY_KEY, id)\n this.defaultName = props.name\n this.defaultSurname = props.surname\n this.defaultAge = props.age\n this._icon = props.icon\n this._color = props.color\n }\n private defaultName: string = \"\"\n /***\n * The name of the character.\n * If you set undefined, it will return the default name.\n */\n get name(): string {\n return this.getStorageProperty<string>(\"name\") || this.defaultName\n }\n set name(value: string | undefined) {\n this.setStorageProperty<string>(\"name\", value)\n }\n private defaultSurname?: string\n /**\n * The surname of the character.\n * If you set undefined, it will return the default surname.\n */\n get surname(): string | undefined {\n return this.getStorageProperty<string>(\"surname\") || this.defaultSurname\n }\n set surname(value: string | undefined) {\n this.setStorageProperty<string>(\"surname\", value)\n }\n private defaultAge?: number | undefined\n /**\n * The age of the character.\n * If you set undefined, it will return the default age.\n */\n get age(): number | undefined {\n return this.getStorageProperty<number>(\"age\") || this.defaultAge\n }\n set age(value: number | undefined) {\n this.setStorageProperty<number>(\"age\", value)\n }\n private _icon?: string\n /**\n * The icon of the character.\n */\n get icon(): string | undefined {\n return this._icon\n }\n private _color?: string | undefined\n /**\n * The color of the character.\n */\n get color(): string | undefined {\n return this._color\n }\n}\n"]}