@drincs/pixi-vn 0.6.4 → 0.6.6

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 (266) hide show
  1. package/README.md +56 -7
  2. package/dist/classes/CharacterBaseModel.js +99 -90
  3. package/dist/classes/CharacterBaseModel.js.map +1 -1
  4. package/dist/classes/CharacterBaseModel.mjs +99 -90
  5. package/dist/classes/CharacterBaseModel.mjs.map +1 -1
  6. package/dist/classes/ChoiceMenuOption.d.mts +71 -8
  7. package/dist/classes/ChoiceMenuOption.d.ts +71 -8
  8. package/dist/classes/ChoiceMenuOption.js +160 -77
  9. package/dist/classes/ChoiceMenuOption.js.map +1 -1
  10. package/dist/classes/ChoiceMenuOption.mjs +160 -77
  11. package/dist/classes/ChoiceMenuOption.mjs.map +1 -1
  12. package/dist/classes/CloseLabel.d.mts +3 -1
  13. package/dist/classes/CloseLabel.d.ts +3 -1
  14. package/dist/classes/CloseLabel.js +77 -32
  15. package/dist/classes/CloseLabel.js.map +1 -1
  16. package/dist/classes/CloseLabel.mjs +77 -32
  17. package/dist/classes/CloseLabel.mjs.map +1 -1
  18. package/dist/classes/Label.d.mts +6 -33
  19. package/dist/classes/Label.d.ts +6 -33
  20. package/dist/classes/Label.js +74 -31
  21. package/dist/classes/Label.js.map +1 -1
  22. package/dist/classes/Label.mjs +74 -31
  23. package/dist/classes/Label.mjs.map +1 -1
  24. package/dist/classes/LabelAbstract.d.mts +50 -0
  25. package/dist/classes/LabelAbstract.d.ts +50 -0
  26. package/dist/classes/LabelAbstract.js +100 -0
  27. package/dist/classes/LabelAbstract.js.map +1 -0
  28. package/dist/classes/LabelAbstract.mjs +98 -0
  29. package/dist/classes/LabelAbstract.mjs.map +1 -0
  30. package/dist/classes/LabelJson.d.mts +30 -0
  31. package/dist/classes/LabelJson.d.ts +30 -0
  32. package/dist/classes/LabelJson.js +2766 -0
  33. package/dist/classes/LabelJson.js.map +1 -0
  34. package/dist/classes/LabelJson.mjs +2760 -0
  35. package/dist/classes/LabelJson.mjs.map +1 -0
  36. package/dist/classes/StoredClassModel.js +42 -33
  37. package/dist/classes/StoredClassModel.js.map +1 -1
  38. package/dist/classes/StoredClassModel.mjs +42 -33
  39. package/dist/classes/StoredClassModel.mjs.map +1 -1
  40. package/dist/classes/canvas/CanvasContainer.js +2 -2
  41. package/dist/classes/canvas/CanvasContainer.js.map +1 -1
  42. package/dist/classes/canvas/CanvasContainer.mjs +2 -2
  43. package/dist/classes/canvas/CanvasContainer.mjs.map +1 -1
  44. package/dist/classes/canvas/CanvasImage.js +2 -2
  45. package/dist/classes/canvas/CanvasImage.js.map +1 -1
  46. package/dist/classes/canvas/CanvasImage.mjs +2 -2
  47. package/dist/classes/canvas/CanvasImage.mjs.map +1 -1
  48. package/dist/classes/canvas/CanvasSprite.js +2 -2
  49. package/dist/classes/canvas/CanvasSprite.js.map +1 -1
  50. package/dist/classes/canvas/CanvasSprite.mjs +2 -2
  51. package/dist/classes/canvas/CanvasSprite.mjs.map +1 -1
  52. package/dist/classes/canvas/CanvasText.js +2 -2
  53. package/dist/classes/canvas/CanvasText.js.map +1 -1
  54. package/dist/classes/canvas/CanvasText.mjs +2 -2
  55. package/dist/classes/canvas/CanvasText.mjs.map +1 -1
  56. package/dist/classes/canvas/index.js +2 -2
  57. package/dist/classes/canvas/index.js.map +1 -1
  58. package/dist/classes/canvas/index.mjs +2 -2
  59. package/dist/classes/canvas/index.mjs.map +1 -1
  60. package/dist/classes/index.d.mts +6 -1
  61. package/dist/classes/index.d.ts +6 -1
  62. package/dist/classes/index.js +945 -78
  63. package/dist/classes/index.js.map +1 -1
  64. package/dist/classes/index.mjs +945 -79
  65. package/dist/classes/index.mjs.map +1 -1
  66. package/dist/classes/ticker/FadeAlphaTicker.js +42 -33
  67. package/dist/classes/ticker/FadeAlphaTicker.js.map +1 -1
  68. package/dist/classes/ticker/FadeAlphaTicker.mjs +42 -33
  69. package/dist/classes/ticker/FadeAlphaTicker.mjs.map +1 -1
  70. package/dist/classes/ticker/MoveTicker.d.mts +1 -0
  71. package/dist/classes/ticker/MoveTicker.d.ts +1 -0
  72. package/dist/classes/ticker/MoveTicker.js +42 -33
  73. package/dist/classes/ticker/MoveTicker.js.map +1 -1
  74. package/dist/classes/ticker/MoveTicker.mjs +42 -33
  75. package/dist/classes/ticker/MoveTicker.mjs.map +1 -1
  76. package/dist/classes/ticker/RotateTicker.d.mts +1 -0
  77. package/dist/classes/ticker/RotateTicker.d.ts +1 -0
  78. package/dist/classes/ticker/RotateTicker.js +42 -33
  79. package/dist/classes/ticker/RotateTicker.js.map +1 -1
  80. package/dist/classes/ticker/RotateTicker.mjs +42 -33
  81. package/dist/classes/ticker/RotateTicker.mjs.map +1 -1
  82. package/dist/classes/ticker/ZoomTicker.d.mts +1 -0
  83. package/dist/classes/ticker/ZoomTicker.d.ts +1 -0
  84. package/dist/classes/ticker/ZoomTicker.js +42 -33
  85. package/dist/classes/ticker/ZoomTicker.js.map +1 -1
  86. package/dist/classes/ticker/ZoomTicker.mjs +42 -33
  87. package/dist/classes/ticker/ZoomTicker.mjs.map +1 -1
  88. package/dist/classes/ticker/index.js +42 -33
  89. package/dist/classes/ticker/index.js.map +1 -1
  90. package/dist/classes/ticker/index.mjs +42 -33
  91. package/dist/classes/ticker/index.mjs.map +1 -1
  92. package/dist/constants.d.mts +1 -1
  93. package/dist/constants.d.ts +1 -1
  94. package/dist/constants.js +1 -1
  95. package/dist/constants.js.map +1 -1
  96. package/dist/constants.mjs +1 -1
  97. package/dist/constants.mjs.map +1 -1
  98. package/dist/decorators/CanvasElementDecorator.js +2 -2
  99. package/dist/decorators/CanvasElementDecorator.js.map +1 -1
  100. package/dist/decorators/CanvasElementDecorator.mjs +2 -2
  101. package/dist/decorators/CanvasElementDecorator.mjs.map +1 -1
  102. package/dist/decorators/LabelDecorator.d.mts +19 -5
  103. package/dist/decorators/LabelDecorator.d.ts +19 -5
  104. package/dist/decorators/LabelDecorator.js +102 -65
  105. package/dist/decorators/LabelDecorator.js.map +1 -1
  106. package/dist/decorators/LabelDecorator.mjs +102 -66
  107. package/dist/decorators/LabelDecorator.mjs.map +1 -1
  108. package/dist/decorators/index.d.mts +10 -2
  109. package/dist/decorators/index.d.ts +10 -2
  110. package/dist/decorators/index.js +98 -65
  111. package/dist/decorators/index.js.map +1 -1
  112. package/dist/decorators/index.mjs +98 -65
  113. package/dist/decorators/index.mjs.map +1 -1
  114. package/dist/functions/CanvasUtility.js +2 -2
  115. package/dist/functions/CanvasUtility.js.map +1 -1
  116. package/dist/functions/CanvasUtility.mjs +2 -2
  117. package/dist/functions/CanvasUtility.mjs.map +1 -1
  118. package/dist/functions/DialogueUtility.d.mts +10 -8
  119. package/dist/functions/DialogueUtility.d.ts +10 -8
  120. package/dist/functions/DialogueUtility.js +268 -131
  121. package/dist/functions/DialogueUtility.js.map +1 -1
  122. package/dist/functions/DialogueUtility.mjs +268 -131
  123. package/dist/functions/DialogueUtility.mjs.map +1 -1
  124. package/dist/functions/FlagsUtility.js +42 -33
  125. package/dist/functions/FlagsUtility.js.map +1 -1
  126. package/dist/functions/FlagsUtility.mjs +42 -33
  127. package/dist/functions/FlagsUtility.mjs.map +1 -1
  128. package/dist/functions/GameUtility.js +42 -33
  129. package/dist/functions/GameUtility.js.map +1 -1
  130. package/dist/functions/GameUtility.mjs +42 -33
  131. package/dist/functions/GameUtility.mjs.map +1 -1
  132. package/dist/functions/ImageUtility.js +45 -36
  133. package/dist/functions/ImageUtility.js.map +1 -1
  134. package/dist/functions/ImageUtility.mjs +45 -36
  135. package/dist/functions/ImageUtility.mjs.map +1 -1
  136. package/dist/functions/Importer.d.mts +24 -0
  137. package/dist/functions/Importer.d.ts +24 -0
  138. package/dist/functions/Importer.js +2804 -0
  139. package/dist/functions/Importer.js.map +1 -0
  140. package/dist/functions/Importer.mjs +2798 -0
  141. package/dist/functions/Importer.mjs.map +1 -0
  142. package/dist/functions/SavesUtility.d.mts +5 -3
  143. package/dist/functions/SavesUtility.d.ts +5 -3
  144. package/dist/functions/SavesUtility.js +310 -145
  145. package/dist/functions/SavesUtility.js.map +1 -1
  146. package/dist/functions/SavesUtility.mjs +310 -145
  147. package/dist/functions/SavesUtility.mjs.map +1 -1
  148. package/dist/functions/TickerUtility.d.mts +2 -1
  149. package/dist/functions/TickerUtility.d.ts +2 -1
  150. package/dist/functions/TickerUtility.js +19 -15
  151. package/dist/functions/TickerUtility.js.map +1 -1
  152. package/dist/functions/TickerUtility.mjs +19 -15
  153. package/dist/functions/TickerUtility.mjs.map +1 -1
  154. package/dist/functions/index.d.mts +7 -2
  155. package/dist/functions/index.d.ts +7 -2
  156. package/dist/functions/index.js +364 -140
  157. package/dist/functions/index.js.map +1 -1
  158. package/dist/functions/index.mjs +364 -141
  159. package/dist/functions/index.mjs.map +1 -1
  160. package/dist/index.d.mts +6 -0
  161. package/dist/index.d.ts +6 -0
  162. package/dist/index.js +453 -219
  163. package/dist/index.js.map +1 -1
  164. package/dist/index.mjs +453 -221
  165. package/dist/index.mjs.map +1 -1
  166. package/dist/interface/IHistoryStep.d.mts +3 -1
  167. package/dist/interface/IHistoryStep.d.ts +3 -1
  168. package/dist/interface/ISaveData.d.mts +3 -1
  169. package/dist/interface/ISaveData.d.ts +3 -1
  170. package/dist/interface/LabelProps.d.mts +38 -0
  171. package/dist/interface/LabelProps.d.ts +38 -0
  172. package/dist/interface/LabelProps.js +4 -0
  173. package/dist/interface/LabelProps.js.map +1 -0
  174. package/dist/interface/LabelProps.mjs +3 -0
  175. package/dist/interface/LabelProps.mjs.map +1 -0
  176. package/dist/interface/export/ExportedStep.d.mts +3 -1
  177. package/dist/interface/export/ExportedStep.d.ts +3 -1
  178. package/dist/interface/export/index.d.mts +3 -1
  179. package/dist/interface/export/index.d.ts +3 -1
  180. package/dist/interface/index.d.mts +3 -1
  181. package/dist/interface/index.d.ts +3 -1
  182. package/dist/labels/BaseCanvasElementTestLabel.d.mts +3 -1
  183. package/dist/labels/BaseCanvasElementTestLabel.d.ts +3 -1
  184. package/dist/labels/BaseCanvasElementTestLabel.js +303 -136
  185. package/dist/labels/BaseCanvasElementTestLabel.js.map +1 -1
  186. package/dist/labels/BaseCanvasElementTestLabel.mjs +304 -137
  187. package/dist/labels/BaseCanvasElementTestLabel.mjs.map +1 -1
  188. package/dist/labels/CanvasEventsTestLabel.d.mts +4 -5
  189. package/dist/labels/CanvasEventsTestLabel.d.ts +4 -5
  190. package/dist/labels/CanvasEventsTestLabel.js +313 -148
  191. package/dist/labels/CanvasEventsTestLabel.js.map +1 -1
  192. package/dist/labels/CanvasEventsTestLabel.mjs +314 -149
  193. package/dist/labels/CanvasEventsTestLabel.mjs.map +1 -1
  194. package/dist/labels/CustomTickerCanvasElementTestLabel.d.mts +3 -1
  195. package/dist/labels/CustomTickerCanvasElementTestLabel.d.ts +3 -1
  196. package/dist/labels/CustomTickerCanvasElementTestLabel.js +294 -133
  197. package/dist/labels/CustomTickerCanvasElementTestLabel.js.map +1 -1
  198. package/dist/labels/CustomTickerCanvasElementTestLabel.mjs +295 -134
  199. package/dist/labels/CustomTickerCanvasElementTestLabel.mjs.map +1 -1
  200. package/dist/labels/ImagesAnimationsTestLabel.d.mts +3 -1
  201. package/dist/labels/ImagesAnimationsTestLabel.d.ts +3 -1
  202. package/dist/labels/ImagesAnimationsTestLabel.js +298 -181
  203. package/dist/labels/ImagesAnimationsTestLabel.js.map +1 -1
  204. package/dist/labels/ImagesAnimationsTestLabel.mjs +299 -182
  205. package/dist/labels/ImagesAnimationsTestLabel.mjs.map +1 -1
  206. package/dist/labels/MarkdownTest.d.mts +3 -1
  207. package/dist/labels/MarkdownTest.d.ts +3 -1
  208. package/dist/labels/MarkdownTest.js +294 -133
  209. package/dist/labels/MarkdownTest.js.map +1 -1
  210. package/dist/labels/MarkdownTest.mjs +294 -133
  211. package/dist/labels/MarkdownTest.mjs.map +1 -1
  212. package/dist/labels/StartLabel.d.mts +3 -1
  213. package/dist/labels/StartLabel.d.ts +3 -1
  214. package/dist/labels/StartLabel.js +360 -213
  215. package/dist/labels/StartLabel.js.map +1 -1
  216. package/dist/labels/StartLabel.mjs +361 -214
  217. package/dist/labels/StartLabel.mjs.map +1 -1
  218. package/dist/labels/StepLabelTest.d.mts +11 -0
  219. package/dist/labels/StepLabelTest.d.ts +11 -0
  220. package/dist/labels/StepLabelTest.js +2861 -0
  221. package/dist/labels/StepLabelTest.js.map +1 -0
  222. package/dist/labels/StepLabelTest.mjs +2855 -0
  223. package/dist/labels/StepLabelTest.mjs.map +1 -0
  224. package/dist/labels/TestConstant.js +43 -34
  225. package/dist/labels/TestConstant.js.map +1 -1
  226. package/dist/labels/TestConstant.mjs +43 -34
  227. package/dist/labels/TestConstant.mjs.map +1 -1
  228. package/dist/labels/index.d.mts +3 -1
  229. package/dist/labels/index.d.ts +3 -1
  230. package/dist/labels/index.js +360 -213
  231. package/dist/labels/index.js.map +1 -1
  232. package/dist/labels/index.mjs +361 -214
  233. package/dist/labels/index.mjs.map +1 -1
  234. package/dist/managers/StepManager.d.mts +10 -7
  235. package/dist/managers/StepManager.d.ts +10 -7
  236. package/dist/managers/StepManager.js +300 -139
  237. package/dist/managers/StepManager.js.map +1 -1
  238. package/dist/managers/StepManager.mjs +300 -139
  239. package/dist/managers/StepManager.mjs.map +1 -1
  240. package/dist/managers/WindowManager.js +2 -2
  241. package/dist/managers/WindowManager.js.map +1 -1
  242. package/dist/managers/WindowManager.mjs +2 -2
  243. package/dist/managers/WindowManager.mjs.map +1 -1
  244. package/dist/managers/index.d.mts +7 -5
  245. package/dist/managers/index.d.ts +7 -5
  246. package/dist/managers/index.js +300 -139
  247. package/dist/managers/index.js.map +1 -1
  248. package/dist/managers/index.mjs +300 -139
  249. package/dist/managers/index.mjs.map +1 -1
  250. package/dist/types/ChoiceMenuOptionsType.d.mts +3 -1
  251. package/dist/types/ChoiceMenuOptionsType.d.ts +3 -1
  252. package/dist/types/LabelJsonType.d.mts +22 -0
  253. package/dist/types/LabelJsonType.d.ts +22 -0
  254. package/dist/types/LabelJsonType.js +4 -0
  255. package/dist/types/LabelJsonType.js.map +1 -0
  256. package/dist/types/LabelJsonType.mjs +3 -0
  257. package/dist/types/LabelJsonType.mjs.map +1 -0
  258. package/dist/types/StepLabelJsonType.d.mts +30 -0
  259. package/dist/types/StepLabelJsonType.d.ts +30 -0
  260. package/dist/types/StepLabelJsonType.js +4 -0
  261. package/dist/types/StepLabelJsonType.js.map +1 -0
  262. package/dist/types/StepLabelJsonType.mjs +3 -0
  263. package/dist/types/StepLabelJsonType.mjs.map +1 -0
  264. package/dist/types/index.d.mts +4 -0
  265. package/dist/types/index.d.ts +4 -0
  266. package/package.json +7 -6
@@ -1,6 +1,6 @@
1
1
  import { diff } from 'deep-diff';
2
2
  import sha1 from 'crypto-js/sha1';
3
- import { Sprite, Container, Texture, Rectangle, Application, Assets, FillGradient, Color, TextStyle, Text } from 'pixi.js';
3
+ import { Sprite, Container, Assets, TextStyle, FillGradient, Color, Texture, Rectangle, Text, Application } from 'pixi.js';
4
4
 
5
5
  var __defProp = Object.defineProperty;
6
6
  var __defProps = Object.defineProperties;
@@ -72,19 +72,18 @@ function checkIfStepsIsEqual(step1, step2) {
72
72
  return step1 === step2;
73
73
  }
74
74
 
75
- // src/classes/Label.ts
76
- var Label = class {
75
+ // src/classes/LabelAbstract.ts
76
+ var LabelAbstract = class {
77
77
  /**
78
78
  * @param id is the id of the label
79
- * @param steps is the list of steps that the label will perform
80
- * @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
81
- * @param choiseIndex is the index of the choice that the label will perform
79
+ * @param props is the properties of the label
82
80
  */
83
- constructor(id, steps, onStepRun, choiseIndex) {
81
+ constructor(id, props) {
84
82
  this._id = id;
85
- this._steps = steps;
86
- this._onStepRun = onStepRun;
87
- this._choiseIndex = choiseIndex;
83
+ this._onStepStart = props == null ? void 0 : props.onStepStart;
84
+ this._onLoadStep = props == null ? void 0 : props.onLoadStep;
85
+ this._onStepEnd = props == null ? void 0 : props.onStepEnd;
86
+ this._choiseIndex = props == null ? void 0 : props.choiseIndex;
88
87
  }
89
88
  /**
90
89
  * Get the id of the label. This variable is used in the system to get the label by id, {@link getLabelById}
@@ -92,17 +91,6 @@ var Label = class {
92
91
  get id() {
93
92
  return this._id;
94
93
  }
95
- /**
96
- * Get the steps of the label.
97
- * This class should be extended and the steps method should be overridden.
98
- * Every time you update this list will also be updated when the other game versions load.
99
- */
100
- get steps() {
101
- if (typeof this._steps === "function") {
102
- return this._steps();
103
- }
104
- return this._steps;
105
- }
106
94
  /**
107
95
  * Get the corresponding steps number
108
96
  * @param externalSteps
@@ -121,37 +109,75 @@ var Label = class {
121
109
  return res;
122
110
  }
123
111
  /**
124
- * 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
112
+ * 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.
125
113
  * @returns Promise<void> or void
126
- * @example
127
- * ```typescript
128
- * newLabel("id", [], () => {
129
- * Assets.load('path/to/image1.png')
130
- * Assets.load('path/to/image2.png')
131
- * })
132
- * ```
133
114
  */
134
- get onStepRun() {
135
- return this._onStepRun;
115
+ get onStepStart() {
116
+ return (stepIndex, label) => __async(this, null, function* () {
117
+ if (this._onLoadStep) {
118
+ yield this._onLoadStep(stepIndex, label);
119
+ }
120
+ if (this._onStepStart) {
121
+ return yield this._onStepStart(stepIndex, label);
122
+ }
123
+ });
124
+ }
125
+ /**
126
+ * 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.
127
+ * @returns Promise<void> or void
128
+ */
129
+ get onLoadStep() {
130
+ return this._onLoadStep;
131
+ }
132
+ /**
133
+ * Is a function that will be executed when the step ends.
134
+ * @returns Promise<void> or void
135
+ */
136
+ get onStepEnd() {
137
+ return this._onStepEnd;
136
138
  }
137
139
  get choiseIndex() {
138
140
  return this._choiseIndex;
139
141
  }
140
142
  };
141
143
 
144
+ // src/classes/Label.ts
145
+ var Label = class extends LabelAbstract {
146
+ /**
147
+ * @param id is the id of the label
148
+ * @param steps is the list of steps that the label will perform
149
+ * @param props is the properties of the label
150
+ */
151
+ constructor(id, steps, props) {
152
+ super(id, props);
153
+ this._steps = steps;
154
+ }
155
+ /**
156
+ * Get the steps of the label.
157
+ */
158
+ get steps() {
159
+ if (typeof this._steps === "function") {
160
+ return this._steps();
161
+ }
162
+ return this._steps;
163
+ }
164
+ };
165
+
142
166
  // src/classes/CloseLabel.ts
143
167
  var CLOSE_LABEL_ID = "__close-label-id__";
144
168
  function newCloseLabel(choiseIndex) {
145
- return new Label(CLOSE_LABEL_ID, [], void 0, choiseIndex);
169
+ return new Label(CLOSE_LABEL_ID, [], {
170
+ choiseIndex
171
+ });
146
172
  }
147
173
 
148
174
  // src/decorators/LabelDecorator.ts
149
175
  var registeredLabels = {};
150
- function newLabel(id, steps, onStepRun) {
176
+ function newLabel(id, steps, props) {
151
177
  if (registeredLabels[id]) {
152
178
  console.info(`[Pixi'VN] Label ${id} already exists, it will be overwritten`);
153
179
  }
154
- let label = new Label(id, steps, onStepRun);
180
+ let label = new Label(id, steps, props);
155
181
  registeredLabels[id] = label;
156
182
  return label;
157
183
  }
@@ -240,8 +266,6 @@ function getMemoryContainer(element) {
240
266
  };
241
267
  }
242
268
  function setMemoryContainer(element, memory) {
243
- memory.width && (element.width = memory.width);
244
- memory.height && (element.height = memory.height);
245
269
  memory.isRenderGroup && (element.isRenderGroup = memory.isRenderGroup);
246
270
  memory.blendMode && (element.blendMode = memory.blendMode);
247
271
  memory.tint && (element.tint = memory.tint);
@@ -274,6 +298,8 @@ function setMemoryContainer(element, memory) {
274
298
  memory.interactive && (element.interactive = memory.interactive);
275
299
  memory.interactiveChildren && (element.interactiveChildren = memory.interactiveChildren);
276
300
  memory.hitArea && (element.hitArea = memory.hitArea);
301
+ memory.width && (element.width = memory.width);
302
+ memory.height && (element.height = memory.height);
277
303
  }
278
304
  function getTexture(imageUrl) {
279
305
  return __async(this, null, function* () {
@@ -716,29 +742,57 @@ var ChoiceMenuOption = class {
716
742
  /**
717
743
  * @param text Text to be displayed in the menu
718
744
  * @param label Label to be opened when the option is selected or the id of the label
745
+ * @param props Properties to be passed to the label and olther parameters that you can use when get all the choice menu options. It be converted to a JSON string, so it cannot contain functions or classes.
719
746
  * @param type Type of the label to be opened. @default "call"
720
- * @param props Properties to be passed to the label, when the label is called. it cannot contain functions or classes. @default {}
721
747
  */
722
- constructor(text, label, type = "call", props) {
748
+ constructor(text, label, props, type = "call") {
723
749
  /**
724
- * Properties to be passed to the label
750
+ * Properties to be passed to the label and olther parameters that you can use when get all the choice menu options.
751
+ * @example
752
+ * ```tsx
753
+ * setChoiceMenuOptions([
754
+ * new ChoiceMenuOption("Hello", helloLabel, { disabled: true }),
755
+ * ])
756
+ * return <List>
757
+ * {getChoiceMenuOptions()?.map((item, index) => {
758
+ * return (
759
+ * <ChoiceButton
760
+ * disabled={item.props.disabled}
761
+ * onClick={() => {
762
+ * afterSelectChoice(item)
763
+ * }}
764
+ * >
765
+ * {item.text}
766
+ * </ChoiceButton>
767
+ * )
768
+ * })}
769
+ * </List>
770
+ * ```
725
771
  */
726
772
  this.props = {};
727
- if (typeof label === "string") {
728
- let tLabel = getLabelById(label);
729
- if (!tLabel) {
730
- throw new Error(`[Pixi'VN] Label ${label} not found`);
731
- } else {
732
- label = tLabel;
733
- }
734
- }
735
773
  this.text = text;
736
- this.label = label;
774
+ this._label = label;
737
775
  this.type = type;
738
776
  if (props) {
739
777
  this.props = props;
740
778
  }
741
779
  }
780
+ /**
781
+ * Label to be opened when the option is selected
782
+ */
783
+ get label() {
784
+ let label = this._label;
785
+ if (typeof label === "string") {
786
+ let res = getLabelById(label);
787
+ if (res) {
788
+ label = res;
789
+ } else {
790
+ console.error(`Label ${label} not found, so it will be closed`);
791
+ label = newCloseLabel();
792
+ }
793
+ }
794
+ return label;
795
+ }
742
796
  };
743
797
  var ChoiceMenuOptionClose = class {
744
798
  /**
@@ -755,7 +809,27 @@ var ChoiceMenuOptionClose = class {
755
809
  */
756
810
  this.type = Close;
757
811
  /**
758
- * Properties to be passed to the label
812
+ * Properties to be passed to the label and olther parameters that you can use when get all the choice menu options.
813
+ * @example
814
+ * ```tsx
815
+ * setChoiceMenuOptions([
816
+ * new ChoiceMenuOption("Hello", helloLabel, { disabled: true }),
817
+ * ])
818
+ * return <List>
819
+ * {getChoiceMenuOptions()?.map((item, index) => {
820
+ * return (
821
+ * <ChoiceButton
822
+ * disabled={item.props.disabled}
823
+ * onClick={() => {
824
+ * afterSelectChoice(item)
825
+ * }}
826
+ * >
827
+ * {item.text}
828
+ * </ChoiceButton>
829
+ * )
830
+ * })}
831
+ * </List>
832
+ * ```
759
833
  */
760
834
  this.props = {};
761
835
  this.text = text;
@@ -813,21 +887,18 @@ function getChoiceMenuOptions() {
813
887
  d.forEach((option, index) => {
814
888
  if (option.type === Close) {
815
889
  let itemLabel = newCloseLabel(index);
816
- options.push({
817
- text: option.text,
818
- label: itemLabel,
819
- type: Close,
820
- closeCurrentLabel: option.closeCurrentLabel,
821
- props: {}
822
- });
890
+ let choice = new ChoiceMenuOptionClose(option.text, option.closeCurrentLabel);
891
+ choice.label = itemLabel;
892
+ options.push(choice);
823
893
  return;
824
894
  }
825
895
  let label = getLabelById(option.label);
826
896
  if (label) {
827
- let itemLabel = new Label(label.id, label.steps, label.onStepRun, index);
828
- options.push(__spreadProps(__spreadValues({}, option), {
829
- label: itemLabel
830
- }));
897
+ let itemLabel = new Label(label.id, label.steps, {
898
+ onStepStart: label.onStepStart,
899
+ choiseIndex: index
900
+ });
901
+ options.push(new ChoiceMenuOption(option.text, itemLabel, option.props, option.type));
831
902
  }
832
903
  });
833
904
  return options;
@@ -915,8 +986,9 @@ FadeAlphaTicker = __decorateClass([
915
986
  ], FadeAlphaTicker);
916
987
 
917
988
  // src/functions/TickerUtility.ts
918
- function updateTickerProgression(args, propertyName, progression) {
919
- if (args[propertyName] === void 0 || !progression || args[propertyName] === progression.limit) {
989
+ function updateTickerProgression(args, propertyName, progression, valueConvert) {
990
+ let limit = valueConvert && progression.limit ? valueConvert(progression.limit) : progression.limit;
991
+ if (args[propertyName] === void 0 || !progression || args[propertyName] === limit) {
920
992
  return;
921
993
  }
922
994
  if (typeof args[propertyName] === "number") {
@@ -935,22 +1007,25 @@ function updateTickerProgression(args, propertyName, progression) {
935
1007
  }
936
1008
  }
937
1009
  }
938
- function getLinearProgression(number, progression) {
939
- if (progression.limit !== void 0) {
940
- if (number > progression.limit && progression.amt > 0) {
941
- return progression.limit;
942
- } else if (number < progression.limit && progression.amt < 0) {
943
- return progression.limit;
1010
+ function getLinearProgression(number, progression, valueConvert) {
1011
+ let limit = valueConvert && progression.limit ? valueConvert(progression.limit) : progression.limit;
1012
+ let amt = valueConvert ? valueConvert(progression.amt) : progression.amt;
1013
+ if (limit !== void 0) {
1014
+ if (number > limit && amt > 0) {
1015
+ return limit;
1016
+ } else if (number < limit && amt < 0) {
1017
+ return limit;
944
1018
  }
945
1019
  }
946
- return number + progression.amt / 60;
1020
+ return number + amt;
947
1021
  }
948
- function getExponentialProgression(number, progression) {
949
- if (progression.limit !== void 0) {
950
- if (number > progression.limit && progression.percentage > 0) {
951
- return progression.limit;
952
- } else if (number < progression.limit && progression.percentage < 0) {
953
- return progression.limit;
1022
+ function getExponentialProgression(number, progression, valueConvert) {
1023
+ let limit = valueConvert && progression.limit ? valueConvert(progression.limit) : progression.limit;
1024
+ if (limit !== void 0) {
1025
+ if (number > limit && progression.percentage > 0) {
1026
+ return limit;
1027
+ } else if (number < limit && progression.percentage < 0) {
1028
+ return limit;
954
1029
  }
955
1030
  }
956
1031
  return number + number * progression.percentage;
@@ -963,15 +1038,13 @@ var MoveTicker = class extends TickerBase {
963
1038
  let ySpeed = 1;
964
1039
  if (args.speed) {
965
1040
  if (typeof args.speed === "number") {
966
- xSpeed = args.speed;
967
- ySpeed = args.speed;
1041
+ xSpeed = this.speedConvert(args.speed);
1042
+ ySpeed = this.speedConvert(args.speed);
968
1043
  } else {
969
- xSpeed = args.speed.x;
970
- ySpeed = args.speed.y;
1044
+ xSpeed = this.speedConvert(args.speed.x);
1045
+ ySpeed = this.speedConvert(args.speed.y);
971
1046
  }
972
1047
  }
973
- xSpeed /= 60;
974
- ySpeed /= 60;
975
1048
  let destination = args.destination;
976
1049
  let tagToRemoveAfter2 = args.tagToRemoveAfter || [];
977
1050
  if (typeof tagToRemoveAfter2 === "string") {
@@ -1011,7 +1084,10 @@ var MoveTicker = class extends TickerBase {
1011
1084
  }
1012
1085
  });
1013
1086
  if (args.speedProgression)
1014
- updateTickerProgression(args, "speed", args.speedProgression);
1087
+ updateTickerProgression(args, "speed", args.speedProgression, this.speedConvert);
1088
+ }
1089
+ speedConvert(speed) {
1090
+ return speed / 6;
1015
1091
  }
1016
1092
  };
1017
1093
  MoveTicker = __decorateClass([
@@ -1019,7 +1095,7 @@ MoveTicker = __decorateClass([
1019
1095
  ], MoveTicker);
1020
1096
  var RotateTicker = class extends TickerBase {
1021
1097
  fn(ticker, args, tags, tickerId) {
1022
- let speed = (args.speed === void 0 ? 1 : args.speed) / 60;
1098
+ let speed = this.speedConvert(args.speed === void 0 ? 1 : args.speed);
1023
1099
  let clockwise = args.clockwise === void 0 ? true : args.clockwise;
1024
1100
  let tagToRemoveAfter2 = args.tagToRemoveAfter || [];
1025
1101
  if (typeof tagToRemoveAfter2 === "string") {
@@ -1047,7 +1123,10 @@ var RotateTicker = class extends TickerBase {
1047
1123
  }
1048
1124
  });
1049
1125
  if (args.speedProgression)
1050
- updateTickerProgression(args, "speed", args.speedProgression);
1126
+ updateTickerProgression(args, "speed", args.speedProgression, this.speedConvert);
1127
+ }
1128
+ speedConvert(speed) {
1129
+ return speed / 60;
1051
1130
  }
1052
1131
  };
1053
1132
  RotateTicker = __decorateClass([
@@ -1059,15 +1138,13 @@ var ZoomTicker = class extends TickerBase {
1059
1138
  let ySpeed = 0.1;
1060
1139
  if (args.speed) {
1061
1140
  if (typeof args.speed === "number") {
1062
- xSpeed = args.speed;
1063
- ySpeed = args.speed;
1141
+ xSpeed = this.speedConvert(args.speed);
1142
+ ySpeed = this.speedConvert(args.speed);
1064
1143
  } else {
1065
- xSpeed = args.speed.x;
1066
- ySpeed = args.speed.y;
1144
+ xSpeed = this.speedConvert(args.speed.x);
1145
+ ySpeed = this.speedConvert(args.speed.y);
1067
1146
  }
1068
1147
  }
1069
- xSpeed /= 60;
1070
- ySpeed /= 60;
1071
1148
  let tagToRemoveAfter2 = args.tagToRemoveAfter || [];
1072
1149
  if (typeof tagToRemoveAfter2 === "string") {
1073
1150
  tagToRemoveAfter2 = [tagToRemoveAfter2];
@@ -1134,7 +1211,10 @@ var ZoomTicker = class extends TickerBase {
1134
1211
  }
1135
1212
  });
1136
1213
  if (args.speedProgression)
1137
- updateTickerProgression(args, "speed", args.speedProgression);
1214
+ updateTickerProgression(args, "speed", args.speedProgression, this.speedConvert);
1215
+ }
1216
+ speedConvert(speed) {
1217
+ return speed / 60;
1138
1218
  }
1139
1219
  onEndOfTicker(tag, tickerId, _element, tagToRemoveAfter2) {
1140
1220
  GameWindowManager.onEndOfTicker(tag, this, tagToRemoveAfter2, tickerId);
@@ -1157,6 +1237,7 @@ var ZoomInOutTicker = class extends ZoomTicker {
1157
1237
  };
1158
1238
 
1159
1239
  // src/constants.ts
1240
+ var PIXIVN_VERSION = "0.6.6";
1160
1241
  var Repeat = "repeat";
1161
1242
  function Pause(duration) {
1162
1243
  return {
@@ -1334,14 +1415,14 @@ function zoomIn(_0, _1) {
1334
1415
  } else {
1335
1416
  canvasElement = image;
1336
1417
  }
1337
- if (canvasElement instanceof CanvasImage && ((_a = canvasElement.texture) == null ? void 0 : _a.label) == "EMPTY") {
1338
- yield canvasElement.load();
1339
- }
1340
1418
  let container = new CanvasContainer();
1341
1419
  container.addChild(canvasElement);
1342
1420
  container.height = GameWindowManager.canvasHeight;
1343
1421
  container.width = GameWindowManager.canvasWidth;
1344
1422
  GameWindowManager.addCanvasElement(tag, container);
1423
+ if (canvasElement instanceof CanvasImage && ((_a = canvasElement.texture) == null ? void 0 : _a.label) == "EMPTY") {
1424
+ yield canvasElement.load();
1425
+ }
1345
1426
  if (props.direction == "up") {
1346
1427
  container.pivot.y = GameWindowManager.canvasHeight;
1347
1428
  container.pivot.x = GameWindowManager.canvasWidth / 2;
@@ -2363,6 +2444,16 @@ var _GameStepManager = class _GameStepManager {
2363
2444
  static set originalStepData(value) {
2364
2445
  _GameStepManager._originalStepData = createExportableElement(value);
2365
2446
  }
2447
+ static get currentStepData() {
2448
+ let currentStepData = {
2449
+ path: window.location.pathname,
2450
+ storage: GameStorageManager.export(),
2451
+ canvas: GameWindowManager.export(),
2452
+ labelIndex: _GameStepManager.currentLabelStepIndex || 0,
2453
+ openedLabels: createExportableElement(_GameStepManager._openedLabels)
2454
+ };
2455
+ return currentStepData;
2456
+ }
2366
2457
  /* Edit History Methods */
2367
2458
  /**
2368
2459
  * Add a label to the history.
@@ -2370,19 +2461,13 @@ var _GameStepManager = class _GameStepManager {
2370
2461
  */
2371
2462
  static addStepHistory(step, choiseMade) {
2372
2463
  let stepHistory = getStepSha1(step);
2373
- let historyStep = {
2374
- path: window.location.pathname,
2375
- storage: GameStorageManager.export(),
2376
- canvas: GameWindowManager.export(),
2377
- labelIndex: _GameStepManager.currentLabelStepIndex || 0,
2378
- openedLabels: createExportableElement(_GameStepManager._openedLabels)
2379
- };
2464
+ let currentStepData = _GameStepManager.currentStepData;
2380
2465
  if (_GameStepManager.originalStepData) {
2381
- if (_GameStepManager.originalStepData.openedLabels.length === historyStep.openedLabels.length) {
2466
+ if (_GameStepManager.originalStepData.openedLabels.length === currentStepData.openedLabels.length) {
2382
2467
  try {
2383
2468
  let lastStepDataOpenedLabelsString = JSON.stringify(_GameStepManager.originalStepData.openedLabels);
2384
- let historyStepOpenedLabelsString = JSON.stringify(historyStep.openedLabels);
2385
- if (lastStepDataOpenedLabelsString === historyStepOpenedLabelsString && _GameStepManager.originalStepData.path === historyStep.path && _GameStepManager.originalStepData.labelIndex === historyStep.labelIndex) {
2469
+ let historyStepOpenedLabelsString = JSON.stringify(currentStepData.openedLabels);
2470
+ if (lastStepDataOpenedLabelsString === historyStepOpenedLabelsString && _GameStepManager.originalStepData.path === currentStepData.path && _GameStepManager.originalStepData.labelIndex === currentStepData.labelIndex) {
2386
2471
  return;
2387
2472
  }
2388
2473
  } catch (e) {
@@ -2390,7 +2475,7 @@ var _GameStepManager = class _GameStepManager {
2390
2475
  }
2391
2476
  }
2392
2477
  }
2393
- let data = diff(_GameStepManager.originalStepData, historyStep);
2478
+ let data = diff(_GameStepManager.originalStepData, currentStepData);
2394
2479
  if (data) {
2395
2480
  let dialoge = void 0;
2396
2481
  let requiredChoices = void 0;
@@ -2409,7 +2494,7 @@ var _GameStepManager = class _GameStepManager {
2409
2494
  index: _GameStepManager.lastStepIndex,
2410
2495
  choiceIndexMade: choiseMade
2411
2496
  });
2412
- _GameStepManager.originalStepData = historyStep;
2497
+ _GameStepManager.originalStepData = currentStepData;
2413
2498
  }
2414
2499
  _GameStepManager.increaseLastStepIndex();
2415
2500
  }
@@ -2500,6 +2585,9 @@ var _GameStepManager = class _GameStepManager {
2500
2585
  console.warn("[Pixi'VN] The player must make a choice");
2501
2586
  return;
2502
2587
  }
2588
+ if (_GameStepManager.currentLabel && _GameStepManager.currentLabel.onStepEnd) {
2589
+ yield _GameStepManager.currentLabel.onStepEnd(_GameStepManager.currentLabelStepIndex || 0, _GameStepManager.currentLabel);
2590
+ }
2503
2591
  _GameStepManager.increaseCurrentStepIndex();
2504
2592
  return yield _GameStepManager.runCurrentStep(props, choiseMade);
2505
2593
  });
@@ -2524,6 +2612,10 @@ var _GameStepManager = class _GameStepManager {
2524
2612
  return;
2525
2613
  }
2526
2614
  if (currentLabel.steps.length > currentLabelStepIndex) {
2615
+ let onStepRun = currentLabel.onStepStart;
2616
+ if (onStepRun) {
2617
+ yield onStepRun(currentLabelStepIndex, currentLabel);
2618
+ }
2527
2619
  let step = currentLabel.steps[currentLabelStepIndex];
2528
2620
  let result = yield step(props);
2529
2621
  _GameStepManager.addStepHistory(step, choiseMade);
@@ -2588,6 +2680,9 @@ var _GameStepManager = class _GameStepManager {
2588
2680
  if (!tempLabel) {
2589
2681
  throw new Error(`[Pixi'VN] Label ${labelId} not found`);
2590
2682
  }
2683
+ if (_GameStepManager.currentLabel && _GameStepManager.currentLabel.onStepEnd) {
2684
+ yield _GameStepManager.currentLabel.onStepEnd(_GameStepManager.currentLabelStepIndex || 0, _GameStepManager.currentLabel);
2685
+ }
2591
2686
  _GameStepManager.pushNewLabel(tempLabel.id);
2592
2687
  } catch (e) {
2593
2688
  console.error("[Pixi'VN] Error calling label", e);
@@ -2646,6 +2741,9 @@ var _GameStepManager = class _GameStepManager {
2646
2741
  if (!tempLabel) {
2647
2742
  throw new Error(`[Pixi'VN] Label ${labelId} not found`);
2648
2743
  }
2744
+ if (_GameStepManager.currentLabel && _GameStepManager.currentLabel.onStepEnd) {
2745
+ yield _GameStepManager.currentLabel.onStepEnd(_GameStepManager.currentLabelStepIndex || 0, _GameStepManager.currentLabel);
2746
+ }
2649
2747
  _GameStepManager.pushNewLabel(tempLabel.id);
2650
2748
  } catch (e) {
2651
2749
  console.error("[Pixi'VN] Error jumping label", e);
@@ -2751,24 +2849,29 @@ var _GameStepManager = class _GameStepManager {
2751
2849
  * ```
2752
2850
  */
2753
2851
  static goBack(navigate, steps = 1) {
2754
- if (steps <= 0) {
2755
- console.warn("[Pixi'VN] Steps must be greater than 0");
2756
- return;
2757
- }
2758
- if (_GameStepManager._stepsHistory.length <= 1) {
2759
- console.warn("[Pixi'VN] No steps to go back");
2760
- return;
2761
- }
2762
- let restoredStep = _GameStepManager.goBackInternal(steps, _GameStepManager.originalStepData);
2763
- if (restoredStep) {
2764
- _GameStepManager._originalStepData = restoredStep;
2765
- _GameStepManager._openedLabels = createExportableElement(restoredStep.openedLabels);
2766
- GameStorageManager.import(createExportableElement(restoredStep.storage));
2767
- GameWindowManager.import(createExportableElement(restoredStep.canvas));
2768
- navigate(restoredStep.path);
2769
- } else {
2770
- console.error("[Pixi'VN] Error going back");
2771
- }
2852
+ return __async(this, null, function* () {
2853
+ if (steps <= 0) {
2854
+ console.warn("[Pixi'VN] Steps must be greater than 0");
2855
+ return;
2856
+ }
2857
+ if (_GameStepManager._stepsHistory.length <= 1) {
2858
+ console.warn("[Pixi'VN] No steps to go back");
2859
+ return;
2860
+ }
2861
+ let restoredStep = _GameStepManager.goBackInternal(steps, _GameStepManager.originalStepData);
2862
+ if (restoredStep) {
2863
+ _GameStepManager._originalStepData = restoredStep;
2864
+ _GameStepManager._openedLabels = createExportableElement(restoredStep.openedLabels);
2865
+ if (_GameStepManager.currentLabel && _GameStepManager.currentLabel.onLoadStep) {
2866
+ yield _GameStepManager.currentLabel.onLoadStep(_GameStepManager.currentLabelStepIndex || 0, _GameStepManager.currentLabel);
2867
+ }
2868
+ GameStorageManager.import(createExportableElement(restoredStep.storage));
2869
+ GameWindowManager.import(createExportableElement(restoredStep.canvas));
2870
+ navigate(restoredStep.path);
2871
+ } else {
2872
+ console.error("[Pixi'VN] Error going back");
2873
+ }
2874
+ });
2772
2875
  }
2773
2876
  static goBackInternal(steps, restoredStep) {
2774
2877
  if (steps <= 0) {
@@ -2830,38 +2933,45 @@ var _GameStepManager = class _GameStepManager {
2830
2933
  * @param dataString The history in a JSON string.
2831
2934
  */
2832
2935
  static importJson(dataString) {
2833
- _GameStepManager.import(JSON.parse(dataString));
2936
+ return __async(this, null, function* () {
2937
+ yield _GameStepManager.import(JSON.parse(dataString));
2938
+ });
2834
2939
  }
2835
2940
  /**
2836
2941
  * Import the history from an object.
2837
2942
  * @param data The history in an object.
2838
2943
  */
2839
2944
  static import(data) {
2840
- _GameStepManager.clear();
2841
- try {
2842
- if (data.hasOwnProperty("stepsHistory")) {
2843
- _GameStepManager._stepsHistory = data["stepsHistory"];
2844
- } else {
2845
- console.warn("[Pixi'VN] Could not import stepsHistory data, so will be ignored");
2846
- }
2847
- if (data.hasOwnProperty("openedLabels")) {
2848
- _GameStepManager._openedLabels = data["openedLabels"];
2849
- } else {
2850
- console.warn("[Pixi'VN] Could not import openedLabels data, so will be ignored");
2851
- }
2852
- if (data.hasOwnProperty("lastStepIndex")) {
2853
- _GameStepManager._lastStepIndex = data["lastStepIndex"];
2854
- } else {
2855
- console.warn("[Pixi'VN] Could not import lastStepIndex data, so will be ignored");
2856
- }
2857
- if (data.hasOwnProperty("originalStepData")) {
2858
- _GameStepManager._originalStepData = data["originalStepData"];
2859
- } else {
2860
- console.warn("[Pixi'VN] Could not import originalStepData data, so will be ignored");
2945
+ return __async(this, null, function* () {
2946
+ _GameStepManager.clear();
2947
+ try {
2948
+ if (data.hasOwnProperty("stepsHistory")) {
2949
+ _GameStepManager._stepsHistory = data["stepsHistory"];
2950
+ } else {
2951
+ console.warn("[Pixi'VN] Could not import stepsHistory data, so will be ignored");
2952
+ }
2953
+ if (data.hasOwnProperty("openedLabels")) {
2954
+ _GameStepManager._openedLabels = data["openedLabels"];
2955
+ } else {
2956
+ console.warn("[Pixi'VN] Could not import openedLabels data, so will be ignored");
2957
+ }
2958
+ if (data.hasOwnProperty("lastStepIndex")) {
2959
+ _GameStepManager._lastStepIndex = data["lastStepIndex"];
2960
+ } else {
2961
+ console.warn("[Pixi'VN] Could not import lastStepIndex data, so will be ignored");
2962
+ }
2963
+ if (data.hasOwnProperty("originalStepData")) {
2964
+ _GameStepManager._originalStepData = data["originalStepData"];
2965
+ } else {
2966
+ console.warn("[Pixi'VN] Could not import originalStepData data, so will be ignored");
2967
+ }
2968
+ if (_GameStepManager.currentLabel && _GameStepManager.currentLabel.onLoadStep) {
2969
+ yield _GameStepManager.currentLabel.onLoadStep(_GameStepManager.currentLabelStepIndex || 0, _GameStepManager.currentLabel);
2970
+ }
2971
+ } catch (e) {
2972
+ console.error("[Pixi'VN] Error importing data", e);
2861
2973
  }
2862
- } catch (e) {
2863
- console.error("[Pixi'VN] Error importing data", e);
2864
- }
2974
+ });
2865
2975
  }
2866
2976
  };
2867
2977
  /**
@@ -3037,7 +3147,7 @@ var DialogueBaseModel = class {
3037
3147
  var juliette = new CharacterBaseModel2("___pixivn_juliette___", {
3038
3148
  name: "Juliette",
3039
3149
  age: 25,
3040
- icon: "https://firebasestorage.googleapis.com/v0/b/pixi-vn.appspot.com/o/public%2Fcharacters%2Fjuliette-square.webp?alt=media&token=5856ae7b-d99e-4563-86ec-cbc48cc9c6b4",
3150
+ icon: "https://firebasestorage.googleapis.com/v0/b/pixi-vn.appspot.com/o/public%2Fcharacters%2Fjuliette-square.webp?alt=media",
3041
3151
  color: "#ac0086"
3042
3152
  });
3043
3153
  saveCharacter(juliette);
@@ -3082,10 +3192,16 @@ var baseCanvasElementTestLabel = newLabel(
3082
3192
  removeCanvasElement("container");
3083
3193
  setDialogue({
3084
3194
  character: juliette,
3085
- text: `Here's what's going to happen: I'm going to create some text elements with different styles and put them on the stage.
3195
+ text: `Here's what's going to happen: I'm going to create some CanvasText with different styles and put them on the stage.
3086
3196
  But it will generate a warn message, because the FillGradient or FillPattern has not yet been supported by the Pixi\u2019VN ( you can see the status of the issue here: [#76](https://github.com/DRincs-Productions/pixi-vn/issues/76)).`
3087
3197
  });
3088
- const basicText = new CanvasText({ text: "Basic text in pixi" });
3198
+ const basicStyle = new TextStyle({
3199
+ fill: "#ffffff"
3200
+ });
3201
+ const basicText = new CanvasText({
3202
+ text: "Basic text in pixi",
3203
+ style: basicStyle
3204
+ });
3089
3205
  basicText.x = 50;
3090
3206
  basicText.y = 100;
3091
3207
  GameWindowManager.addCanvasElement("basicText", basicText);
@@ -3103,7 +3219,7 @@ But it will generate a warn message, because the FillGradient or FillPattern has
3103
3219
  fill: { fill },
3104
3220
  stroke: { color: "#4a1850", width: 5, join: "round" },
3105
3221
  dropShadow: {
3106
- color: "#000000",
3222
+ color: "#ff5f74",
3107
3223
  blur: 4,
3108
3224
  angle: Math.PI / 6,
3109
3225
  distance: 6
@@ -3156,36 +3272,30 @@ EventTest1 = __decorateClass([
3156
3272
  eventDecorator("___pixi_vn_canvas_events_test_event1___")
3157
3273
  ], EventTest1);
3158
3274
  var EventTest2 = class extends CanvasEvent {
3159
- constructor() {
3160
- super(...arguments);
3161
- this.textureButtonDown = Texture.from("https://pixijs.com/assets/button_down.png");
3162
- this.textureButtonOver = Texture.from("https://pixijs.com/assets/button_over.png");
3163
- this.textureButton = Texture.from("https://pixijs.com/assets/button.png");
3164
- }
3165
3275
  fn(event, sprite) {
3166
3276
  if (event === "pointerdown") {
3167
3277
  sprite.isdown = true;
3168
- sprite.texture = this.textureButtonDown;
3278
+ sprite.texture = Texture.from("https://pixijs.com/assets/button_down.png");
3169
3279
  sprite.alpha = 1;
3170
3280
  } else if (event === "pointerup" || event === "pointerupoutside") {
3171
3281
  sprite.isdown = false;
3172
3282
  if (sprite.isOver) {
3173
- sprite.texture = this.textureButtonOver;
3283
+ sprite.texture = Texture.from("https://pixijs.com/assets/button_over.png");
3174
3284
  } else {
3175
- sprite.texture = this.textureButton;
3285
+ sprite.texture = Texture.from("https://pixijs.com/assets/button.png");
3176
3286
  }
3177
3287
  } else if (event === "pointerover") {
3178
3288
  sprite.isOver = true;
3179
3289
  if (sprite.isdown) {
3180
3290
  return;
3181
3291
  }
3182
- sprite.texture = this.textureButtonOver;
3292
+ sprite.texture = Texture.from("https://pixijs.com/assets/button_over.png");
3183
3293
  } else if (event === "pointerout") {
3184
3294
  sprite.isOver = false;
3185
3295
  if (sprite.isdown) {
3186
3296
  return;
3187
3297
  }
3188
- sprite.texture = this.textureButton;
3298
+ sprite.texture = Texture.from("https://pixijs.com/assets/button.png");
3189
3299
  }
3190
3300
  }
3191
3301
  };
@@ -3207,6 +3317,7 @@ var canvasEventsTestLabel = newLabel(
3207
3317
  });
3208
3318
  const texture = yield Assets.load(bunnyImage);
3209
3319
  const sprite = CanvasSprite.from(texture);
3320
+ sprite.scale.set(3);
3210
3321
  sprite.anchor.set(0.5);
3211
3322
  sprite.x = GameWindowManager.screen.width / 2;
3212
3323
  sprite.y = GameWindowManager.screen.height / 2;
@@ -3222,12 +3333,11 @@ var canvasEventsTestLabel = newLabel(
3222
3333
  text: `This is the test of buttons in a canvas. (This example is from the official [PixiJS website](https://pixijs.com/8.x/examples/events/interactivity).)`
3223
3334
  });
3224
3335
  const backgroundT = yield Assets.load("https://pixijs.com/assets/bg_button.jpg");
3225
- const background = CanvasSprite.from(backgroundT);
3336
+ const background = new CanvasSprite(backgroundT);
3226
3337
  background.width = GameWindowManager.screen.width;
3227
3338
  background.height = GameWindowManager.screen.height;
3228
3339
  GameWindowManager.addCanvasElement("bg", background);
3229
- const textureButtonT = yield Assets.load("https://pixijs.com/assets/button.png");
3230
- const textureButton = CanvasSprite.from(textureButtonT);
3340
+ const textureButton = yield Assets.load("https://pixijs.com/assets/button.png");
3231
3341
  const buttons = [];
3232
3342
  const buttonPositions = [175, 75, 655, 75, 410, 325, 150, 465, 685, 445];
3233
3343
  for (let i = 0; i < 5; i++) {
@@ -3247,7 +3357,17 @@ var canvasEventsTestLabel = newLabel(
3247
3357
  buttons[4].scale.set(0.8, 1.2);
3248
3358
  buttons[4].rotation = Math.PI;
3249
3359
  })
3250
- ]
3360
+ ],
3361
+ {
3362
+ onLoadStep: () => __async(void 0, null, function* () {
3363
+ yield Assets.load([
3364
+ "https://pixijs.com/assets/bg_button.jpg",
3365
+ "https://pixijs.com/assets/button.png",
3366
+ "https://pixijs.com/assets/button_down.png",
3367
+ "https://pixijs.com/assets/button_over.png"
3368
+ ]);
3369
+ })
3370
+ }
3251
3371
  );
3252
3372
  var AlienTintingTest = class extends CanvasSprite {
3253
3373
  constructor() {
@@ -3367,13 +3487,13 @@ var imagesAnimationsTest = newLabel(IMAGE_ANIMAIONS_TEST_LABEL, [
3367
3487
  () => __async(void 0, null, function* () {
3368
3488
  setDialogue({ character: juliette, text: "Here's what they can do." });
3369
3489
  setChoiceMenuOptions([
3370
- new ChoiceMenuOption("Dissolve effect", imagesDissolveTest),
3371
- new ChoiceMenuOption("Fade effect", imagesFadeTest),
3372
- new ChoiceMenuOption("Rotate", imagesRotateTest),
3373
- new ChoiceMenuOption("Move", imagesMoveTest),
3374
- new ChoiceMenuOption("Zoom", imagesZoomTest),
3375
- new ChoiceMenuOption("Move in/out", imagesMoveInOutTest),
3376
- new ChoiceMenuOption("Zoom in/out", imagesZoomInOutTest),
3490
+ new ChoiceMenuOption("Dissolve effect", imagesDissolveTest, {}),
3491
+ new ChoiceMenuOption("Fade effect", imagesFadeTest, {}),
3492
+ new ChoiceMenuOption("Rotate", imagesRotateTest, {}),
3493
+ new ChoiceMenuOption("Move", imagesMoveTest, {}),
3494
+ new ChoiceMenuOption("Zoom", imagesZoomTest, {}),
3495
+ new ChoiceMenuOption("Move in/out", imagesMoveInOutTest, {}),
3496
+ new ChoiceMenuOption("Zoom in/out", imagesZoomInOutTest, {}),
3377
3497
  new ChoiceMenuOptionClose("Cancel", true)
3378
3498
  ]);
3379
3499
  }),
@@ -3483,8 +3603,8 @@ var imagesRotateTest = newLabel("___pixi_vn_images_rotate_test___", [
3483
3603
  text: `Here's what's going to happen:
3484
3604
  - ${eggHeadName} will rotate with a anchor set to 0.
3485
3605
  - ${flowerTopName} will rotate with a anchor set to 0.5 and a exponential speed progression.
3486
- - ${helmlokName} will rotate with a anchor set to 0.5, rotate 2 times, move to the right, rotate 5 times, and repeat.
3487
- - ${skullyName} will rotate with a anchor set to 1, rotate 3 times, wait for 0.5 seconds, rotate 7 times.`
3606
+ - ${helmlokName} will rotate with a anchor set to 0.5, rotate clockwise for 2 seconds, rotate counterclockwise with a exponential (-0.05) speed progression, and when it reaches 0, it will repeat.
3607
+ - ${skullyName} will rotate with a anchor set to 1, rotate 3 seconds clockwise, wait for 0.5 seconds, and rotate 7 seconds counterclockwise.`
3488
3608
  });
3489
3609
  let eggHead = GameWindowManager.getCanvasElement("eggHead");
3490
3610
  if (eggHead)
@@ -3537,10 +3657,10 @@ var imagesMoveTest = newLabel("___pixi_vn_images_move_test___", [
3537
3657
  setDialogue({
3538
3658
  character: juliette,
3539
3659
  text: `Here's what's going to happen:
3540
- - ${eggHeadName} will move to { x: 500, y: 100 } with a speed of 0.4.
3541
- - ${flowerTopName} will move to { x: 500, y: 300 } with a speed of 0.3.
3542
- - ${helmlokName} will move to the right with a speed of 20 and a linear speed progression of -0.2, and then move to the left with a speed of 0.1 and a linear speed progression of 0.05.
3543
- - ${skullyName} will move to { x: 500, y: 500 } with a speed of 0.5, wait for 0.5 seconds, and move to { x: 100, y: 100 } with a speed of 0.5.`
3660
+ - ${eggHeadName} will move to { x: 500, y: 100 } with a speed of 24.
3661
+ - ${flowerTopName} will move to { x: 500, y: 300 } with a speed of 18.
3662
+ - ${helmlokName} will move to { x: 100, y: 500 } with a speed of 150 and a linear speed progression of -2 ( limit 10 ), and then move to { x: 1700, y: 500 } with a speed of 10 and a linear speed progression of 2 ( limit 150 ), and repeat.
3663
+ - ${skullyName} will move to { x: 500, y: 500 } with a speed of 40, wait for 0.5 seconds, and move to { x: 100, y: 100 } with a speed of 40.`
3544
3664
  });
3545
3665
  GameWindowManager.addTicker("eggHead", new MoveTicker({
3546
3666
  destination: { x: 500, y: 100 },
@@ -3553,25 +3673,25 @@ var imagesMoveTest = newLabel("___pixi_vn_images_move_test___", [
3553
3673
  GameWindowManager.addTickersSteps("helmlok", [
3554
3674
  new MoveTicker({
3555
3675
  destination: { x: 100, y: 500 },
3556
- speed: 1200,
3557
- speedProgression: { type: "linear", amt: -12, limit: 60 }
3676
+ speed: 150,
3677
+ speedProgression: { type: "linear", amt: -2, limit: 10 }
3558
3678
  }),
3559
3679
  new MoveTicker({
3560
3680
  destination: { x: 1700, y: 500 },
3561
- speed: 6,
3562
- speedProgression: { type: "linear", amt: 3 }
3681
+ speed: 10,
3682
+ speedProgression: { type: "linear", amt: 2, limit: 150 }
3563
3683
  }),
3564
3684
  Repeat
3565
3685
  ]);
3566
3686
  GameWindowManager.addTickersSteps("skully", [
3567
3687
  new MoveTicker({
3568
3688
  destination: { x: 500, y: 500 },
3569
- speed: 60
3689
+ speed: 40
3570
3690
  }),
3571
3691
  Pause(0.5),
3572
3692
  new MoveTicker({
3573
3693
  destination: { x: 100, y: 100 },
3574
- speed: 60
3694
+ speed: 40
3575
3695
  })
3576
3696
  ]);
3577
3697
  }
@@ -3633,37 +3753,45 @@ var imagesMoveInOutTest = newLabel("___pixi_vn_images_move_in_out_test___", [
3633
3753
  setDialogue({
3634
3754
  character: juliette,
3635
3755
  text: `Here's what's going to happen:
3636
- - ${eggHeadName} will move in from the top with a speed of 800. If you go next, ${eggHeadName} will move out from the bottom with a speed of 800.
3637
- - ${flowerTopName} will move in from the right with a speed of 800 and a speed progression of 0.02. If you go next, ${flowerTopName} will move out from the left with a speed of 800 and a speed progression of 0.02.
3638
- - ${helmlokName} will move in from the left with a speed of 800. If you go next, ${helmlokName} will move out from the right with a speed of 800.
3639
- - ${skullyName} will move in from the bottom with a speed of 800 and a speed progression of 0.02. If you go next, ${skullyName} will move out from the top with a speed of 800 and a speed progression of 0.02.`
3756
+ - ${eggHeadName} will move in from the top with a speed of 80. If you go next, ${eggHeadName} will move out from the bottom with a speed of 80.
3757
+ - ${flowerTopName} will move in from the right with a speed of 80 and a speed progression of 0.02. If you go next, ${flowerTopName} will move out from the left with a speed of 80 and a speed progression of 0.02.
3758
+ - ${helmlokName} will move in from the left with a speed of 80. If you go next, ${helmlokName} will move out from the right with a speed of 80.
3759
+ - ${skullyName} will move in from the bottom with a speed of 80 and a speed progression of 0.02. If you go next, ${skullyName} will move out from the top with a speed of 80 and a speed progression of 0.02.`
3640
3760
  });
3641
3761
  let eggHead = new CanvasImage({ x: 100, y: 100 }, eggHeadImage);
3642
3762
  let flowerTop = new CanvasImage({ x: 300, y: 100 }, flowerTopImage);
3643
3763
  let helmlok = new CanvasImage({ x: 100, y: 300 }, helmlokImage);
3644
3764
  let skully = new CanvasImage({ x: 300, y: 300 }, skullyImage);
3645
- moveIn("eggHead", eggHead, { speed: 800, direction: "down" });
3765
+ moveIn("eggHead", eggHead, { speed: 80, direction: "down" });
3646
3766
  moveIn("flowerTop", flowerTop, {
3647
- speed: 800,
3767
+ speed: 80,
3648
3768
  direction: "left",
3649
3769
  speedProgression: { type: "exponential", percentage: 0.02 }
3650
3770
  });
3651
- moveIn("helmlok", helmlok, { speed: 800, direction: "right" });
3771
+ moveIn("helmlok", helmlok, { speed: 80, direction: "right" });
3652
3772
  moveIn("skully", skully, {
3653
- speed: 800,
3773
+ speed: 80,
3654
3774
  direction: "up",
3655
3775
  speedProgression: { type: "exponential", percentage: 0.02 }
3656
3776
  });
3657
3777
  }),
3658
3778
  () => {
3659
- moveOut("eggHead", { speed: 800, direction: "down" });
3660
- moveOut("flowerTop", { speed: 800, direction: "left" });
3661
- moveOut("helmlok", { speed: 800, direction: "right" });
3662
- moveOut("skully", { speed: 800, direction: "up" });
3779
+ moveOut("eggHead", { speed: 80, direction: "down" });
3780
+ moveOut("flowerTop", { speed: 80, direction: "left" });
3781
+ moveOut("helmlok", { speed: 80, direction: "right" });
3782
+ moveOut("skully", { speed: 80, direction: "up" });
3663
3783
  }
3664
3784
  ]);
3665
3785
  var imagesZoomInOutTest = newLabel("___pixi_vn_images_zoom_in_out_test___", [
3666
3786
  () => __async(void 0, null, function* () {
3787
+ setDialogue({
3788
+ character: juliette,
3789
+ text: `Here's what's going to happen:
3790
+ - ${eggHeadName} will zoom in with a speed of 3. If you go next, ${eggHeadName} will zoom out with a speed of 3.
3791
+ - ${flowerTopName} will zoom in with a speed of 3 and a speed progression of 0.02. If you go next, ${flowerTopName} will zoom out with a speed of 3.
3792
+ - ${helmlokName} will zoom in with a speed of 3. If you go next, ${helmlokName} will zoom out with a speed of 1.
3793
+ - ${skullyName} will zoom in with a speed of 3 and a speed progression of 0.02. If you go next, ${skullyName} will zoom out with a speed of 3 and a speed progression of 0.02.`
3794
+ });
3667
3795
  GameWindowManager.removeCanvasElements();
3668
3796
  let eggHead = new CanvasImage({ x: 100, y: 100 }, eggHeadImage);
3669
3797
  let flowerTop = new CanvasImage({ x: 300, y: 100 }, flowerTopImage);
@@ -3689,7 +3817,7 @@ var imagesZoomInOutTest = newLabel("___pixi_vn_images_zoom_in_out_test___", [
3689
3817
  speedProgression: { type: "exponential", percentage: 0.02 }
3690
3818
  });
3691
3819
  zoomOut("flowerTop", { speed: 3, direction: "left" });
3692
- zoomOut("helmlok", { speed: 3, direction: "right" });
3820
+ zoomOut("helmlok", { speed: 1, direction: "right" });
3693
3821
  zoomOut("skully", {
3694
3822
  speed: 3,
3695
3823
  direction: "up",
@@ -3771,6 +3899,23 @@ Footer
3771
3899
  })
3772
3900
  ]);
3773
3901
 
3902
+ // src/labels/StepLabelTest.ts
3903
+ var STEP_LABEL_TEST_LABEL = "___pixi_vn_step_label_test___";
3904
+ var stepLabelTestLAbel = newLabel(STEP_LABEL_TEST_LABEL, [
3905
+ () => __async(void 0, null, function* () {
3906
+ setDialogue({ character: juliette, text: `Pixi'VN manages the succession of "screens" with steps. Each step is a function that can be asynchronous.` });
3907
+ }),
3908
+ () => __async(void 0, null, function* () {
3909
+ setDialogue({ character: juliette, text: "The labels are containers of steps, they are used to organize the steps in a more readable way. For start a steps sequence, you must call or jump to a label." });
3910
+ }),
3911
+ () => __async(void 0, null, function* () {
3912
+ setDialogue({ character: juliette, text: "It is also possible to ask the player to make a choice." });
3913
+ }),
3914
+ () => __async(void 0, null, function* () {
3915
+ setDialogue({ character: juliette, text: "Browsing through available tests is one way to test the steps/labels system." });
3916
+ })
3917
+ ]);
3918
+
3774
3919
  // src/labels/StartLabel.ts
3775
3920
  var pixivnTestStartLabel = newLabel(
3776
3921
  "___pixi_vn_example_start_label___",
@@ -3779,25 +3924,25 @@ var pixivnTestStartLabel = newLabel(
3779
3924
  let currentTimeName = "";
3780
3925
  const hour = (/* @__PURE__ */ new Date()).getHours();
3781
3926
  if (hour >= 5 && hour < 12) {
3782
- currentTimeName = "morning";
3927
+ currentTimeName = "morning\u{1F505}";
3783
3928
  } else if (hour >= 12 && hour < 18) {
3784
- currentTimeName = "afternoon";
3929
+ currentTimeName = "afternoon\u{1F506}";
3785
3930
  } else if (hour >= 18 && hour < 22) {
3786
- currentTimeName = "evening";
3931
+ currentTimeName = "evening\u26C5";
3787
3932
  } else {
3788
- currentTimeName = "night";
3933
+ currentTimeName = "night\u{1F319}";
3789
3934
  }
3790
3935
  setDialogue({ character: juliette, text: `Good ${currentTimeName}! I'm ${juliette.name}, your virtual assistant. I'm here to help you with your tests.` });
3791
3936
  },
3792
- () => setDialogue({ character: juliette, text: `You are running the Pixi\u2019VN test. This test will guide you through the different features of the library.` }),
3937
+ () => setDialogue({ character: juliette, text: `You are running the Pixi\u2019VN v${PIXIVN_VERSION} test. This test will guide you through the different features of the library.` }),
3793
3938
  (props) => GameStepManager.jumpLabel(pixivnTestStartLabel2, props)
3794
3939
  ]
3795
3940
  );
3796
- var openWiki = newLabel(
3797
- "___pixi_vn_open_wiki___",
3941
+ var openLink = newLabel(
3942
+ "___pixi_vn_open_link___",
3798
3943
  [
3799
3944
  (props) => {
3800
- window.open("https://pixi-vn.web.app/");
3945
+ window.open(props.link);
3801
3946
  GameStepManager.goNext(props);
3802
3947
  }
3803
3948
  ]
@@ -3810,12 +3955,14 @@ var pixivnTestStartLabel2 = newLabel(
3810
3955
  GameWindowManager.clear();
3811
3956
  setDialogue({ character: juliette, text: "Which test would you like to start with?" });
3812
3957
  setChoiceMenuOptions([
3813
- new ChoiceMenuOption("Open Pixi\u2019VN Wiki", openWiki),
3814
- new ChoiceMenuOption("Images, Transitions and Animations Test", imagesAnimationsTest),
3815
- new ChoiceMenuOption("Canvas Events Test Label", canvasEventsTestLabel),
3816
- new ChoiceMenuOption("Base Canvas Element Test", baseCanvasElementTestLabel),
3817
- new ChoiceMenuOption("Custom Ticker Canvas Element Test", customTickerCanvasElementTestLabel),
3818
- new ChoiceMenuOption("Markdown Test", markdownTest)
3958
+ new ChoiceMenuOption("Open Pixi\u2019VN Wiki", openLink, { link: "https://pixi-vn.web.app/" }),
3959
+ new ChoiceMenuOption("Images, Transitions and Animations Test", imagesAnimationsTest, {}),
3960
+ new ChoiceMenuOption("Canvas Events Test", canvasEventsTestLabel, {}),
3961
+ new ChoiceMenuOption("Base Canvas Element Test", baseCanvasElementTestLabel, {}),
3962
+ new ChoiceMenuOption("Custom Ticker Canvas Element Test", customTickerCanvasElementTestLabel, {}),
3963
+ new ChoiceMenuOption("Steps and Labels Test", stepLabelTestLAbel, {}),
3964
+ new ChoiceMenuOption("Markdown Test", markdownTest, {}),
3965
+ new ChoiceMenuOption("Open Pixi\u2019VN Github Issues", openLink, { link: "https://github.com/DRincs-Productions/pixi-vn/issues" })
3819
3966
  ]);
3820
3967
  },
3821
3968
  (props) => GameStepManager.jumpLabel(RESTART_TEST_LABEL, props)