@drincs/pixi-vn 0.5.2 → 0.5.4

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 (142) hide show
  1. package/dist/classes/CharacterBaseModel.js +110 -112
  2. package/dist/classes/CharacterBaseModel.js.map +1 -1
  3. package/dist/classes/CharacterBaseModel.mjs +110 -112
  4. package/dist/classes/CharacterBaseModel.mjs.map +1 -1
  5. package/dist/classes/ChoiceMenuOption.d.mts +19 -7
  6. package/dist/classes/ChoiceMenuOption.d.ts +19 -7
  7. package/dist/classes/ChoiceMenuOption.js +1386 -7
  8. package/dist/classes/ChoiceMenuOption.js.map +1 -1
  9. package/dist/classes/ChoiceMenuOption.mjs +1386 -7
  10. package/dist/classes/ChoiceMenuOption.mjs.map +1 -1
  11. package/dist/classes/CloseLabel.d.mts +8 -3
  12. package/dist/classes/CloseLabel.d.ts +8 -3
  13. package/dist/classes/CloseLabel.js +44 -2
  14. package/dist/classes/CloseLabel.js.map +1 -1
  15. package/dist/classes/CloseLabel.mjs +41 -2
  16. package/dist/classes/CloseLabel.mjs.map +1 -1
  17. package/dist/classes/Label.d.mts +47 -21
  18. package/dist/classes/Label.d.ts +47 -21
  19. package/dist/classes/Label.js +36 -1
  20. package/dist/classes/Label.js.map +1 -1
  21. package/dist/classes/Label.mjs +36 -1
  22. package/dist/classes/Label.mjs.map +1 -1
  23. package/dist/classes/StoredClassModel.js +55 -57
  24. package/dist/classes/StoredClassModel.js.map +1 -1
  25. package/dist/classes/StoredClassModel.mjs +55 -57
  26. package/dist/classes/StoredClassModel.mjs.map +1 -1
  27. package/dist/classes/index.d.mts +2 -2
  28. package/dist/classes/index.d.ts +2 -2
  29. package/dist/classes/index.js +125 -73
  30. package/dist/classes/index.js.map +1 -1
  31. package/dist/classes/index.mjs +125 -73
  32. package/dist/classes/index.mjs.map +1 -1
  33. package/dist/classes/ticker/TickerFadeAlpha.js +27 -27
  34. package/dist/classes/ticker/TickerFadeAlpha.js.map +1 -1
  35. package/dist/classes/ticker/TickerFadeAlpha.mjs +27 -27
  36. package/dist/classes/ticker/TickerFadeAlpha.mjs.map +1 -1
  37. package/dist/classes/ticker/TickerMove.js +57 -55
  38. package/dist/classes/ticker/TickerMove.js.map +1 -1
  39. package/dist/classes/ticker/TickerMove.mjs +57 -55
  40. package/dist/classes/ticker/TickerMove.mjs.map +1 -1
  41. package/dist/classes/ticker/TickerRotate.js +57 -55
  42. package/dist/classes/ticker/TickerRotate.js.map +1 -1
  43. package/dist/classes/ticker/TickerRotate.mjs +57 -55
  44. package/dist/classes/ticker/TickerRotate.mjs.map +1 -1
  45. package/dist/classes/ticker/index.js +17 -17
  46. package/dist/classes/ticker/index.js.map +1 -1
  47. package/dist/classes/ticker/index.mjs +17 -17
  48. package/dist/classes/ticker/index.mjs.map +1 -1
  49. package/dist/constants.d.mts +1 -1
  50. package/dist/constants.d.ts +1 -1
  51. package/dist/constants.js +1 -1
  52. package/dist/constants.js.map +1 -1
  53. package/dist/constants.mjs +1 -1
  54. package/dist/constants.mjs.map +1 -1
  55. package/dist/decorators/LabelDecorator.d.mts +13 -20
  56. package/dist/decorators/LabelDecorator.d.ts +13 -20
  57. package/dist/decorators/LabelDecorator.js +1388 -28
  58. package/dist/decorators/LabelDecorator.js.map +1 -1
  59. package/dist/decorators/LabelDecorator.mjs +1388 -25
  60. package/dist/decorators/LabelDecorator.mjs.map +1 -1
  61. package/dist/decorators/index.d.mts +4 -4
  62. package/dist/decorators/index.d.ts +4 -4
  63. package/dist/decorators/index.js +1385 -13
  64. package/dist/decorators/index.js.map +1 -1
  65. package/dist/decorators/index.mjs +1384 -13
  66. package/dist/decorators/index.mjs.map +1 -1
  67. package/dist/functions/DialogueUtility.d.mts +7 -7
  68. package/dist/functions/DialogueUtility.d.ts +7 -7
  69. package/dist/functions/DialogueUtility.js +97 -67
  70. package/dist/functions/DialogueUtility.js.map +1 -1
  71. package/dist/functions/DialogueUtility.mjs +97 -67
  72. package/dist/functions/DialogueUtility.mjs.map +1 -1
  73. package/dist/functions/FlagsUtility.js +55 -57
  74. package/dist/functions/FlagsUtility.js.map +1 -1
  75. package/dist/functions/FlagsUtility.mjs +55 -57
  76. package/dist/functions/FlagsUtility.mjs.map +1 -1
  77. package/dist/functions/GameUtility.js +55 -57
  78. package/dist/functions/GameUtility.js.map +1 -1
  79. package/dist/functions/GameUtility.mjs +55 -57
  80. package/dist/functions/GameUtility.mjs.map +1 -1
  81. package/dist/functions/ImageUtility.js +17 -17
  82. package/dist/functions/ImageUtility.js.map +1 -1
  83. package/dist/functions/ImageUtility.mjs +17 -17
  84. package/dist/functions/ImageUtility.mjs.map +1 -1
  85. package/dist/functions/SavesUtility.d.mts +2 -2
  86. package/dist/functions/SavesUtility.d.ts +2 -2
  87. package/dist/functions/SavesUtility.js +115 -143
  88. package/dist/functions/SavesUtility.js.map +1 -1
  89. package/dist/functions/SavesUtility.mjs +115 -143
  90. package/dist/functions/SavesUtility.mjs.map +1 -1
  91. package/dist/functions/StepLabelUtility.d.mts +0 -1
  92. package/dist/functions/StepLabelUtility.d.ts +0 -1
  93. package/dist/functions/index.d.mts +4 -4
  94. package/dist/functions/index.d.ts +4 -4
  95. package/dist/functions/index.js +98 -68
  96. package/dist/functions/index.js.map +1 -1
  97. package/dist/functions/index.mjs +98 -68
  98. package/dist/functions/index.mjs.map +1 -1
  99. package/dist/index.d.mts +3 -3
  100. package/dist/index.d.ts +3 -3
  101. package/dist/index.js +361 -327
  102. package/dist/index.js.map +1 -1
  103. package/dist/index.mjs +360 -327
  104. package/dist/index.mjs.map +1 -1
  105. package/dist/interface/{IDialogueHistory.d.mts → DialogueHistory.d.mts} +5 -5
  106. package/dist/interface/{IDialogueHistory.d.ts → DialogueHistory.d.ts} +5 -5
  107. package/dist/interface/{IDialogueHistory.js → DialogueHistory.js} +1 -1
  108. package/dist/interface/DialogueHistory.mjs +3 -0
  109. package/dist/interface/IHistoryStep.d.mts +2 -2
  110. package/dist/interface/IHistoryStep.d.ts +2 -2
  111. package/dist/interface/ISaveData.d.mts +2 -2
  112. package/dist/interface/ISaveData.d.ts +2 -2
  113. package/dist/interface/export/ExportedStep.d.mts +2 -2
  114. package/dist/interface/export/ExportedStep.d.ts +2 -2
  115. package/dist/interface/export/index.d.mts +2 -2
  116. package/dist/interface/export/index.d.ts +2 -2
  117. package/dist/interface/index.d.mts +6 -6
  118. package/dist/interface/index.d.ts +6 -6
  119. package/dist/managers/StepManager.d.mts +12 -12
  120. package/dist/managers/StepManager.d.ts +12 -12
  121. package/dist/managers/StepManager.js +55 -81
  122. package/dist/managers/StepManager.js.map +1 -1
  123. package/dist/managers/StepManager.mjs +55 -81
  124. package/dist/managers/StepManager.mjs.map +1 -1
  125. package/dist/managers/WindowManager.d.mts +1 -1
  126. package/dist/managers/WindowManager.d.ts +1 -1
  127. package/dist/managers/index.d.mts +2 -2
  128. package/dist/managers/index.d.ts +2 -2
  129. package/dist/managers/index.js +114 -142
  130. package/dist/managers/index.js.map +1 -1
  131. package/dist/managers/index.mjs +114 -142
  132. package/dist/managers/index.mjs.map +1 -1
  133. package/dist/types/ChoiceMenuOptionsType.d.mts +3 -3
  134. package/dist/types/ChoiceMenuOptionsType.d.ts +3 -3
  135. package/dist/types/StepLabelType.d.mts +2 -3
  136. package/dist/types/StepLabelType.d.ts +2 -3
  137. package/dist/types/index.d.mts +1 -1
  138. package/dist/types/index.d.ts +1 -1
  139. package/package.json +2 -2
  140. package/dist/interface/IDialogueHistory.mjs +0 -3
  141. /package/dist/interface/{IDialogueHistory.js.map → DialogueHistory.js.map} +0 -0
  142. /package/dist/interface/{IDialogueHistory.mjs.map → DialogueHistory.mjs.map} +0 -0
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/functions/StepLabelUtility.ts","../../src/classes/Label.ts","../../src/classes/CloseLabel.ts"],"names":[],"mappings":";AAAA,OAAO,UAAU;AAmBV,SAAS,oBAAoB,OAAiD,OAA0D;AAC3I,SAAO,UAAU;AACrB;;;ACSA,IAAqB,QAArB,MAA6D;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMzD,IAAW,QAA4B;AAAE,UAAM,IAAI,MAAM,qDAAqD;AAAA,EAAE;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMzG,4BAA4B,eAAgE;AAC/F,QAAI,cAAc,WAAW,GAAG;AAC5B,aAAO;AAAA,IACX;AACA,QAAI,MAAc;AAClB,kBAAc,QAAQ,CAAC,MAAM,UAAU;AACnC,UAAI,oBAAoB,MAAM,KAAK,MAAM,KAAK,CAAC,GAAG;AAC9C,cAAM;AAAA,MACV;AAAA,IACJ,CAAC;AACD,WAAO;AAAA,EACX;AAEJ;;;ACrDA,IAAqB,aAArB,cAAwC,MAAM;AAAE","sourcesContent":["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 { StorageObjectType } from \"../types\"\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 * You must use the labelDecorator to register the label in the game.\n * For Ren'py this is the equivalent of a label.\n * @example\n * ```typescript\n * \\@labelDecorator() // this is equivalent to labelDecorator(\"StartLabel\")\n * export class StartLabel extends Label {\n * override get steps(): StepLabelType[] {\n * return [\n * () => {\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 * () => GameStepManager.jumpLabel(StartLabel),\n * ]\n * }\n * }\n * GameStepManager.callLabel(StartLabel)\n * ```\n */\nexport default class Label<T extends StorageObjectType = {}> {\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>[] { throw new Error(\"[Pixi'VN] The method Label.steps must be overridden\") }\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 choiseIndex?: number\n}\n","import Label from \"./Label\"\n\nexport default class CloseLabel extends Label { }\n"]}
1
+ {"version":3,"sources":["../../src/functions/StepLabelUtility.ts","../../src/classes/Label.ts","../../src/classes/CloseLabel.ts"],"names":[],"mappings":";AAAA,OAAO,UAAU;AAmBV,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;AACX,SAAK,SAAS;AACd,SAAK,aAAa;AAClB,SAAK,eAAe;AAAA,EACxB;AAAA;AAAA;AAAA;AAAA,EAMA,IAAW,KAAkB;AACzB,WAAO,KAAK;AAAA,EAChB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,IAAW,QAA4B;AACnC,WAAO,KAAK;AAAA,EAChB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOO,4BAA4B,eAAgE;AAC/F,QAAI,cAAc,WAAW,GAAG;AAC5B,aAAO;AAAA,IACX;AACA,QAAI,MAAc;AAClB,kBAAc,QAAQ,CAAC,MAAM,UAAU;AACnC,UAAI,oBAAoB,MAAM,KAAK,MAAM,KAAK,CAAC,GAAG;AAC9C,cAAM;AAAA,MACV;AAAA,IACJ,CAAC;AACD,WAAO;AAAA,EACX;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAcA,IAAW,YAAsD;AAC7D,WAAO,KAAK;AAAA,EAChB;AAAA,EAGA,IAAW,cAAkC;AACzC,WAAO,KAAK;AAAA,EAChB;AACJ;;;ACjGO,IAAM,iBAAiB;AAK9B,IAAqB,aAArB,cAAwC,MAAM;AAAA,EAC1C,YAAY,aAAsB;AAC9B,UAAM,gBAAgB,CAAC,GAAG,QAAW,WAAW;AAAA,EACpD;AACJ","sourcesContent":["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 class CloseLabel extends Label {\n constructor(choiseIndex?: number) {\n super(CLOSE_LABEL_ID, [], undefined, choiseIndex)\n }\n}\n"]}
@@ -1,34 +1,46 @@
1
- import { StepLabelType } from '../types/StepLabelType.mjs';
2
- import { StorageObjectType } from '../types/StorageElementType.mjs';
1
+ import { LabelIdType } from '../types/LabelIdType.mjs';
3
2
  import { StepHistoryDataType } from '../types/StepHistoryDataType.mjs';
3
+ import { StepLabelType } from '../types/StepLabelType.mjs';
4
4
  import '@drincs/pixi-vn/dist/override';
5
5
 
6
6
  /**
7
7
  * Label is a class that contains a list of steps, which will be performed as the game continues.
8
- * You must use the labelDecorator to register the label in the game.
9
8
  * For Ren'py this is the equivalent of a label.
10
9
  * @example
11
10
  * ```typescript
12
- * \@labelDecorator() // this is equivalent to labelDecorator("StartLabel")
13
- * export class StartLabel extends Label {
14
- * override get steps(): StepLabelType[] {
15
- * return [
16
- * () => {
17
- * GameWindowManager.clear()
18
- * setDialogue({ character: liam, text: "Which test do you want to perform?" })
19
- * setChoiceMenuOptions([
20
- * new ChoiceMenuOption("Events Test", EventsTestLabel),
21
- * new ChoiceMenuOption("Show Image Test", ShowImageTest),
22
- * ])
23
- * },
24
- * () => GameStepManager.jumpLabel(StartLabel),
25
- * ]
26
- * }
27
- * }
11
+ * const START_LABEL_ID = "StartLabel"
12
+ *
13
+ * export const startLabel = newLabel(START_LABEL_ID,
14
+ * [
15
+ * (props) => {
16
+ * GameWindowManager.clear()
17
+ * setDialogue({ character: liam, text: "Which test do you want to perform?" })
18
+ * setChoiceMenuOptions([
19
+ * new ChoiceMenuOption("Events Test", eventsTestLabel),
20
+ * new ChoiceMenuOption("Show Image Test", showImageTest),
21
+ * ])
22
+ * },
23
+ * (props) => GameStepManager.jumpLabel(START_LABEL_ID, props),
24
+ * ]
25
+ * )
26
+ *
28
27
  * GameStepManager.callLabel(StartLabel)
29
28
  * ```
30
29
  */
31
- declare class Label<T extends StorageObjectType = {}> {
30
+ declare class Label<T extends {} = {}> {
31
+ /**
32
+ * @param id is the id of the label
33
+ * @param steps is the list of steps that the label will perform
34
+ * @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
35
+ * @param choiseIndex is the index of the choice that the label will perform
36
+ */
37
+ constructor(id: LabelIdType, steps: StepLabelType<T>[], onStepRun?: () => void | Promise<void>, choiseIndex?: number);
38
+ private _id;
39
+ /**
40
+ * Get the id of the label
41
+ */
42
+ get id(): LabelIdType;
43
+ private _steps;
32
44
  /**
33
45
  * Get the steps of the label.
34
46
  * This class should be extended and the steps method should be overridden.
@@ -41,7 +53,21 @@ declare class Label<T extends StorageObjectType = {}> {
41
53
  * @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
42
54
  */
43
55
  getCorrespondingStepsNumber(externalSteps: StepHistoryDataType[] | StepLabelType[]): number;
44
- choiseIndex?: number;
56
+ private _onStepRun;
57
+ /**
58
+ * 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
59
+ * @returns Promise<void> or void
60
+ * @example
61
+ * ```typescript
62
+ * newLabel("id", [], () => {
63
+ * Assets.load('path/to/image1.png')
64
+ * Assets.load('path/to/image2.png')
65
+ * })
66
+ * ```
67
+ */
68
+ get onStepRun(): (() => void | Promise<void>) | undefined;
69
+ private _choiseIndex;
70
+ get choiseIndex(): number | undefined;
45
71
  }
46
72
 
47
73
  export { Label as default };
@@ -1,34 +1,46 @@
1
- import { StepLabelType } from '../types/StepLabelType.js';
2
- import { StorageObjectType } from '../types/StorageElementType.js';
1
+ import { LabelIdType } from '../types/LabelIdType.js';
3
2
  import { StepHistoryDataType } from '../types/StepHistoryDataType.js';
3
+ import { StepLabelType } from '../types/StepLabelType.js';
4
4
  import '@drincs/pixi-vn/dist/override';
5
5
 
6
6
  /**
7
7
  * Label is a class that contains a list of steps, which will be performed as the game continues.
8
- * You must use the labelDecorator to register the label in the game.
9
8
  * For Ren'py this is the equivalent of a label.
10
9
  * @example
11
10
  * ```typescript
12
- * \@labelDecorator() // this is equivalent to labelDecorator("StartLabel")
13
- * export class StartLabel extends Label {
14
- * override get steps(): StepLabelType[] {
15
- * return [
16
- * () => {
17
- * GameWindowManager.clear()
18
- * setDialogue({ character: liam, text: "Which test do you want to perform?" })
19
- * setChoiceMenuOptions([
20
- * new ChoiceMenuOption("Events Test", EventsTestLabel),
21
- * new ChoiceMenuOption("Show Image Test", ShowImageTest),
22
- * ])
23
- * },
24
- * () => GameStepManager.jumpLabel(StartLabel),
25
- * ]
26
- * }
27
- * }
11
+ * const START_LABEL_ID = "StartLabel"
12
+ *
13
+ * export const startLabel = newLabel(START_LABEL_ID,
14
+ * [
15
+ * (props) => {
16
+ * GameWindowManager.clear()
17
+ * setDialogue({ character: liam, text: "Which test do you want to perform?" })
18
+ * setChoiceMenuOptions([
19
+ * new ChoiceMenuOption("Events Test", eventsTestLabel),
20
+ * new ChoiceMenuOption("Show Image Test", showImageTest),
21
+ * ])
22
+ * },
23
+ * (props) => GameStepManager.jumpLabel(START_LABEL_ID, props),
24
+ * ]
25
+ * )
26
+ *
28
27
  * GameStepManager.callLabel(StartLabel)
29
28
  * ```
30
29
  */
31
- declare class Label<T extends StorageObjectType = {}> {
30
+ declare class Label<T extends {} = {}> {
31
+ /**
32
+ * @param id is the id of the label
33
+ * @param steps is the list of steps that the label will perform
34
+ * @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
35
+ * @param choiseIndex is the index of the choice that the label will perform
36
+ */
37
+ constructor(id: LabelIdType, steps: StepLabelType<T>[], onStepRun?: () => void | Promise<void>, choiseIndex?: number);
38
+ private _id;
39
+ /**
40
+ * Get the id of the label
41
+ */
42
+ get id(): LabelIdType;
43
+ private _steps;
32
44
  /**
33
45
  * Get the steps of the label.
34
46
  * This class should be extended and the steps method should be overridden.
@@ -41,7 +53,21 @@ declare class Label<T extends StorageObjectType = {}> {
41
53
  * @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
42
54
  */
43
55
  getCorrespondingStepsNumber(externalSteps: StepHistoryDataType[] | StepLabelType[]): number;
44
- choiseIndex?: number;
56
+ private _onStepRun;
57
+ /**
58
+ * 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
59
+ * @returns Promise<void> or void
60
+ * @example
61
+ * ```typescript
62
+ * newLabel("id", [], () => {
63
+ * Assets.load('path/to/image1.png')
64
+ * Assets.load('path/to/image2.png')
65
+ * })
66
+ * ```
67
+ */
68
+ get onStepRun(): (() => void | Promise<void>) | undefined;
69
+ private _choiseIndex;
70
+ get choiseIndex(): number | undefined;
45
71
  }
46
72
 
47
73
  export { Label as default };
@@ -9,13 +9,31 @@ function checkIfStepsIsEqual(step1, step2) {
9
9
 
10
10
  // src/classes/Label.ts
11
11
  var Label = class {
12
+ /**
13
+ * @param id is the id of the label
14
+ * @param steps is the list of steps that the label will perform
15
+ * @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
16
+ * @param choiseIndex is the index of the choice that the label will perform
17
+ */
18
+ constructor(id, steps, onStepRun, choiseIndex) {
19
+ this._id = id;
20
+ this._steps = steps;
21
+ this._onStepRun = onStepRun;
22
+ this._choiseIndex = choiseIndex;
23
+ }
24
+ /**
25
+ * Get the id of the label
26
+ */
27
+ get id() {
28
+ return this._id;
29
+ }
12
30
  /**
13
31
  * Get the steps of the label.
14
32
  * This class should be extended and the steps method should be overridden.
15
33
  * Every time you update this list will also be updated when the other game versions load.
16
34
  */
17
35
  get steps() {
18
- throw new Error("[Pixi'VN] The method Label.steps must be overridden");
36
+ return this._steps;
19
37
  }
20
38
  /**
21
39
  * Get the corresponding steps number
@@ -34,6 +52,23 @@ var Label = class {
34
52
  });
35
53
  return res;
36
54
  }
55
+ /**
56
+ * 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
57
+ * @returns Promise<void> or void
58
+ * @example
59
+ * ```typescript
60
+ * newLabel("id", [], () => {
61
+ * Assets.load('path/to/image1.png')
62
+ * Assets.load('path/to/image2.png')
63
+ * })
64
+ * ```
65
+ */
66
+ get onStepRun() {
67
+ return this._onStepRun;
68
+ }
69
+ get choiseIndex() {
70
+ return this._choiseIndex;
71
+ }
37
72
  };
38
73
 
39
74
  module.exports = Label;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/functions/StepLabelUtility.ts","../../src/classes/Label.ts"],"names":[],"mappings":";AAAA,OAAO,UAAU;AAmBV,SAAS,oBAAoB,OAAiD,OAA0D;AAC3I,SAAO,UAAU;AACrB;;;ACSA,IAAqB,QAArB,MAA6D;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMzD,IAAW,QAA4B;AAAE,UAAM,IAAI,MAAM,qDAAqD;AAAA,EAAE;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMzG,4BAA4B,eAAgE;AAC/F,QAAI,cAAc,WAAW,GAAG;AAC5B,aAAO;AAAA,IACX;AACA,QAAI,MAAc;AAClB,kBAAc,QAAQ,CAAC,MAAM,UAAU;AACnC,UAAI,oBAAoB,MAAM,KAAK,MAAM,KAAK,CAAC,GAAG;AAC9C,cAAM;AAAA,MACV;AAAA,IACJ,CAAC;AACD,WAAO;AAAA,EACX;AAEJ","sourcesContent":["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 { StorageObjectType } from \"../types\"\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 * You must use the labelDecorator to register the label in the game.\n * For Ren'py this is the equivalent of a label.\n * @example\n * ```typescript\n * \\@labelDecorator() // this is equivalent to labelDecorator(\"StartLabel\")\n * export class StartLabel extends Label {\n * override get steps(): StepLabelType[] {\n * return [\n * () => {\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 * () => GameStepManager.jumpLabel(StartLabel),\n * ]\n * }\n * }\n * GameStepManager.callLabel(StartLabel)\n * ```\n */\nexport default class Label<T extends StorageObjectType = {}> {\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>[] { throw new Error(\"[Pixi'VN] The method Label.steps must be overridden\") }\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 choiseIndex?: number\n}\n"]}
1
+ {"version":3,"sources":["../../src/functions/StepLabelUtility.ts","../../src/classes/Label.ts"],"names":[],"mappings":";AAAA,OAAO,UAAU;AAmBV,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;AACX,SAAK,SAAS;AACd,SAAK,aAAa;AAClB,SAAK,eAAe;AAAA,EACxB;AAAA;AAAA;AAAA;AAAA,EAMA,IAAW,KAAkB;AACzB,WAAO,KAAK;AAAA,EAChB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,IAAW,QAA4B;AACnC,WAAO,KAAK;AAAA,EAChB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOO,4BAA4B,eAAgE;AAC/F,QAAI,cAAc,WAAW,GAAG;AAC5B,aAAO;AAAA,IACX;AACA,QAAI,MAAc;AAClB,kBAAc,QAAQ,CAAC,MAAM,UAAU;AACnC,UAAI,oBAAoB,MAAM,KAAK,MAAM,KAAK,CAAC,GAAG;AAC9C,cAAM;AAAA,MACV;AAAA,IACJ,CAAC;AACD,WAAO;AAAA,EACX;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAcA,IAAW,YAAsD;AAC7D,WAAO,KAAK;AAAA,EAChB;AAAA,EAGA,IAAW,cAAkC;AACzC,WAAO,KAAK;AAAA,EAChB;AACJ","sourcesContent":["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"]}
@@ -7,13 +7,31 @@ function checkIfStepsIsEqual(step1, step2) {
7
7
 
8
8
  // src/classes/Label.ts
9
9
  var Label = class {
10
+ /**
11
+ * @param id is the id of the label
12
+ * @param steps is the list of steps that the label will perform
13
+ * @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
14
+ * @param choiseIndex is the index of the choice that the label will perform
15
+ */
16
+ constructor(id, steps, onStepRun, choiseIndex) {
17
+ this._id = id;
18
+ this._steps = steps;
19
+ this._onStepRun = onStepRun;
20
+ this._choiseIndex = choiseIndex;
21
+ }
22
+ /**
23
+ * Get the id of the label
24
+ */
25
+ get id() {
26
+ return this._id;
27
+ }
10
28
  /**
11
29
  * Get the steps of the label.
12
30
  * This class should be extended and the steps method should be overridden.
13
31
  * Every time you update this list will also be updated when the other game versions load.
14
32
  */
15
33
  get steps() {
16
- throw new Error("[Pixi'VN] The method Label.steps must be overridden");
34
+ return this._steps;
17
35
  }
18
36
  /**
19
37
  * Get the corresponding steps number
@@ -32,6 +50,23 @@ var Label = class {
32
50
  });
33
51
  return res;
34
52
  }
53
+ /**
54
+ * 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
55
+ * @returns Promise<void> or void
56
+ * @example
57
+ * ```typescript
58
+ * newLabel("id", [], () => {
59
+ * Assets.load('path/to/image1.png')
60
+ * Assets.load('path/to/image2.png')
61
+ * })
62
+ * ```
63
+ */
64
+ get onStepRun() {
65
+ return this._onStepRun;
66
+ }
67
+ get choiseIndex() {
68
+ return this._choiseIndex;
69
+ }
35
70
  };
36
71
 
37
72
  export { Label as default };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/functions/StepLabelUtility.ts","../../src/classes/Label.ts"],"names":[],"mappings":";AAAA,OAAO,UAAU;AAmBV,SAAS,oBAAoB,OAAiD,OAA0D;AAC3I,SAAO,UAAU;AACrB;;;ACSA,IAAqB,QAArB,MAA6D;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMzD,IAAW,QAA4B;AAAE,UAAM,IAAI,MAAM,qDAAqD;AAAA,EAAE;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMzG,4BAA4B,eAAgE;AAC/F,QAAI,cAAc,WAAW,GAAG;AAC5B,aAAO;AAAA,IACX;AACA,QAAI,MAAc;AAClB,kBAAc,QAAQ,CAAC,MAAM,UAAU;AACnC,UAAI,oBAAoB,MAAM,KAAK,MAAM,KAAK,CAAC,GAAG;AAC9C,cAAM;AAAA,MACV;AAAA,IACJ,CAAC;AACD,WAAO;AAAA,EACX;AAEJ","sourcesContent":["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 { StorageObjectType } from \"../types\"\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 * You must use the labelDecorator to register the label in the game.\n * For Ren'py this is the equivalent of a label.\n * @example\n * ```typescript\n * \\@labelDecorator() // this is equivalent to labelDecorator(\"StartLabel\")\n * export class StartLabel extends Label {\n * override get steps(): StepLabelType[] {\n * return [\n * () => {\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 * () => GameStepManager.jumpLabel(StartLabel),\n * ]\n * }\n * }\n * GameStepManager.callLabel(StartLabel)\n * ```\n */\nexport default class Label<T extends StorageObjectType = {}> {\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>[] { throw new Error(\"[Pixi'VN] The method Label.steps must be overridden\") }\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 choiseIndex?: number\n}\n"]}
1
+ {"version":3,"sources":["../../src/functions/StepLabelUtility.ts","../../src/classes/Label.ts"],"names":[],"mappings":";AAAA,OAAO,UAAU;AAmBV,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;AACX,SAAK,SAAS;AACd,SAAK,aAAa;AAClB,SAAK,eAAe;AAAA,EACxB;AAAA;AAAA;AAAA;AAAA,EAMA,IAAW,KAAkB;AACzB,WAAO,KAAK;AAAA,EAChB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,IAAW,QAA4B;AACnC,WAAO,KAAK;AAAA,EAChB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOO,4BAA4B,eAAgE;AAC/F,QAAI,cAAc,WAAW,GAAG;AAC5B,aAAO;AAAA,IACX;AACA,QAAI,MAAc;AAClB,kBAAc,QAAQ,CAAC,MAAM,UAAU;AACnC,UAAI,oBAAoB,MAAM,KAAK,MAAM,KAAK,CAAC,GAAG;AAC9C,cAAM;AAAA,MACV;AAAA,IACJ,CAAC;AACD,WAAO;AAAA,EACX;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAcA,IAAW,YAAsD;AAC7D,WAAO,KAAK;AAAA,EAChB;AAAA,EAGA,IAAW,cAAkC;AACzC,WAAO,KAAK;AAAA,EAChB;AACJ","sourcesContent":["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"]}
@@ -54,40 +54,6 @@ var __async = (__this, __arguments, generator) => {
54
54
  });
55
55
  };
56
56
 
57
- // src/types/PauseType.ts
58
- var PauseValueType = "pause";
59
-
60
- // src/types/RepeatType.ts
61
- var Repeat = "repeat";
62
-
63
- // src/decorators/CanvasElementDecorator.ts
64
- var registeredCanvasElement = {};
65
- function getCanvasElementInstanceByClassName(canvasName) {
66
- try {
67
- let eventType = registeredCanvasElement[canvasName];
68
- if (!eventType) {
69
- if (canvasName === "CanvasContainer") {
70
- eventType = CanvasContainer;
71
- } else if (canvasName === "CanvasImage") {
72
- eventType = CanvasImage;
73
- } else if (canvasName === "CanvasSprite") {
74
- eventType = CanvasSprite;
75
- } else if (canvasName === "CanvasText") {
76
- eventType = CanvasText;
77
- }
78
- }
79
- if (!eventType) {
80
- console.error(`[Pixi'VN] CanvasElement ${canvasName} not found`);
81
- return;
82
- }
83
- let canvasElement = new eventType();
84
- return canvasElement;
85
- } catch (e) {
86
- console.error(`[Pixi'VN] Error while getting CanvasElement ${canvasName}`, e);
87
- return;
88
- }
89
- }
90
-
91
57
  // src/functions/CanvasUtility.ts
92
58
  function getTextureMemory(texture) {
93
59
  let sourceTexture = texture.source;
@@ -523,29 +489,33 @@ function setMemoryText(element, memory) {
523
489
  }
524
490
  }
525
491
 
526
- // src/classes/ticker/TickerBase.ts
527
- var TickerBase = class {
528
- /**
529
- * @param args The arguments that you want to pass to the ticker.
530
- * @param duration The duration of the ticker. If is undefined, the ticker will be called every frame.
531
- * @param priority The priority of the ticker. If is undefined, the priority will be UPDATE_PRIORITY.NORMAL.
532
- */
533
- constructor(args, duration, priority) {
534
- this.args = args;
535
- this.duration = duration;
536
- this.priority = priority;
537
- }
538
- /**
539
- * The method that will be called every frame.
540
- * This method should be overridden and you can use GameWindowManager.addCanvasElement() to get the canvas element of the canvas, and edit them.
541
- * @param t The ticker that is calling this method
542
- * @param args The arguments that you passed when you added the ticker
543
- * @param tags The tags of the canvas elements that are connected to this ticker
544
- */
545
- fn(_t, _args, _tags) {
546
- throw new Error("[Pixi'VN] The method TickerBase.fn() must be overridden");
492
+ // src/decorators/CanvasElementDecorator.ts
493
+ var registeredCanvasElement = {};
494
+ function getCanvasElementInstanceByClassName(canvasName) {
495
+ try {
496
+ let eventType = registeredCanvasElement[canvasName];
497
+ if (!eventType) {
498
+ if (canvasName === "CanvasContainer") {
499
+ eventType = CanvasContainer;
500
+ } else if (canvasName === "CanvasImage") {
501
+ eventType = CanvasImage;
502
+ } else if (canvasName === "CanvasSprite") {
503
+ eventType = CanvasSprite;
504
+ } else if (canvasName === "CanvasText") {
505
+ eventType = CanvasText;
506
+ }
507
+ }
508
+ if (!eventType) {
509
+ console.error(`[Pixi'VN] CanvasElement ${canvasName} not found`);
510
+ return;
511
+ }
512
+ let canvasElement = new eventType();
513
+ return canvasElement;
514
+ } catch (e) {
515
+ console.error(`[Pixi'VN] Error while getting CanvasElement ${canvasName}`, e);
516
+ return;
547
517
  }
548
- };
518
+ }
549
519
 
550
520
  // src/decorators/TickerDecorator.ts
551
521
  var registeredTickers = {};
@@ -574,7 +544,35 @@ function geTickerInstanceByClassName(tickerName, args, duration, priority) {
574
544
  }
575
545
  }
576
546
 
577
- // src/classes/ticker/TickerFadeAlpha.ts
547
+ // src/types/PauseType.ts
548
+ var PauseValueType = "pause";
549
+
550
+ // src/types/RepeatType.ts
551
+ var Repeat = "repeat";
552
+
553
+ // src/classes/ticker/TickerBase.ts
554
+ var TickerBase = class {
555
+ /**
556
+ * @param args The arguments that you want to pass to the ticker.
557
+ * @param duration The duration of the ticker. If is undefined, the ticker will be called every frame.
558
+ * @param priority The priority of the ticker. If is undefined, the priority will be UPDATE_PRIORITY.NORMAL.
559
+ */
560
+ constructor(args, duration, priority) {
561
+ this.args = args;
562
+ this.duration = duration;
563
+ this.priority = priority;
564
+ }
565
+ /**
566
+ * The method that will be called every frame.
567
+ * This method should be overridden and you can use GameWindowManager.addCanvasElement() to get the canvas element of the canvas, and edit them.
568
+ * @param t The ticker that is calling this method
569
+ * @param args The arguments that you passed when you added the ticker
570
+ * @param tags The tags of the canvas elements that are connected to this ticker
571
+ */
572
+ fn(_t, _args, _tags) {
573
+ throw new Error("[Pixi'VN] The method TickerBase.fn() must be overridden");
574
+ }
575
+ };
578
576
  var TickerFadeAlpha = class extends TickerBase {
579
577
  /**
580
578
  * The method that will be called every frame to fade the alpha of the canvas element of the canvas.