@drincs/pixi-vn 0.6.3 → 0.6.5

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 (238) hide show
  1. package/README.md +8 -5
  2. package/dist/LabelProps-CFV-zRjG.d.ts +113 -0
  3. package/dist/LabelProps-CmRpvUJm.d.mts +113 -0
  4. package/dist/classes/CharacterBaseModel.js +42 -33
  5. package/dist/classes/CharacterBaseModel.js.map +1 -1
  6. package/dist/classes/CharacterBaseModel.mjs +42 -33
  7. package/dist/classes/CharacterBaseModel.mjs.map +1 -1
  8. package/dist/classes/ChoiceMenuOption.d.mts +68 -8
  9. package/dist/classes/ChoiceMenuOption.d.ts +68 -8
  10. package/dist/classes/ChoiceMenuOption.js +119 -53
  11. package/dist/classes/ChoiceMenuOption.js.map +1 -1
  12. package/dist/classes/ChoiceMenuOption.mjs +119 -53
  13. package/dist/classes/ChoiceMenuOption.mjs.map +1 -1
  14. package/dist/classes/CloseLabel.d.mts +2 -2
  15. package/dist/classes/CloseLabel.d.ts +2 -2
  16. package/dist/classes/CloseLabel.js +53 -17
  17. package/dist/classes/CloseLabel.js.map +1 -1
  18. package/dist/classes/CloseLabel.mjs +53 -17
  19. package/dist/classes/CloseLabel.mjs.map +1 -1
  20. package/dist/classes/Label.d.mts +4 -72
  21. package/dist/classes/Label.d.ts +4 -72
  22. package/dist/classes/Label.js +50 -16
  23. package/dist/classes/Label.js.map +1 -1
  24. package/dist/classes/Label.mjs +50 -16
  25. package/dist/classes/Label.mjs.map +1 -1
  26. package/dist/classes/StoredClassModel.js +42 -33
  27. package/dist/classes/StoredClassModel.js.map +1 -1
  28. package/dist/classes/StoredClassModel.mjs +42 -33
  29. package/dist/classes/StoredClassModel.mjs.map +1 -1
  30. package/dist/classes/canvas/CanvasContainer.js +2 -2
  31. package/dist/classes/canvas/CanvasContainer.js.map +1 -1
  32. package/dist/classes/canvas/CanvasContainer.mjs +2 -2
  33. package/dist/classes/canvas/CanvasContainer.mjs.map +1 -1
  34. package/dist/classes/canvas/CanvasImage.js +2 -2
  35. package/dist/classes/canvas/CanvasImage.js.map +1 -1
  36. package/dist/classes/canvas/CanvasImage.mjs +2 -2
  37. package/dist/classes/canvas/CanvasImage.mjs.map +1 -1
  38. package/dist/classes/canvas/CanvasSprite.js +2 -2
  39. package/dist/classes/canvas/CanvasSprite.js.map +1 -1
  40. package/dist/classes/canvas/CanvasSprite.mjs +2 -2
  41. package/dist/classes/canvas/CanvasSprite.mjs.map +1 -1
  42. package/dist/classes/canvas/CanvasText.js +2 -2
  43. package/dist/classes/canvas/CanvasText.js.map +1 -1
  44. package/dist/classes/canvas/CanvasText.mjs +2 -2
  45. package/dist/classes/canvas/CanvasText.mjs.map +1 -1
  46. package/dist/classes/canvas/index.js +2 -2
  47. package/dist/classes/canvas/index.js.map +1 -1
  48. package/dist/classes/canvas/index.mjs +2 -2
  49. package/dist/classes/canvas/index.mjs.map +1 -1
  50. package/dist/classes/index.d.mts +2 -2
  51. package/dist/classes/index.d.ts +2 -2
  52. package/dist/classes/index.js +119 -53
  53. package/dist/classes/index.js.map +1 -1
  54. package/dist/classes/index.mjs +119 -53
  55. package/dist/classes/index.mjs.map +1 -1
  56. package/dist/classes/ticker/FadeAlphaTicker.js +42 -33
  57. package/dist/classes/ticker/FadeAlphaTicker.js.map +1 -1
  58. package/dist/classes/ticker/FadeAlphaTicker.mjs +42 -33
  59. package/dist/classes/ticker/FadeAlphaTicker.mjs.map +1 -1
  60. package/dist/classes/ticker/MoveTicker.d.mts +1 -0
  61. package/dist/classes/ticker/MoveTicker.d.ts +1 -0
  62. package/dist/classes/ticker/MoveTicker.js +42 -33
  63. package/dist/classes/ticker/MoveTicker.js.map +1 -1
  64. package/dist/classes/ticker/MoveTicker.mjs +42 -33
  65. package/dist/classes/ticker/MoveTicker.mjs.map +1 -1
  66. package/dist/classes/ticker/RotateTicker.d.mts +1 -0
  67. package/dist/classes/ticker/RotateTicker.d.ts +1 -0
  68. package/dist/classes/ticker/RotateTicker.js +42 -33
  69. package/dist/classes/ticker/RotateTicker.js.map +1 -1
  70. package/dist/classes/ticker/RotateTicker.mjs +42 -33
  71. package/dist/classes/ticker/RotateTicker.mjs.map +1 -1
  72. package/dist/classes/ticker/ZoomTicker.d.mts +1 -0
  73. package/dist/classes/ticker/ZoomTicker.d.ts +1 -0
  74. package/dist/classes/ticker/ZoomTicker.js +42 -33
  75. package/dist/classes/ticker/ZoomTicker.js.map +1 -1
  76. package/dist/classes/ticker/ZoomTicker.mjs +42 -33
  77. package/dist/classes/ticker/ZoomTicker.mjs.map +1 -1
  78. package/dist/classes/ticker/index.js +42 -33
  79. package/dist/classes/ticker/index.js.map +1 -1
  80. package/dist/classes/ticker/index.mjs +42 -33
  81. package/dist/classes/ticker/index.mjs.map +1 -1
  82. package/dist/constants.d.mts +1 -1
  83. package/dist/constants.d.ts +1 -1
  84. package/dist/constants.js +1 -1
  85. package/dist/constants.js.map +1 -1
  86. package/dist/constants.mjs +1 -1
  87. package/dist/constants.mjs.map +1 -1
  88. package/dist/decorators/CanvasElementDecorator.js +2 -2
  89. package/dist/decorators/CanvasElementDecorator.js.map +1 -1
  90. package/dist/decorators/CanvasElementDecorator.mjs +2 -2
  91. package/dist/decorators/CanvasElementDecorator.mjs.map +1 -1
  92. package/dist/decorators/LabelDecorator.d.mts +3 -3
  93. package/dist/decorators/LabelDecorator.d.ts +3 -3
  94. package/dist/decorators/LabelDecorator.js +74 -50
  95. package/dist/decorators/LabelDecorator.js.map +1 -1
  96. package/dist/decorators/LabelDecorator.mjs +74 -50
  97. package/dist/decorators/LabelDecorator.mjs.map +1 -1
  98. package/dist/decorators/index.d.mts +2 -2
  99. package/dist/decorators/index.d.ts +2 -2
  100. package/dist/decorators/index.js +74 -50
  101. package/dist/decorators/index.js.map +1 -1
  102. package/dist/decorators/index.mjs +74 -50
  103. package/dist/decorators/index.mjs.map +1 -1
  104. package/dist/functions/CanvasUtility.js +2 -2
  105. package/dist/functions/CanvasUtility.js.map +1 -1
  106. package/dist/functions/CanvasUtility.mjs +2 -2
  107. package/dist/functions/CanvasUtility.mjs.map +1 -1
  108. package/dist/functions/DialogueUtility.d.mts +9 -9
  109. package/dist/functions/DialogueUtility.d.ts +9 -9
  110. package/dist/functions/DialogueUtility.js +184 -106
  111. package/dist/functions/DialogueUtility.js.map +1 -1
  112. package/dist/functions/DialogueUtility.mjs +184 -106
  113. package/dist/functions/DialogueUtility.mjs.map +1 -1
  114. package/dist/functions/FlagsUtility.js +42 -33
  115. package/dist/functions/FlagsUtility.js.map +1 -1
  116. package/dist/functions/FlagsUtility.mjs +42 -33
  117. package/dist/functions/FlagsUtility.mjs.map +1 -1
  118. package/dist/functions/GameUtility.js +42 -33
  119. package/dist/functions/GameUtility.js.map +1 -1
  120. package/dist/functions/GameUtility.mjs +42 -33
  121. package/dist/functions/GameUtility.mjs.map +1 -1
  122. package/dist/functions/ImageUtility.js +45 -36
  123. package/dist/functions/ImageUtility.js.map +1 -1
  124. package/dist/functions/ImageUtility.mjs +45 -36
  125. package/dist/functions/ImageUtility.mjs.map +1 -1
  126. package/dist/functions/SavesUtility.d.mts +4 -4
  127. package/dist/functions/SavesUtility.d.ts +4 -4
  128. package/dist/functions/SavesUtility.js +173 -111
  129. package/dist/functions/SavesUtility.js.map +1 -1
  130. package/dist/functions/SavesUtility.mjs +173 -111
  131. package/dist/functions/SavesUtility.mjs.map +1 -1
  132. package/dist/functions/TickerUtility.d.mts +2 -1
  133. package/dist/functions/TickerUtility.d.ts +2 -1
  134. package/dist/functions/TickerUtility.js +19 -15
  135. package/dist/functions/TickerUtility.js.map +1 -1
  136. package/dist/functions/TickerUtility.mjs +19 -15
  137. package/dist/functions/TickerUtility.mjs.map +1 -1
  138. package/dist/functions/index.d.mts +3 -3
  139. package/dist/functions/index.d.ts +3 -3
  140. package/dist/functions/index.js +197 -115
  141. package/dist/functions/index.js.map +1 -1
  142. package/dist/functions/index.mjs +197 -115
  143. package/dist/functions/index.mjs.map +1 -1
  144. package/dist/index.d.mts +1 -1
  145. package/dist/index.d.ts +1 -1
  146. package/dist/index.js +325 -190
  147. package/dist/index.js.map +1 -1
  148. package/dist/index.mjs +326 -191
  149. package/dist/index.mjs.map +1 -1
  150. package/dist/interface/IHistoryStep.d.mts +1 -1
  151. package/dist/interface/IHistoryStep.d.ts +1 -1
  152. package/dist/interface/ISaveData.d.mts +2 -2
  153. package/dist/interface/ISaveData.d.ts +2 -2
  154. package/dist/interface/LabelProps.d.mts +5 -0
  155. package/dist/interface/LabelProps.d.ts +5 -0
  156. package/dist/interface/LabelProps.js +4 -0
  157. package/dist/interface/LabelProps.js.map +1 -0
  158. package/dist/interface/LabelProps.mjs +3 -0
  159. package/dist/interface/LabelProps.mjs.map +1 -0
  160. package/dist/interface/export/ExportedStep.d.mts +2 -2
  161. package/dist/interface/export/ExportedStep.d.ts +2 -2
  162. package/dist/interface/export/index.d.mts +2 -2
  163. package/dist/interface/export/index.d.ts +2 -2
  164. package/dist/interface/index.d.mts +4 -4
  165. package/dist/interface/index.d.ts +4 -4
  166. package/dist/labels/BaseCanvasElementTestLabel.d.mts +2 -2
  167. package/dist/labels/BaseCanvasElementTestLabel.d.ts +2 -2
  168. package/dist/labels/BaseCanvasElementTestLabel.js +175 -111
  169. package/dist/labels/BaseCanvasElementTestLabel.js.map +1 -1
  170. package/dist/labels/BaseCanvasElementTestLabel.mjs +176 -112
  171. package/dist/labels/BaseCanvasElementTestLabel.mjs.map +1 -1
  172. package/dist/labels/CanvasEventsTestLabel.d.mts +3 -6
  173. package/dist/labels/CanvasEventsTestLabel.d.ts +3 -6
  174. package/dist/labels/CanvasEventsTestLabel.js +186 -128
  175. package/dist/labels/CanvasEventsTestLabel.js.map +1 -1
  176. package/dist/labels/CanvasEventsTestLabel.mjs +187 -129
  177. package/dist/labels/CanvasEventsTestLabel.mjs.map +1 -1
  178. package/dist/labels/CustomTickerCanvasElementTestLabel.d.mts +2 -2
  179. package/dist/labels/CustomTickerCanvasElementTestLabel.d.ts +2 -2
  180. package/dist/labels/CustomTickerCanvasElementTestLabel.js +166 -108
  181. package/dist/labels/CustomTickerCanvasElementTestLabel.js.map +1 -1
  182. package/dist/labels/CustomTickerCanvasElementTestLabel.mjs +166 -108
  183. package/dist/labels/CustomTickerCanvasElementTestLabel.mjs.map +1 -1
  184. package/dist/labels/ImagesAnimationsTestLabel.d.mts +2 -2
  185. package/dist/labels/ImagesAnimationsTestLabel.d.ts +2 -2
  186. package/dist/labels/ImagesAnimationsTestLabel.js +253 -147
  187. package/dist/labels/ImagesAnimationsTestLabel.js.map +1 -1
  188. package/dist/labels/ImagesAnimationsTestLabel.mjs +253 -147
  189. package/dist/labels/ImagesAnimationsTestLabel.mjs.map +1 -1
  190. package/dist/labels/MarkdownTest.d.mts +2 -2
  191. package/dist/labels/MarkdownTest.d.ts +2 -2
  192. package/dist/labels/MarkdownTest.js +166 -108
  193. package/dist/labels/MarkdownTest.js.map +1 -1
  194. package/dist/labels/MarkdownTest.mjs +166 -108
  195. package/dist/labels/MarkdownTest.mjs.map +1 -1
  196. package/dist/labels/StartLabel.d.mts +2 -2
  197. package/dist/labels/StartLabel.d.ts +2 -2
  198. package/dist/labels/StartLabel.js +316 -184
  199. package/dist/labels/StartLabel.js.map +1 -1
  200. package/dist/labels/StartLabel.mjs +317 -185
  201. package/dist/labels/StartLabel.mjs.map +1 -1
  202. package/dist/labels/StepLabelTest.d.mts +9 -0
  203. package/dist/labels/StepLabelTest.d.ts +9 -0
  204. package/dist/labels/StepLabelTest.js +2758 -0
  205. package/dist/labels/StepLabelTest.js.map +1 -0
  206. package/dist/labels/StepLabelTest.mjs +2752 -0
  207. package/dist/labels/StepLabelTest.mjs.map +1 -0
  208. package/dist/labels/TestConstant.js +43 -34
  209. package/dist/labels/TestConstant.js.map +1 -1
  210. package/dist/labels/TestConstant.mjs +43 -34
  211. package/dist/labels/TestConstant.mjs.map +1 -1
  212. package/dist/labels/index.d.mts +2 -2
  213. package/dist/labels/index.d.ts +2 -2
  214. package/dist/labels/index.js +316 -184
  215. package/dist/labels/index.js.map +1 -1
  216. package/dist/labels/index.mjs +317 -185
  217. package/dist/labels/index.mjs.map +1 -1
  218. package/dist/managers/StepManager.d.mts +6 -5
  219. package/dist/managers/StepManager.d.ts +6 -5
  220. package/dist/managers/StepManager.js +163 -105
  221. package/dist/managers/StepManager.js.map +1 -1
  222. package/dist/managers/StepManager.mjs +163 -105
  223. package/dist/managers/StepManager.mjs.map +1 -1
  224. package/dist/managers/WindowManager.js +2 -2
  225. package/dist/managers/WindowManager.js.map +1 -1
  226. package/dist/managers/WindowManager.mjs +2 -2
  227. package/dist/managers/WindowManager.mjs.map +1 -1
  228. package/dist/managers/index.d.mts +2 -2
  229. package/dist/managers/index.d.ts +2 -2
  230. package/dist/managers/index.js +163 -105
  231. package/dist/managers/index.js.map +1 -1
  232. package/dist/managers/index.mjs +163 -105
  233. package/dist/managers/index.mjs.map +1 -1
  234. package/dist/types/ChoiceMenuOptionsType.d.mts +2 -2
  235. package/dist/types/ChoiceMenuOptionsType.d.ts +2 -2
  236. package/dist/types/index.d.mts +1 -1
  237. package/dist/types/index.d.ts +1 -1
  238. package/package.json +6 -6
package/README.md CHANGED
@@ -1,13 +1,16 @@
1
1
  # Pixi'VN - PixiJS Visual Novel Engine
2
2
 
3
- Pixi'VN is a npm package that provides various features for creating visual novels.
3
+ PixiVN is a npm package that provides various features for creating visual novels, has functions to manage story steps, saving and loading, variable storage, dialogues, character,canvas management, and much more.
4
4
 
5
- Pixi'VN has functions to manage story steps, saving and loading, variable storage, dialogues, and character creation.
5
+ PixiVN + [Templates](https://pixi-vn.web.app/start/getting-started.html#pivi-vn-templates) provides a complete solution and is in effect a visual novel engine.
6
6
 
7
- Pixi'VN is based on [Pixi.js](https://pixijs.com/), a modern 2D rendering engine, expanding the features by adding a save and load system, and functions to simplify the addition of images and animations.
7
+ It is designed for web developers, with basic experience in JavaScript/TypeScript, who want to create a visual novel with a modern 2D rendering engine and their favorite JavaScript framework.
8
8
 
9
- In addition to managing the Pixi.js "Canvas", Pixi'VN offers the possibility of adding an HTML Element with the same dimensions as the "Canvas" to add interactions with the user.
10
- This allows the use of systems such as React, Vue, Angular, etc. to create much more complex interfaces with excellent performance.
9
+ It is based on [Pixi.js](https://pixijs.com/), a rendering engine that allows you to create fast 2D graphics. It is based on WebGL and is very fast and efficient. It is used by many developers to create games, websites, and applications.
10
+
11
+ In addition to managing the Pixi.js "Canvas", Pixi’VN offers the possibility of adding an HTML Element with the same dimensions as the "Canvas" to add interactions with the user.
12
+
13
+ This allows the use of systems such as React, Vue, Angular, etc. to create much more complex **interface screens** with excellent performance.
11
14
 
12
15
  ## Wiki
13
16
 
@@ -0,0 +1,113 @@
1
+ import { LabelIdType } from './types/LabelIdType.js';
2
+ import { StepLabelType } from './types/StepLabelType.js';
3
+ import { StepHistoryDataType } from './types/StepHistoryDataType.js';
4
+
5
+ /**
6
+ * Label is a class that contains a list of steps, which will be performed as the game continues.
7
+ * For Ren'py this is the equivalent of a label.
8
+ * @example
9
+ * ```typescript
10
+ * const START_LABEL_ID = "StartLabel"
11
+ *
12
+ * export const startLabel = newLabel(START_LABEL_ID,
13
+ * [
14
+ * (props) => {
15
+ * GameWindowManager.clear()
16
+ * setDialogue({ character: liam, text: "Which test do you want to perform?" })
17
+ * setChoiceMenuOptions([
18
+ * new ChoiceMenuOption("Events Test", eventsTestLabel),
19
+ * new ChoiceMenuOption("Show Image Test", showImageTest),
20
+ * ])
21
+ * },
22
+ * (props) => GameStepManager.jumpLabel(START_LABEL_ID, props),
23
+ * ]
24
+ * )
25
+ *
26
+ * GameStepManager.callLabel(StartLabel)
27
+ * ```
28
+ */
29
+ declare class Label<T extends {} = {}> {
30
+ /**
31
+ * @param id is the id of the label
32
+ * @param steps is the list of steps that the label will perform
33
+ * @param props is the properties of the label
34
+ */
35
+ constructor(id: LabelIdType, steps: StepLabelType<T>[] | (() => StepLabelType<T>[]), props?: LabelProps<T>);
36
+ private _id;
37
+ /**
38
+ * Get the id of the label. This variable is used in the system to get the label by id, {@link getLabelById}
39
+ */
40
+ get id(): LabelIdType;
41
+ private _steps;
42
+ /**
43
+ * Get the steps of the label.
44
+ * This class should be extended and the steps method should be overridden.
45
+ * Every time you update this list will also be updated when the other game versions load.
46
+ */
47
+ get steps(): StepLabelType<T>[];
48
+ /**
49
+ * Get the corresponding steps number
50
+ * @param externalSteps
51
+ * @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
52
+ */
53
+ getCorrespondingStepsNumber(externalSteps: StepHistoryDataType[] | StepLabelType[]): number;
54
+ private _onStepStart;
55
+ /**
56
+ * Is a function that will be executed in {@link Label#onStepStart} and when the user goes back to it or when the user laods a save file.
57
+ * @returns Promise<void> or void
58
+ */
59
+ get onStepStart(): ((stepIndex: number, label: Label<T>) => void | Promise<void>) | undefined;
60
+ private _onLoadStep;
61
+ /**
62
+ * Get the function that will be executed a old step is reloaded. A step is reloaded when the user goes back to it or when the user laods a save file.
63
+ * @returns Promise<void> or void
64
+ */
65
+ get onLoadStep(): ((stepIndex: number, label: Label<T>) => void | Promise<void>) | undefined;
66
+ private _onStepEnd;
67
+ /**
68
+ * Is a function that will be executed when the step ends.
69
+ * @returns Promise<void> or void
70
+ */
71
+ get onStepEnd(): ((stepIndex: number, label: Label<T>) => void | Promise<void>) | undefined;
72
+ private _choiseIndex;
73
+ get choiseIndex(): number | undefined;
74
+ }
75
+
76
+ interface LabelProps<T extends {}> {
77
+ /**
78
+ * 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.
79
+ * @param stepIndex Step index
80
+ * @param label Label
81
+ * @returns
82
+ * @example
83
+ * ```typescript
84
+ * newLabel("id", [], {
85
+ * onStepStart: async (stepIndex, label) => {
86
+ * await Assets.load('path/to/image1.png')
87
+ * await Assets.load('path/to/image2.png')
88
+ * }
89
+ * })
90
+ * ```
91
+ */
92
+ onStepStart?: (stepIndex: number, label: Label<T>) => void | Promise<void>;
93
+ /**
94
+ * Is a function that will be executed in {@link Label#onStepStart} and when the user goes back to it or when the user laods a save file.
95
+ * @param stepIndex Step index
96
+ * @param label Label
97
+ * @returns
98
+ */
99
+ onLoadStep?: (stepIndex: number, label: Label<T>) => void | Promise<void>;
100
+ /**
101
+ * Is a function that will be executed when the step ends.
102
+ * @param stepIndex Step index
103
+ * @param label Label
104
+ * @returns
105
+ */
106
+ onStepEnd?: (stepIndex: number, label: Label<T>) => void | Promise<void>;
107
+ /**
108
+ * Is the index of the choice that the label will perform. This variable is used in the system.
109
+ */
110
+ choiseIndex?: number;
111
+ }
112
+
113
+ export { Label as L, type LabelProps as a };
@@ -0,0 +1,113 @@
1
+ import { LabelIdType } from './types/LabelIdType.mjs';
2
+ import { StepLabelType } from './types/StepLabelType.mjs';
3
+ import { StepHistoryDataType } from './types/StepHistoryDataType.mjs';
4
+
5
+ /**
6
+ * Label is a class that contains a list of steps, which will be performed as the game continues.
7
+ * For Ren'py this is the equivalent of a label.
8
+ * @example
9
+ * ```typescript
10
+ * const START_LABEL_ID = "StartLabel"
11
+ *
12
+ * export const startLabel = newLabel(START_LABEL_ID,
13
+ * [
14
+ * (props) => {
15
+ * GameWindowManager.clear()
16
+ * setDialogue({ character: liam, text: "Which test do you want to perform?" })
17
+ * setChoiceMenuOptions([
18
+ * new ChoiceMenuOption("Events Test", eventsTestLabel),
19
+ * new ChoiceMenuOption("Show Image Test", showImageTest),
20
+ * ])
21
+ * },
22
+ * (props) => GameStepManager.jumpLabel(START_LABEL_ID, props),
23
+ * ]
24
+ * )
25
+ *
26
+ * GameStepManager.callLabel(StartLabel)
27
+ * ```
28
+ */
29
+ declare class Label<T extends {} = {}> {
30
+ /**
31
+ * @param id is the id of the label
32
+ * @param steps is the list of steps that the label will perform
33
+ * @param props is the properties of the label
34
+ */
35
+ constructor(id: LabelIdType, steps: StepLabelType<T>[] | (() => StepLabelType<T>[]), props?: LabelProps<T>);
36
+ private _id;
37
+ /**
38
+ * Get the id of the label. This variable is used in the system to get the label by id, {@link getLabelById}
39
+ */
40
+ get id(): LabelIdType;
41
+ private _steps;
42
+ /**
43
+ * Get the steps of the label.
44
+ * This class should be extended and the steps method should be overridden.
45
+ * Every time you update this list will also be updated when the other game versions load.
46
+ */
47
+ get steps(): StepLabelType<T>[];
48
+ /**
49
+ * Get the corresponding steps number
50
+ * @param externalSteps
51
+ * @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
52
+ */
53
+ getCorrespondingStepsNumber(externalSteps: StepHistoryDataType[] | StepLabelType[]): number;
54
+ private _onStepStart;
55
+ /**
56
+ * Is a function that will be executed in {@link Label#onStepStart} and when the user goes back to it or when the user laods a save file.
57
+ * @returns Promise<void> or void
58
+ */
59
+ get onStepStart(): ((stepIndex: number, label: Label<T>) => void | Promise<void>) | undefined;
60
+ private _onLoadStep;
61
+ /**
62
+ * Get the function that will be executed a old step is reloaded. A step is reloaded when the user goes back to it or when the user laods a save file.
63
+ * @returns Promise<void> or void
64
+ */
65
+ get onLoadStep(): ((stepIndex: number, label: Label<T>) => void | Promise<void>) | undefined;
66
+ private _onStepEnd;
67
+ /**
68
+ * Is a function that will be executed when the step ends.
69
+ * @returns Promise<void> or void
70
+ */
71
+ get onStepEnd(): ((stepIndex: number, label: Label<T>) => void | Promise<void>) | undefined;
72
+ private _choiseIndex;
73
+ get choiseIndex(): number | undefined;
74
+ }
75
+
76
+ interface LabelProps<T extends {}> {
77
+ /**
78
+ * 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.
79
+ * @param stepIndex Step index
80
+ * @param label Label
81
+ * @returns
82
+ * @example
83
+ * ```typescript
84
+ * newLabel("id", [], {
85
+ * onStepStart: async (stepIndex, label) => {
86
+ * await Assets.load('path/to/image1.png')
87
+ * await Assets.load('path/to/image2.png')
88
+ * }
89
+ * })
90
+ * ```
91
+ */
92
+ onStepStart?: (stepIndex: number, label: Label<T>) => void | Promise<void>;
93
+ /**
94
+ * Is a function that will be executed in {@link Label#onStepStart} and when the user goes back to it or when the user laods a save file.
95
+ * @param stepIndex Step index
96
+ * @param label Label
97
+ * @returns
98
+ */
99
+ onLoadStep?: (stepIndex: number, label: Label<T>) => void | Promise<void>;
100
+ /**
101
+ * Is a function that will be executed when the step ends.
102
+ * @param stepIndex Step index
103
+ * @param label Label
104
+ * @returns
105
+ */
106
+ onStepEnd?: (stepIndex: number, label: Label<T>) => void | Promise<void>;
107
+ /**
108
+ * Is the index of the choice that the label will perform. This variable is used in the system.
109
+ */
110
+ choiseIndex?: number;
111
+ }
112
+
113
+ export { Label as L, type LabelProps as a };
@@ -133,8 +133,6 @@ function getMemoryContainer(element) {
133
133
  };
134
134
  }
135
135
  function setMemoryContainer(element, memory) {
136
- memory.width && (element.width = memory.width);
137
- memory.height && (element.height = memory.height);
138
136
  memory.isRenderGroup && (element.isRenderGroup = memory.isRenderGroup);
139
137
  memory.blendMode && (element.blendMode = memory.blendMode);
140
138
  memory.tint && (element.tint = memory.tint);
@@ -167,6 +165,8 @@ function setMemoryContainer(element, memory) {
167
165
  memory.interactive && (element.interactive = memory.interactive);
168
166
  memory.interactiveChildren && (element.interactiveChildren = memory.interactiveChildren);
169
167
  memory.hitArea && (element.hitArea = memory.hitArea);
168
+ memory.width && (element.width = memory.width);
169
+ memory.height && (element.height = memory.height);
170
170
  }
171
171
  function getTexture(imageUrl) {
172
172
  return __async(this, null, function* () {
@@ -702,8 +702,9 @@ FadeAlphaTicker = __decorateClass([
702
702
  ], FadeAlphaTicker);
703
703
 
704
704
  // src/functions/TickerUtility.ts
705
- function updateTickerProgression(args, propertyName, progression) {
706
- if (args[propertyName] === void 0 || !progression || args[propertyName] === progression.limit) {
705
+ function updateTickerProgression(args, propertyName, progression, valueConvert) {
706
+ let limit = valueConvert && progression.limit ? valueConvert(progression.limit) : progression.limit;
707
+ if (args[propertyName] === void 0 || !progression || args[propertyName] === limit) {
707
708
  return;
708
709
  }
709
710
  if (typeof args[propertyName] === "number") {
@@ -722,22 +723,25 @@ function updateTickerProgression(args, propertyName, progression) {
722
723
  }
723
724
  }
724
725
  }
725
- function getLinearProgression(number, progression) {
726
- if (progression.limit !== void 0) {
727
- if (number > progression.limit && progression.amt > 0) {
728
- return progression.limit;
729
- } else if (number < progression.limit && progression.amt < 0) {
730
- return progression.limit;
726
+ function getLinearProgression(number, progression, valueConvert) {
727
+ let limit = valueConvert && progression.limit ? valueConvert(progression.limit) : progression.limit;
728
+ let amt = valueConvert ? valueConvert(progression.amt) : progression.amt;
729
+ if (limit !== void 0) {
730
+ if (number > limit && amt > 0) {
731
+ return limit;
732
+ } else if (number < limit && amt < 0) {
733
+ return limit;
731
734
  }
732
735
  }
733
- return number + progression.amt / 60;
736
+ return number + amt;
734
737
  }
735
- function getExponentialProgression(number, progression) {
736
- if (progression.limit !== void 0) {
737
- if (number > progression.limit && progression.percentage > 0) {
738
- return progression.limit;
739
- } else if (number < progression.limit && progression.percentage < 0) {
740
- return progression.limit;
738
+ function getExponentialProgression(number, progression, valueConvert) {
739
+ let limit = valueConvert && progression.limit ? valueConvert(progression.limit) : progression.limit;
740
+ if (limit !== void 0) {
741
+ if (number > limit && progression.percentage > 0) {
742
+ return limit;
743
+ } else if (number < limit && progression.percentage < 0) {
744
+ return limit;
741
745
  }
742
746
  }
743
747
  return number + number * progression.percentage;
@@ -750,15 +754,13 @@ var MoveTicker = class extends TickerBase {
750
754
  let ySpeed = 1;
751
755
  if (args.speed) {
752
756
  if (typeof args.speed === "number") {
753
- xSpeed = args.speed;
754
- ySpeed = args.speed;
757
+ xSpeed = this.speedConvert(args.speed);
758
+ ySpeed = this.speedConvert(args.speed);
755
759
  } else {
756
- xSpeed = args.speed.x;
757
- ySpeed = args.speed.y;
760
+ xSpeed = this.speedConvert(args.speed.x);
761
+ ySpeed = this.speedConvert(args.speed.y);
758
762
  }
759
763
  }
760
- xSpeed /= 60;
761
- ySpeed /= 60;
762
764
  let destination = args.destination;
763
765
  let tagToRemoveAfter2 = args.tagToRemoveAfter || [];
764
766
  if (typeof tagToRemoveAfter2 === "string") {
@@ -798,7 +800,10 @@ var MoveTicker = class extends TickerBase {
798
800
  }
799
801
  });
800
802
  if (args.speedProgression)
801
- updateTickerProgression(args, "speed", args.speedProgression);
803
+ updateTickerProgression(args, "speed", args.speedProgression, this.speedConvert);
804
+ }
805
+ speedConvert(speed) {
806
+ return speed / 6;
802
807
  }
803
808
  };
804
809
  MoveTicker = __decorateClass([
@@ -806,7 +811,7 @@ MoveTicker = __decorateClass([
806
811
  ], MoveTicker);
807
812
  var RotateTicker = class extends TickerBase {
808
813
  fn(ticker, args, tags, tickerId) {
809
- let speed = (args.speed === void 0 ? 1 : args.speed) / 60;
814
+ let speed = this.speedConvert(args.speed === void 0 ? 1 : args.speed);
810
815
  let clockwise = args.clockwise === void 0 ? true : args.clockwise;
811
816
  let tagToRemoveAfter2 = args.tagToRemoveAfter || [];
812
817
  if (typeof tagToRemoveAfter2 === "string") {
@@ -834,7 +839,10 @@ var RotateTicker = class extends TickerBase {
834
839
  }
835
840
  });
836
841
  if (args.speedProgression)
837
- updateTickerProgression(args, "speed", args.speedProgression);
842
+ updateTickerProgression(args, "speed", args.speedProgression, this.speedConvert);
843
+ }
844
+ speedConvert(speed) {
845
+ return speed / 60;
838
846
  }
839
847
  };
840
848
  RotateTicker = __decorateClass([
@@ -846,15 +854,13 @@ var ZoomTicker = class extends TickerBase {
846
854
  let ySpeed = 0.1;
847
855
  if (args.speed) {
848
856
  if (typeof args.speed === "number") {
849
- xSpeed = args.speed;
850
- ySpeed = args.speed;
857
+ xSpeed = this.speedConvert(args.speed);
858
+ ySpeed = this.speedConvert(args.speed);
851
859
  } else {
852
- xSpeed = args.speed.x;
853
- ySpeed = args.speed.y;
860
+ xSpeed = this.speedConvert(args.speed.x);
861
+ ySpeed = this.speedConvert(args.speed.y);
854
862
  }
855
863
  }
856
- xSpeed /= 60;
857
- ySpeed /= 60;
858
864
  let tagToRemoveAfter2 = args.tagToRemoveAfter || [];
859
865
  if (typeof tagToRemoveAfter2 === "string") {
860
866
  tagToRemoveAfter2 = [tagToRemoveAfter2];
@@ -921,7 +927,10 @@ var ZoomTicker = class extends TickerBase {
921
927
  }
922
928
  });
923
929
  if (args.speedProgression)
924
- updateTickerProgression(args, "speed", args.speedProgression);
930
+ updateTickerProgression(args, "speed", args.speedProgression, this.speedConvert);
931
+ }
932
+ speedConvert(speed) {
933
+ return speed / 60;
925
934
  }
926
935
  onEndOfTicker(tag, tickerId, _element, tagToRemoveAfter2) {
927
936
  GameWindowManager.onEndOfTicker(tag, this, tagToRemoveAfter2, tickerId);