@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/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { Container, Sprite, Text, Assets, Texture, Application, FillGradient, Color, TextStyle, Rectangle } from 'pixi.js';
1
+ import { Container, Sprite, Text, Assets, Texture, Application, TextStyle, FillGradient, Color, Rectangle } from 'pixi.js';
2
2
  export { Assets } from 'pixi.js';
3
3
  import { diff } from 'deep-diff';
4
4
  import sha1 from 'crypto-js/sha1';
@@ -78,14 +78,15 @@ var Label = class {
78
78
  /**
79
79
  * @param id is the id of the label
80
80
  * @param steps is the list of steps that the label will perform
81
- * @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
82
- * @param choiseIndex is the index of the choice that the label will perform
81
+ * @param props is the properties of the label
83
82
  */
84
- constructor(id, steps, onStepRun, choiseIndex) {
83
+ constructor(id, steps, props) {
85
84
  this._id = id;
86
85
  this._steps = steps;
87
- this._onStepRun = onStepRun;
88
- this._choiseIndex = choiseIndex;
86
+ this._onStepStart = props == null ? void 0 : props.onStepStart;
87
+ this._onLoadStep = props == null ? void 0 : props.onLoadStep;
88
+ this._onStepEnd = props == null ? void 0 : props.onStepEnd;
89
+ this._choiseIndex = props == null ? void 0 : props.choiseIndex;
89
90
  }
90
91
  /**
91
92
  * Get the id of the label. This variable is used in the system to get the label by id, {@link getLabelById}
@@ -122,18 +123,32 @@ var Label = class {
122
123
  return res;
123
124
  }
124
125
  /**
125
- * 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
126
+ * 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.
127
+ * @returns Promise<void> or void
128
+ */
129
+ get onStepStart() {
130
+ return (stepIndex, label) => __async(this, null, function* () {
131
+ if (this._onLoadStep) {
132
+ yield this._onLoadStep(stepIndex, label);
133
+ }
134
+ if (this._onStepStart) {
135
+ return yield this._onStepStart(stepIndex, label);
136
+ }
137
+ });
138
+ }
139
+ /**
140
+ * 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.
141
+ * @returns Promise<void> or void
142
+ */
143
+ get onLoadStep() {
144
+ return this._onLoadStep;
145
+ }
146
+ /**
147
+ * Is a function that will be executed when the step ends.
126
148
  * @returns Promise<void> or void
127
- * @example
128
- * ```typescript
129
- * newLabel("id", [], () => {
130
- * Assets.load('path/to/image1.png')
131
- * Assets.load('path/to/image2.png')
132
- * })
133
- * ```
134
149
  */
135
- get onStepRun() {
136
- return this._onStepRun;
150
+ get onStepEnd() {
151
+ return this._onStepEnd;
137
152
  }
138
153
  get choiseIndex() {
139
154
  return this._choiseIndex;
@@ -143,16 +158,18 @@ var Label = class {
143
158
  // src/classes/CloseLabel.ts
144
159
  var CLOSE_LABEL_ID = "__close-label-id__";
145
160
  function newCloseLabel(choiseIndex) {
146
- return new Label(CLOSE_LABEL_ID, [], void 0, choiseIndex);
161
+ return new Label(CLOSE_LABEL_ID, [], {
162
+ choiseIndex
163
+ });
147
164
  }
148
165
 
149
166
  // src/decorators/LabelDecorator.ts
150
167
  var registeredLabels = {};
151
- function newLabel(id, steps, onStepRun) {
168
+ function newLabel(id, steps, props) {
152
169
  if (registeredLabels[id]) {
153
170
  console.info(`[Pixi'VN] Label ${id} already exists, it will be overwritten`);
154
171
  }
155
- let label = new Label(id, steps, onStepRun);
172
+ let label = new Label(id, steps, props);
156
173
  registeredLabels[id] = label;
157
174
  return label;
158
175
  }
@@ -262,8 +279,6 @@ function getMemoryContainer(element) {
262
279
  };
263
280
  }
264
281
  function setMemoryContainer(element, memory) {
265
- memory.width && (element.width = memory.width);
266
- memory.height && (element.height = memory.height);
267
282
  memory.isRenderGroup && (element.isRenderGroup = memory.isRenderGroup);
268
283
  memory.blendMode && (element.blendMode = memory.blendMode);
269
284
  memory.tint && (element.tint = memory.tint);
@@ -296,6 +311,8 @@ function setMemoryContainer(element, memory) {
296
311
  memory.interactive && (element.interactive = memory.interactive);
297
312
  memory.interactiveChildren && (element.interactiveChildren = memory.interactiveChildren);
298
313
  memory.hitArea && (element.hitArea = memory.hitArea);
314
+ memory.width && (element.width = memory.width);
315
+ memory.height && (element.height = memory.height);
299
316
  }
300
317
  function getTexture(imageUrl) {
301
318
  return __async(this, null, function* () {
@@ -757,12 +774,32 @@ var ChoiceMenuOption = class {
757
774
  /**
758
775
  * @param text Text to be displayed in the menu
759
776
  * @param label Label to be opened when the option is selected or the id of the label
777
+ * @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.
760
778
  * @param type Type of the label to be opened. @default "call"
761
- * @param props Properties to be passed to the label, when the label is called. it cannot contain functions or classes. @default {}
762
779
  */
763
- constructor(text, label, type = "call", props) {
780
+ constructor(text, label, props, type = "call") {
764
781
  /**
765
- * Properties to be passed to the label
782
+ * Properties to be passed to the label and olther parameters that you can use when get all the choice menu options.
783
+ * @example
784
+ * ```tsx
785
+ * setChoiceMenuOptions([
786
+ * new ChoiceMenuOption("Hello", helloLabel, { disabled: true }),
787
+ * ])
788
+ * return <List>
789
+ * {getChoiceMenuOptions()?.map((item, index) => {
790
+ * return (
791
+ * <ChoiceButton
792
+ * disabled={item.props.disabled}
793
+ * onClick={() => {
794
+ * afterSelectChoice(item)
795
+ * }}
796
+ * >
797
+ * {item.text}
798
+ * </ChoiceButton>
799
+ * )
800
+ * })}
801
+ * </List>
802
+ * ```
766
803
  */
767
804
  this.props = {};
768
805
  if (typeof label === "string") {
@@ -796,7 +833,27 @@ var ChoiceMenuOptionClose = class {
796
833
  */
797
834
  this.type = Close;
798
835
  /**
799
- * Properties to be passed to the label
836
+ * Properties to be passed to the label and olther parameters that you can use when get all the choice menu options.
837
+ * @example
838
+ * ```tsx
839
+ * setChoiceMenuOptions([
840
+ * new ChoiceMenuOption("Hello", helloLabel, { disabled: true }),
841
+ * ])
842
+ * return <List>
843
+ * {getChoiceMenuOptions()?.map((item, index) => {
844
+ * return (
845
+ * <ChoiceButton
846
+ * disabled={item.props.disabled}
847
+ * onClick={() => {
848
+ * afterSelectChoice(item)
849
+ * }}
850
+ * >
851
+ * {item.text}
852
+ * </ChoiceButton>
853
+ * )
854
+ * })}
855
+ * </List>
856
+ * ```
800
857
  */
801
858
  this.props = {};
802
859
  this.text = text;
@@ -868,7 +925,10 @@ function getChoiceMenuOptions() {
868
925
  }
869
926
  let label = getLabelById(option.label);
870
927
  if (label) {
871
- let itemLabel = new Label(label.id, label.steps, label.onStepRun, index);
928
+ let itemLabel = new Label(label.id, label.steps, {
929
+ onStepStart: label.onStepStart,
930
+ choiseIndex: index
931
+ });
872
932
  options.push(__spreadProps(__spreadValues({}, option), {
873
933
  label: itemLabel
874
934
  }));
@@ -1024,8 +1084,9 @@ FadeAlphaTicker = __decorateClass([
1024
1084
  ], FadeAlphaTicker);
1025
1085
 
1026
1086
  // src/functions/TickerUtility.ts
1027
- function updateTickerProgression(args, propertyName, progression) {
1028
- if (args[propertyName] === void 0 || !progression || args[propertyName] === progression.limit) {
1087
+ function updateTickerProgression(args, propertyName, progression, valueConvert) {
1088
+ let limit = valueConvert && progression.limit ? valueConvert(progression.limit) : progression.limit;
1089
+ if (args[propertyName] === void 0 || !progression || args[propertyName] === limit) {
1029
1090
  return;
1030
1091
  }
1031
1092
  if (typeof args[propertyName] === "number") {
@@ -1044,22 +1105,25 @@ function updateTickerProgression(args, propertyName, progression) {
1044
1105
  }
1045
1106
  }
1046
1107
  }
1047
- function getLinearProgression(number, progression) {
1048
- if (progression.limit !== void 0) {
1049
- if (number > progression.limit && progression.amt > 0) {
1050
- return progression.limit;
1051
- } else if (number < progression.limit && progression.amt < 0) {
1052
- return progression.limit;
1108
+ function getLinearProgression(number, progression, valueConvert) {
1109
+ let limit = valueConvert && progression.limit ? valueConvert(progression.limit) : progression.limit;
1110
+ let amt = valueConvert ? valueConvert(progression.amt) : progression.amt;
1111
+ if (limit !== void 0) {
1112
+ if (number > limit && amt > 0) {
1113
+ return limit;
1114
+ } else if (number < limit && amt < 0) {
1115
+ return limit;
1053
1116
  }
1054
1117
  }
1055
- return number + progression.amt / 60;
1118
+ return number + amt;
1056
1119
  }
1057
- function getExponentialProgression(number, progression) {
1058
- if (progression.limit !== void 0) {
1059
- if (number > progression.limit && progression.percentage > 0) {
1060
- return progression.limit;
1061
- } else if (number < progression.limit && progression.percentage < 0) {
1062
- return progression.limit;
1120
+ function getExponentialProgression(number, progression, valueConvert) {
1121
+ let limit = valueConvert && progression.limit ? valueConvert(progression.limit) : progression.limit;
1122
+ if (limit !== void 0) {
1123
+ if (number > limit && progression.percentage > 0) {
1124
+ return limit;
1125
+ } else if (number < limit && progression.percentage < 0) {
1126
+ return limit;
1063
1127
  }
1064
1128
  }
1065
1129
  return number + number * progression.percentage;
@@ -1072,15 +1136,13 @@ var MoveTicker = class extends TickerBase {
1072
1136
  let ySpeed = 1;
1073
1137
  if (args.speed) {
1074
1138
  if (typeof args.speed === "number") {
1075
- xSpeed = args.speed;
1076
- ySpeed = args.speed;
1139
+ xSpeed = this.speedConvert(args.speed);
1140
+ ySpeed = this.speedConvert(args.speed);
1077
1141
  } else {
1078
- xSpeed = args.speed.x;
1079
- ySpeed = args.speed.y;
1142
+ xSpeed = this.speedConvert(args.speed.x);
1143
+ ySpeed = this.speedConvert(args.speed.y);
1080
1144
  }
1081
1145
  }
1082
- xSpeed /= 60;
1083
- ySpeed /= 60;
1084
1146
  let destination = args.destination;
1085
1147
  let tagToRemoveAfter2 = args.tagToRemoveAfter || [];
1086
1148
  if (typeof tagToRemoveAfter2 === "string") {
@@ -1120,7 +1182,10 @@ var MoveTicker = class extends TickerBase {
1120
1182
  }
1121
1183
  });
1122
1184
  if (args.speedProgression)
1123
- updateTickerProgression(args, "speed", args.speedProgression);
1185
+ updateTickerProgression(args, "speed", args.speedProgression, this.speedConvert);
1186
+ }
1187
+ speedConvert(speed) {
1188
+ return speed / 6;
1124
1189
  }
1125
1190
  };
1126
1191
  MoveTicker = __decorateClass([
@@ -1128,7 +1193,7 @@ MoveTicker = __decorateClass([
1128
1193
  ], MoveTicker);
1129
1194
  var RotateTicker = class extends TickerBase {
1130
1195
  fn(ticker, args, tags, tickerId) {
1131
- let speed = (args.speed === void 0 ? 1 : args.speed) / 60;
1196
+ let speed = this.speedConvert(args.speed === void 0 ? 1 : args.speed);
1132
1197
  let clockwise = args.clockwise === void 0 ? true : args.clockwise;
1133
1198
  let tagToRemoveAfter2 = args.tagToRemoveAfter || [];
1134
1199
  if (typeof tagToRemoveAfter2 === "string") {
@@ -1156,7 +1221,10 @@ var RotateTicker = class extends TickerBase {
1156
1221
  }
1157
1222
  });
1158
1223
  if (args.speedProgression)
1159
- updateTickerProgression(args, "speed", args.speedProgression);
1224
+ updateTickerProgression(args, "speed", args.speedProgression, this.speedConvert);
1225
+ }
1226
+ speedConvert(speed) {
1227
+ return speed / 60;
1160
1228
  }
1161
1229
  };
1162
1230
  RotateTicker = __decorateClass([
@@ -1168,15 +1236,13 @@ var ZoomTicker = class extends TickerBase {
1168
1236
  let ySpeed = 0.1;
1169
1237
  if (args.speed) {
1170
1238
  if (typeof args.speed === "number") {
1171
- xSpeed = args.speed;
1172
- ySpeed = args.speed;
1239
+ xSpeed = this.speedConvert(args.speed);
1240
+ ySpeed = this.speedConvert(args.speed);
1173
1241
  } else {
1174
- xSpeed = args.speed.x;
1175
- ySpeed = args.speed.y;
1242
+ xSpeed = this.speedConvert(args.speed.x);
1243
+ ySpeed = this.speedConvert(args.speed.y);
1176
1244
  }
1177
1245
  }
1178
- xSpeed /= 60;
1179
- ySpeed /= 60;
1180
1246
  let tagToRemoveAfter2 = args.tagToRemoveAfter || [];
1181
1247
  if (typeof tagToRemoveAfter2 === "string") {
1182
1248
  tagToRemoveAfter2 = [tagToRemoveAfter2];
@@ -1243,7 +1309,10 @@ var ZoomTicker = class extends TickerBase {
1243
1309
  }
1244
1310
  });
1245
1311
  if (args.speedProgression)
1246
- updateTickerProgression(args, "speed", args.speedProgression);
1312
+ updateTickerProgression(args, "speed", args.speedProgression, this.speedConvert);
1313
+ }
1314
+ speedConvert(speed) {
1315
+ return speed / 60;
1247
1316
  }
1248
1317
  onEndOfTicker(tag, tickerId, _element, tagToRemoveAfter2) {
1249
1318
  GameWindowManager.onEndOfTicker(tag, this, tagToRemoveAfter2, tickerId);
@@ -1266,7 +1335,7 @@ var ZoomInOutTicker = class extends ZoomTicker {
1266
1335
  };
1267
1336
 
1268
1337
  // src/constants.ts
1269
- var PIXIVN_VERSION = "0.6.3";
1338
+ var PIXIVN_VERSION = "0.6.5";
1270
1339
  var Repeat = "repeat";
1271
1340
  function Pause(duration) {
1272
1341
  return {
@@ -1451,14 +1520,14 @@ function zoomIn(_0, _1) {
1451
1520
  } else {
1452
1521
  canvasElement = image;
1453
1522
  }
1454
- if (canvasElement instanceof CanvasImage && ((_a = canvasElement.texture) == null ? void 0 : _a.label) == "EMPTY") {
1455
- yield canvasElement.load();
1456
- }
1457
1523
  let container = new CanvasContainer();
1458
1524
  container.addChild(canvasElement);
1459
1525
  container.height = GameWindowManager.canvasHeight;
1460
1526
  container.width = GameWindowManager.canvasWidth;
1461
1527
  GameWindowManager.addCanvasElement(tag, container);
1528
+ if (canvasElement instanceof CanvasImage && ((_a = canvasElement.texture) == null ? void 0 : _a.label) == "EMPTY") {
1529
+ yield canvasElement.load();
1530
+ }
1462
1531
  if (props.direction == "up") {
1463
1532
  container.pivot.y = GameWindowManager.canvasHeight;
1464
1533
  container.pivot.x = GameWindowManager.canvasWidth / 2;
@@ -1546,13 +1615,17 @@ function getSaveJson() {
1546
1615
  return JSON.stringify(saveData);
1547
1616
  }
1548
1617
  function loadSaveData(data, navigate) {
1549
- GameStepManager.import(data.stepData);
1550
- GameStorageManager.import(data.storageData);
1551
- GameWindowManager.import(data.canvasData);
1552
- navigate(data.path);
1618
+ return __async(this, null, function* () {
1619
+ yield GameStepManager.import(data.stepData);
1620
+ GameStorageManager.import(data.storageData);
1621
+ GameWindowManager.import(data.canvasData);
1622
+ navigate(data.path);
1623
+ });
1553
1624
  }
1554
1625
  function loadSaveJson(dataString, navigate) {
1555
- loadSaveData(jsonToSaveData(dataString), navigate);
1626
+ return __async(this, null, function* () {
1627
+ yield loadSaveData(jsonToSaveData(dataString), navigate);
1628
+ });
1556
1629
  }
1557
1630
  function jsonToSaveData(json) {
1558
1631
  return JSON.parse(json);
@@ -2507,6 +2580,16 @@ var _GameStepManager = class _GameStepManager {
2507
2580
  static set originalStepData(value) {
2508
2581
  _GameStepManager._originalStepData = createExportableElement(value);
2509
2582
  }
2583
+ static get currentStepData() {
2584
+ let currentStepData = {
2585
+ path: window.location.pathname,
2586
+ storage: GameStorageManager.export(),
2587
+ canvas: GameWindowManager.export(),
2588
+ labelIndex: _GameStepManager.currentLabelStepIndex || 0,
2589
+ openedLabels: createExportableElement(_GameStepManager._openedLabels)
2590
+ };
2591
+ return currentStepData;
2592
+ }
2510
2593
  /* Edit History Methods */
2511
2594
  /**
2512
2595
  * Add a label to the history.
@@ -2514,19 +2597,13 @@ var _GameStepManager = class _GameStepManager {
2514
2597
  */
2515
2598
  static addStepHistory(step, choiseMade) {
2516
2599
  let stepHistory = getStepSha1(step);
2517
- let historyStep = {
2518
- path: window.location.pathname,
2519
- storage: GameStorageManager.export(),
2520
- canvas: GameWindowManager.export(),
2521
- labelIndex: _GameStepManager.currentLabelStepIndex || 0,
2522
- openedLabels: createExportableElement(_GameStepManager._openedLabels)
2523
- };
2600
+ let currentStepData = _GameStepManager.currentStepData;
2524
2601
  if (_GameStepManager.originalStepData) {
2525
- if (_GameStepManager.originalStepData.openedLabels.length === historyStep.openedLabels.length) {
2602
+ if (_GameStepManager.originalStepData.openedLabels.length === currentStepData.openedLabels.length) {
2526
2603
  try {
2527
2604
  let lastStepDataOpenedLabelsString = JSON.stringify(_GameStepManager.originalStepData.openedLabels);
2528
- let historyStepOpenedLabelsString = JSON.stringify(historyStep.openedLabels);
2529
- if (lastStepDataOpenedLabelsString === historyStepOpenedLabelsString && _GameStepManager.originalStepData.path === historyStep.path && _GameStepManager.originalStepData.labelIndex === historyStep.labelIndex) {
2605
+ let historyStepOpenedLabelsString = JSON.stringify(currentStepData.openedLabels);
2606
+ if (lastStepDataOpenedLabelsString === historyStepOpenedLabelsString && _GameStepManager.originalStepData.path === currentStepData.path && _GameStepManager.originalStepData.labelIndex === currentStepData.labelIndex) {
2530
2607
  return;
2531
2608
  }
2532
2609
  } catch (e) {
@@ -2534,7 +2611,7 @@ var _GameStepManager = class _GameStepManager {
2534
2611
  }
2535
2612
  }
2536
2613
  }
2537
- let data = diff(_GameStepManager.originalStepData, historyStep);
2614
+ let data = diff(_GameStepManager.originalStepData, currentStepData);
2538
2615
  if (data) {
2539
2616
  let dialoge = void 0;
2540
2617
  let requiredChoices = void 0;
@@ -2553,7 +2630,7 @@ var _GameStepManager = class _GameStepManager {
2553
2630
  index: _GameStepManager.lastStepIndex,
2554
2631
  choiceIndexMade: choiseMade
2555
2632
  });
2556
- _GameStepManager.originalStepData = historyStep;
2633
+ _GameStepManager.originalStepData = currentStepData;
2557
2634
  }
2558
2635
  _GameStepManager.increaseLastStepIndex();
2559
2636
  }
@@ -2644,6 +2721,9 @@ var _GameStepManager = class _GameStepManager {
2644
2721
  console.warn("[Pixi'VN] The player must make a choice");
2645
2722
  return;
2646
2723
  }
2724
+ if (_GameStepManager.currentLabel && _GameStepManager.currentLabel.onStepEnd) {
2725
+ yield _GameStepManager.currentLabel.onStepEnd(_GameStepManager.currentLabelStepIndex || 0, _GameStepManager.currentLabel);
2726
+ }
2647
2727
  _GameStepManager.increaseCurrentStepIndex();
2648
2728
  return yield _GameStepManager.runCurrentStep(props, choiseMade);
2649
2729
  });
@@ -2668,6 +2748,10 @@ var _GameStepManager = class _GameStepManager {
2668
2748
  return;
2669
2749
  }
2670
2750
  if (currentLabel.steps.length > currentLabelStepIndex) {
2751
+ let onStepRun = currentLabel.onStepStart;
2752
+ if (onStepRun) {
2753
+ yield onStepRun(currentLabelStepIndex, currentLabel);
2754
+ }
2671
2755
  let step = currentLabel.steps[currentLabelStepIndex];
2672
2756
  let result = yield step(props);
2673
2757
  _GameStepManager.addStepHistory(step, choiseMade);
@@ -2732,6 +2816,9 @@ var _GameStepManager = class _GameStepManager {
2732
2816
  if (!tempLabel) {
2733
2817
  throw new Error(`[Pixi'VN] Label ${labelId} not found`);
2734
2818
  }
2819
+ if (_GameStepManager.currentLabel && _GameStepManager.currentLabel.onStepEnd) {
2820
+ yield _GameStepManager.currentLabel.onStepEnd(_GameStepManager.currentLabelStepIndex || 0, _GameStepManager.currentLabel);
2821
+ }
2735
2822
  _GameStepManager.pushNewLabel(tempLabel.id);
2736
2823
  } catch (e) {
2737
2824
  console.error("[Pixi'VN] Error calling label", e);
@@ -2790,6 +2877,9 @@ var _GameStepManager = class _GameStepManager {
2790
2877
  if (!tempLabel) {
2791
2878
  throw new Error(`[Pixi'VN] Label ${labelId} not found`);
2792
2879
  }
2880
+ if (_GameStepManager.currentLabel && _GameStepManager.currentLabel.onStepEnd) {
2881
+ yield _GameStepManager.currentLabel.onStepEnd(_GameStepManager.currentLabelStepIndex || 0, _GameStepManager.currentLabel);
2882
+ }
2793
2883
  _GameStepManager.pushNewLabel(tempLabel.id);
2794
2884
  } catch (e) {
2795
2885
  console.error("[Pixi'VN] Error jumping label", e);
@@ -2895,24 +2985,29 @@ var _GameStepManager = class _GameStepManager {
2895
2985
  * ```
2896
2986
  */
2897
2987
  static goBack(navigate, steps = 1) {
2898
- if (steps <= 0) {
2899
- console.warn("[Pixi'VN] Steps must be greater than 0");
2900
- return;
2901
- }
2902
- if (_GameStepManager._stepsHistory.length <= 1) {
2903
- console.warn("[Pixi'VN] No steps to go back");
2904
- return;
2905
- }
2906
- let restoredStep = _GameStepManager.goBackInternal(steps, _GameStepManager.originalStepData);
2907
- if (restoredStep) {
2908
- _GameStepManager._originalStepData = restoredStep;
2909
- _GameStepManager._openedLabels = createExportableElement(restoredStep.openedLabels);
2910
- GameStorageManager.import(createExportableElement(restoredStep.storage));
2911
- GameWindowManager.import(createExportableElement(restoredStep.canvas));
2912
- navigate(restoredStep.path);
2913
- } else {
2914
- console.error("[Pixi'VN] Error going back");
2915
- }
2988
+ return __async(this, null, function* () {
2989
+ if (steps <= 0) {
2990
+ console.warn("[Pixi'VN] Steps must be greater than 0");
2991
+ return;
2992
+ }
2993
+ if (_GameStepManager._stepsHistory.length <= 1) {
2994
+ console.warn("[Pixi'VN] No steps to go back");
2995
+ return;
2996
+ }
2997
+ let restoredStep = _GameStepManager.goBackInternal(steps, _GameStepManager.originalStepData);
2998
+ if (restoredStep) {
2999
+ _GameStepManager._originalStepData = restoredStep;
3000
+ _GameStepManager._openedLabels = createExportableElement(restoredStep.openedLabels);
3001
+ if (_GameStepManager.currentLabel && _GameStepManager.currentLabel.onLoadStep) {
3002
+ yield _GameStepManager.currentLabel.onLoadStep(_GameStepManager.currentLabelStepIndex || 0, _GameStepManager.currentLabel);
3003
+ }
3004
+ GameStorageManager.import(createExportableElement(restoredStep.storage));
3005
+ GameWindowManager.import(createExportableElement(restoredStep.canvas));
3006
+ navigate(restoredStep.path);
3007
+ } else {
3008
+ console.error("[Pixi'VN] Error going back");
3009
+ }
3010
+ });
2916
3011
  }
2917
3012
  static goBackInternal(steps, restoredStep) {
2918
3013
  if (steps <= 0) {
@@ -2974,38 +3069,45 @@ var _GameStepManager = class _GameStepManager {
2974
3069
  * @param dataString The history in a JSON string.
2975
3070
  */
2976
3071
  static importJson(dataString) {
2977
- _GameStepManager.import(JSON.parse(dataString));
3072
+ return __async(this, null, function* () {
3073
+ yield _GameStepManager.import(JSON.parse(dataString));
3074
+ });
2978
3075
  }
2979
3076
  /**
2980
3077
  * Import the history from an object.
2981
3078
  * @param data The history in an object.
2982
3079
  */
2983
3080
  static import(data) {
2984
- _GameStepManager.clear();
2985
- try {
2986
- if (data.hasOwnProperty("stepsHistory")) {
2987
- _GameStepManager._stepsHistory = data["stepsHistory"];
2988
- } else {
2989
- console.warn("[Pixi'VN] Could not import stepsHistory data, so will be ignored");
2990
- }
2991
- if (data.hasOwnProperty("openedLabels")) {
2992
- _GameStepManager._openedLabels = data["openedLabels"];
2993
- } else {
2994
- console.warn("[Pixi'VN] Could not import openedLabels data, so will be ignored");
2995
- }
2996
- if (data.hasOwnProperty("lastStepIndex")) {
2997
- _GameStepManager._lastStepIndex = data["lastStepIndex"];
2998
- } else {
2999
- console.warn("[Pixi'VN] Could not import lastStepIndex data, so will be ignored");
3000
- }
3001
- if (data.hasOwnProperty("originalStepData")) {
3002
- _GameStepManager._originalStepData = data["originalStepData"];
3003
- } else {
3004
- console.warn("[Pixi'VN] Could not import originalStepData data, so will be ignored");
3081
+ return __async(this, null, function* () {
3082
+ _GameStepManager.clear();
3083
+ try {
3084
+ if (data.hasOwnProperty("stepsHistory")) {
3085
+ _GameStepManager._stepsHistory = data["stepsHistory"];
3086
+ } else {
3087
+ console.warn("[Pixi'VN] Could not import stepsHistory data, so will be ignored");
3088
+ }
3089
+ if (data.hasOwnProperty("openedLabels")) {
3090
+ _GameStepManager._openedLabels = data["openedLabels"];
3091
+ } else {
3092
+ console.warn("[Pixi'VN] Could not import openedLabels data, so will be ignored");
3093
+ }
3094
+ if (data.hasOwnProperty("lastStepIndex")) {
3095
+ _GameStepManager._lastStepIndex = data["lastStepIndex"];
3096
+ } else {
3097
+ console.warn("[Pixi'VN] Could not import lastStepIndex data, so will be ignored");
3098
+ }
3099
+ if (data.hasOwnProperty("originalStepData")) {
3100
+ _GameStepManager._originalStepData = data["originalStepData"];
3101
+ } else {
3102
+ console.warn("[Pixi'VN] Could not import originalStepData data, so will be ignored");
3103
+ }
3104
+ if (_GameStepManager.currentLabel && _GameStepManager.currentLabel.onLoadStep) {
3105
+ yield _GameStepManager.currentLabel.onLoadStep(_GameStepManager.currentLabelStepIndex || 0, _GameStepManager.currentLabel);
3106
+ }
3107
+ } catch (e) {
3108
+ console.error("[Pixi'VN] Error importing data", e);
3005
3109
  }
3006
- } catch (e) {
3007
- console.error("[Pixi'VN] Error importing data", e);
3008
- }
3110
+ });
3009
3111
  }
3010
3112
  };
3011
3113
  /**
@@ -3181,7 +3283,7 @@ var DialogueBaseModel = class {
3181
3283
  var juliette = new CharacterBaseModel2("___pixivn_juliette___", {
3182
3284
  name: "Juliette",
3183
3285
  age: 25,
3184
- 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",
3286
+ icon: "https://firebasestorage.googleapis.com/v0/b/pixi-vn.appspot.com/o/public%2Fcharacters%2Fjuliette-square.webp?alt=media",
3185
3287
  color: "#ac0086"
3186
3288
  });
3187
3289
  saveCharacter(juliette);
@@ -3226,10 +3328,16 @@ var baseCanvasElementTestLabel = newLabel(
3226
3328
  removeCanvasElement("container");
3227
3329
  setDialogue({
3228
3330
  character: juliette,
3229
- 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.
3331
+ text: `Here's what's going to happen: I'm going to create some CanvasText with different styles and put them on the stage.
3230
3332
  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)).`
3231
3333
  });
3232
- const basicText = new CanvasText({ text: "Basic text in pixi" });
3334
+ const basicStyle = new TextStyle({
3335
+ fill: "#ffffff"
3336
+ });
3337
+ const basicText = new CanvasText({
3338
+ text: "Basic text in pixi",
3339
+ style: basicStyle
3340
+ });
3233
3341
  basicText.x = 50;
3234
3342
  basicText.y = 100;
3235
3343
  GameWindowManager.addCanvasElement("basicText", basicText);
@@ -3247,7 +3355,7 @@ But it will generate a warn message, because the FillGradient or FillPattern has
3247
3355
  fill: { fill },
3248
3356
  stroke: { color: "#4a1850", width: 5, join: "round" },
3249
3357
  dropShadow: {
3250
- color: "#000000",
3358
+ color: "#ff5f74",
3251
3359
  blur: 4,
3252
3360
  angle: Math.PI / 6,
3253
3361
  distance: 6
@@ -3300,36 +3408,30 @@ EventTest1 = __decorateClass([
3300
3408
  eventDecorator("___pixi_vn_canvas_events_test_event1___")
3301
3409
  ], EventTest1);
3302
3410
  var EventTest2 = class extends CanvasEvent {
3303
- constructor() {
3304
- super(...arguments);
3305
- this.textureButtonDown = Texture.from("https://pixijs.com/assets/button_down.png");
3306
- this.textureButtonOver = Texture.from("https://pixijs.com/assets/button_over.png");
3307
- this.textureButton = Texture.from("https://pixijs.com/assets/button.png");
3308
- }
3309
3411
  fn(event, sprite) {
3310
3412
  if (event === "pointerdown") {
3311
3413
  sprite.isdown = true;
3312
- sprite.texture = this.textureButtonDown;
3414
+ sprite.texture = Texture.from("https://pixijs.com/assets/button_down.png");
3313
3415
  sprite.alpha = 1;
3314
3416
  } else if (event === "pointerup" || event === "pointerupoutside") {
3315
3417
  sprite.isdown = false;
3316
3418
  if (sprite.isOver) {
3317
- sprite.texture = this.textureButtonOver;
3419
+ sprite.texture = Texture.from("https://pixijs.com/assets/button_over.png");
3318
3420
  } else {
3319
- sprite.texture = this.textureButton;
3421
+ sprite.texture = Texture.from("https://pixijs.com/assets/button.png");
3320
3422
  }
3321
3423
  } else if (event === "pointerover") {
3322
3424
  sprite.isOver = true;
3323
3425
  if (sprite.isdown) {
3324
3426
  return;
3325
3427
  }
3326
- sprite.texture = this.textureButtonOver;
3428
+ sprite.texture = Texture.from("https://pixijs.com/assets/button_over.png");
3327
3429
  } else if (event === "pointerout") {
3328
3430
  sprite.isOver = false;
3329
3431
  if (sprite.isdown) {
3330
3432
  return;
3331
3433
  }
3332
- sprite.texture = this.textureButton;
3434
+ sprite.texture = Texture.from("https://pixijs.com/assets/button.png");
3333
3435
  }
3334
3436
  }
3335
3437
  };
@@ -3351,6 +3453,7 @@ var canvasEventsTestLabel = newLabel(
3351
3453
  });
3352
3454
  const texture = yield Assets.load(bunnyImage);
3353
3455
  const sprite = CanvasSprite.from(texture);
3456
+ sprite.scale.set(3);
3354
3457
  sprite.anchor.set(0.5);
3355
3458
  sprite.x = GameWindowManager.screen.width / 2;
3356
3459
  sprite.y = GameWindowManager.screen.height / 2;
@@ -3365,17 +3468,12 @@ var canvasEventsTestLabel = newLabel(
3365
3468
  character: juliette,
3366
3469
  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).)`
3367
3470
  });
3368
- yield Assets.load([
3369
- "https://pixijs.com/assets/bg_button.jpg",
3370
- "https://pixijs.com/assets/button.png",
3371
- "https://pixijs.com/assets/button_down.png",
3372
- "https://pixijs.com/assets/button_over.png"
3373
- ]);
3374
- const background = CanvasSprite.from("https://pixijs.com/assets/bg_button.jpg");
3471
+ const backgroundT = yield Assets.load("https://pixijs.com/assets/bg_button.jpg");
3472
+ const background = new CanvasSprite(backgroundT);
3375
3473
  background.width = GameWindowManager.screen.width;
3376
3474
  background.height = GameWindowManager.screen.height;
3377
3475
  GameWindowManager.addCanvasElement("bg", background);
3378
- const textureButton = Texture.from("https://pixijs.com/assets/button.png");
3476
+ const textureButton = yield Assets.load("https://pixijs.com/assets/button.png");
3379
3477
  const buttons = [];
3380
3478
  const buttonPositions = [175, 75, 655, 75, 410, 325, 150, 465, 685, 445];
3381
3479
  for (let i = 0; i < 5; i++) {
@@ -3395,7 +3493,17 @@ var canvasEventsTestLabel = newLabel(
3395
3493
  buttons[4].scale.set(0.8, 1.2);
3396
3494
  buttons[4].rotation = Math.PI;
3397
3495
  })
3398
- ]
3496
+ ],
3497
+ {
3498
+ onLoadStep: () => __async(void 0, null, function* () {
3499
+ yield Assets.load([
3500
+ "https://pixijs.com/assets/bg_button.jpg",
3501
+ "https://pixijs.com/assets/button.png",
3502
+ "https://pixijs.com/assets/button_down.png",
3503
+ "https://pixijs.com/assets/button_over.png"
3504
+ ]);
3505
+ })
3506
+ }
3399
3507
  );
3400
3508
  var AlienTintingTest = class extends CanvasSprite {
3401
3509
  constructor() {
@@ -3515,13 +3623,13 @@ var imagesAnimationsTest = newLabel(IMAGE_ANIMAIONS_TEST_LABEL, [
3515
3623
  () => __async(void 0, null, function* () {
3516
3624
  setDialogue({ character: juliette, text: "Here's what they can do." });
3517
3625
  setChoiceMenuOptions([
3518
- new ChoiceMenuOption("Dissolve effect", imagesDissolveTest),
3519
- new ChoiceMenuOption("Fade effect", imagesFadeTest),
3520
- new ChoiceMenuOption("Rotate", imagesRotateTest),
3521
- new ChoiceMenuOption("Move", imagesMoveTest),
3522
- new ChoiceMenuOption("Zoom", imagesZoomTest),
3523
- new ChoiceMenuOption("Move in/out", imagesMoveInOutTest),
3524
- new ChoiceMenuOption("Zoom in/out", imagesZoomInOutTest),
3626
+ new ChoiceMenuOption("Dissolve effect", imagesDissolveTest, {}),
3627
+ new ChoiceMenuOption("Fade effect", imagesFadeTest, {}),
3628
+ new ChoiceMenuOption("Rotate", imagesRotateTest, {}),
3629
+ new ChoiceMenuOption("Move", imagesMoveTest, {}),
3630
+ new ChoiceMenuOption("Zoom", imagesZoomTest, {}),
3631
+ new ChoiceMenuOption("Move in/out", imagesMoveInOutTest, {}),
3632
+ new ChoiceMenuOption("Zoom in/out", imagesZoomInOutTest, {}),
3525
3633
  new ChoiceMenuOptionClose("Cancel", true)
3526
3634
  ]);
3527
3635
  }),
@@ -3631,8 +3739,8 @@ var imagesRotateTest = newLabel("___pixi_vn_images_rotate_test___", [
3631
3739
  text: `Here's what's going to happen:
3632
3740
  - ${eggHeadName} will rotate with a anchor set to 0.
3633
3741
  - ${flowerTopName} will rotate with a anchor set to 0.5 and a exponential speed progression.
3634
- - ${helmlokName} will rotate with a anchor set to 0.5, rotate 2 times, move to the right, rotate 5 times, and repeat.
3635
- - ${skullyName} will rotate with a anchor set to 1, rotate 3 times, wait for 0.5 seconds, rotate 7 times.`
3742
+ - ${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.
3743
+ - ${skullyName} will rotate with a anchor set to 1, rotate 3 seconds clockwise, wait for 0.5 seconds, and rotate 7 seconds counterclockwise.`
3636
3744
  });
3637
3745
  let eggHead = GameWindowManager.getCanvasElement("eggHead");
3638
3746
  if (eggHead)
@@ -3685,10 +3793,10 @@ var imagesMoveTest = newLabel("___pixi_vn_images_move_test___", [
3685
3793
  setDialogue({
3686
3794
  character: juliette,
3687
3795
  text: `Here's what's going to happen:
3688
- - ${eggHeadName} will move to { x: 500, y: 100 } with a speed of 0.4.
3689
- - ${flowerTopName} will move to { x: 500, y: 300 } with a speed of 0.3.
3690
- - ${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.
3691
- - ${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.`
3796
+ - ${eggHeadName} will move to { x: 500, y: 100 } with a speed of 24.
3797
+ - ${flowerTopName} will move to { x: 500, y: 300 } with a speed of 18.
3798
+ - ${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.
3799
+ - ${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.`
3692
3800
  });
3693
3801
  GameWindowManager.addTicker("eggHead", new MoveTicker({
3694
3802
  destination: { x: 500, y: 100 },
@@ -3701,25 +3809,25 @@ var imagesMoveTest = newLabel("___pixi_vn_images_move_test___", [
3701
3809
  GameWindowManager.addTickersSteps("helmlok", [
3702
3810
  new MoveTicker({
3703
3811
  destination: { x: 100, y: 500 },
3704
- speed: 1200,
3705
- speedProgression: { type: "linear", amt: -12, limit: 60 }
3812
+ speed: 150,
3813
+ speedProgression: { type: "linear", amt: -2, limit: 10 }
3706
3814
  }),
3707
3815
  new MoveTicker({
3708
3816
  destination: { x: 1700, y: 500 },
3709
- speed: 6,
3710
- speedProgression: { type: "linear", amt: 3 }
3817
+ speed: 10,
3818
+ speedProgression: { type: "linear", amt: 2, limit: 150 }
3711
3819
  }),
3712
3820
  Repeat
3713
3821
  ]);
3714
3822
  GameWindowManager.addTickersSteps("skully", [
3715
3823
  new MoveTicker({
3716
3824
  destination: { x: 500, y: 500 },
3717
- speed: 60
3825
+ speed: 40
3718
3826
  }),
3719
3827
  Pause(0.5),
3720
3828
  new MoveTicker({
3721
3829
  destination: { x: 100, y: 100 },
3722
- speed: 60
3830
+ speed: 40
3723
3831
  })
3724
3832
  ]);
3725
3833
  }
@@ -3781,37 +3889,45 @@ var imagesMoveInOutTest = newLabel("___pixi_vn_images_move_in_out_test___", [
3781
3889
  setDialogue({
3782
3890
  character: juliette,
3783
3891
  text: `Here's what's going to happen:
3784
- - ${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.
3785
- - ${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.
3786
- - ${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.
3787
- - ${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.`
3892
+ - ${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.
3893
+ - ${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.
3894
+ - ${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.
3895
+ - ${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.`
3788
3896
  });
3789
3897
  let eggHead = new CanvasImage({ x: 100, y: 100 }, eggHeadImage);
3790
3898
  let flowerTop = new CanvasImage({ x: 300, y: 100 }, flowerTopImage);
3791
3899
  let helmlok = new CanvasImage({ x: 100, y: 300 }, helmlokImage);
3792
3900
  let skully = new CanvasImage({ x: 300, y: 300 }, skullyImage);
3793
- moveIn("eggHead", eggHead, { speed: 800, direction: "down" });
3901
+ moveIn("eggHead", eggHead, { speed: 80, direction: "down" });
3794
3902
  moveIn("flowerTop", flowerTop, {
3795
- speed: 800,
3903
+ speed: 80,
3796
3904
  direction: "left",
3797
3905
  speedProgression: { type: "exponential", percentage: 0.02 }
3798
3906
  });
3799
- moveIn("helmlok", helmlok, { speed: 800, direction: "right" });
3907
+ moveIn("helmlok", helmlok, { speed: 80, direction: "right" });
3800
3908
  moveIn("skully", skully, {
3801
- speed: 800,
3909
+ speed: 80,
3802
3910
  direction: "up",
3803
3911
  speedProgression: { type: "exponential", percentage: 0.02 }
3804
3912
  });
3805
3913
  }),
3806
3914
  () => {
3807
- moveOut("eggHead", { speed: 800, direction: "down" });
3808
- moveOut("flowerTop", { speed: 800, direction: "left" });
3809
- moveOut("helmlok", { speed: 800, direction: "right" });
3810
- moveOut("skully", { speed: 800, direction: "up" });
3915
+ moveOut("eggHead", { speed: 80, direction: "down" });
3916
+ moveOut("flowerTop", { speed: 80, direction: "left" });
3917
+ moveOut("helmlok", { speed: 80, direction: "right" });
3918
+ moveOut("skully", { speed: 80, direction: "up" });
3811
3919
  }
3812
3920
  ]);
3813
3921
  var imagesZoomInOutTest = newLabel("___pixi_vn_images_zoom_in_out_test___", [
3814
3922
  () => __async(void 0, null, function* () {
3923
+ setDialogue({
3924
+ character: juliette,
3925
+ text: `Here's what's going to happen:
3926
+ - ${eggHeadName} will zoom in with a speed of 3. If you go next, ${eggHeadName} will zoom out with a speed of 3.
3927
+ - ${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.
3928
+ - ${helmlokName} will zoom in with a speed of 3. If you go next, ${helmlokName} will zoom out with a speed of 1.
3929
+ - ${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.`
3930
+ });
3815
3931
  GameWindowManager.removeCanvasElements();
3816
3932
  let eggHead = new CanvasImage({ x: 100, y: 100 }, eggHeadImage);
3817
3933
  let flowerTop = new CanvasImage({ x: 300, y: 100 }, flowerTopImage);
@@ -3837,7 +3953,7 @@ var imagesZoomInOutTest = newLabel("___pixi_vn_images_zoom_in_out_test___", [
3837
3953
  speedProgression: { type: "exponential", percentage: 0.02 }
3838
3954
  });
3839
3955
  zoomOut("flowerTop", { speed: 3, direction: "left" });
3840
- zoomOut("helmlok", { speed: 3, direction: "right" });
3956
+ zoomOut("helmlok", { speed: 1, direction: "right" });
3841
3957
  zoomOut("skully", {
3842
3958
  speed: 3,
3843
3959
  direction: "up",
@@ -3919,6 +4035,23 @@ Footer
3919
4035
  })
3920
4036
  ]);
3921
4037
 
4038
+ // src/labels/StepLabelTest.ts
4039
+ var STEP_LABEL_TEST_LABEL = "___pixi_vn_step_label_test___";
4040
+ var stepLabelTestLAbel = newLabel(STEP_LABEL_TEST_LABEL, [
4041
+ () => __async(void 0, null, function* () {
4042
+ setDialogue({ character: juliette, text: `Pixi'VN manages the succession of "screens" with steps. Each step is a function that can be asynchronous.` });
4043
+ }),
4044
+ () => __async(void 0, null, function* () {
4045
+ 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." });
4046
+ }),
4047
+ () => __async(void 0, null, function* () {
4048
+ setDialogue({ character: juliette, text: "It is also possible to ask the player to make a choice." });
4049
+ }),
4050
+ () => __async(void 0, null, function* () {
4051
+ setDialogue({ character: juliette, text: "Browsing through available tests is one way to test the steps/labels system." });
4052
+ })
4053
+ ]);
4054
+
3922
4055
  // src/labels/StartLabel.ts
3923
4056
  var pixivnTestStartLabel = newLabel(
3924
4057
  "___pixi_vn_example_start_label___",
@@ -3927,25 +4060,25 @@ var pixivnTestStartLabel = newLabel(
3927
4060
  let currentTimeName = "";
3928
4061
  const hour = (/* @__PURE__ */ new Date()).getHours();
3929
4062
  if (hour >= 5 && hour < 12) {
3930
- currentTimeName = "morning";
4063
+ currentTimeName = "morning\u{1F505}";
3931
4064
  } else if (hour >= 12 && hour < 18) {
3932
- currentTimeName = "afternoon";
4065
+ currentTimeName = "afternoon\u{1F506}";
3933
4066
  } else if (hour >= 18 && hour < 22) {
3934
- currentTimeName = "evening";
4067
+ currentTimeName = "evening\u26C5";
3935
4068
  } else {
3936
- currentTimeName = "night";
4069
+ currentTimeName = "night\u{1F319}";
3937
4070
  }
3938
4071
  setDialogue({ character: juliette, text: `Good ${currentTimeName}! I'm ${juliette.name}, your virtual assistant. I'm here to help you with your tests.` });
3939
4072
  },
3940
- () => setDialogue({ character: juliette, text: `You are running the Pixi\u2019VN test. This test will guide you through the different features of the library.` }),
4073
+ () => 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.` }),
3941
4074
  (props) => GameStepManager.jumpLabel(pixivnTestStartLabel2, props)
3942
4075
  ]
3943
4076
  );
3944
- var openWiki = newLabel(
3945
- "___pixi_vn_open_wiki___",
4077
+ var openLink = newLabel(
4078
+ "___pixi_vn_open_link___",
3946
4079
  [
3947
4080
  (props) => {
3948
- window.open("https://pixi-vn.web.app/");
4081
+ window.open(props.link);
3949
4082
  GameStepManager.goNext(props);
3950
4083
  }
3951
4084
  ]
@@ -3958,12 +4091,14 @@ var pixivnTestStartLabel2 = newLabel(
3958
4091
  GameWindowManager.clear();
3959
4092
  setDialogue({ character: juliette, text: "Which test would you like to start with?" });
3960
4093
  setChoiceMenuOptions([
3961
- new ChoiceMenuOption("Open Pixi\u2019VN Wiki", openWiki),
3962
- new ChoiceMenuOption("Images, Transitions and Animations Test", imagesAnimationsTest),
3963
- new ChoiceMenuOption("Canvas Events Test Label", canvasEventsTestLabel),
3964
- new ChoiceMenuOption("Base Canvas Element Test", baseCanvasElementTestLabel),
3965
- new ChoiceMenuOption("Custom Ticker Canvas Element Test", customTickerCanvasElementTestLabel),
3966
- new ChoiceMenuOption("Markdown Test", markdownTest)
4094
+ new ChoiceMenuOption("Open Pixi\u2019VN Wiki", openLink, { link: "https://pixi-vn.web.app/" }),
4095
+ new ChoiceMenuOption("Images, Transitions and Animations Test", imagesAnimationsTest, {}),
4096
+ new ChoiceMenuOption("Canvas Events Test", canvasEventsTestLabel, {}),
4097
+ new ChoiceMenuOption("Base Canvas Element Test", baseCanvasElementTestLabel, {}),
4098
+ new ChoiceMenuOption("Custom Ticker Canvas Element Test", customTickerCanvasElementTestLabel, {}),
4099
+ new ChoiceMenuOption("Steps and Labels Test", stepLabelTestLAbel, {}),
4100
+ new ChoiceMenuOption("Markdown Test", markdownTest, {}),
4101
+ new ChoiceMenuOption("Open Pixi\u2019VN Github Issues", openLink, { link: "https://github.com/DRincs-Productions/pixi-vn/issues" })
3967
4102
  ]);
3968
4103
  },
3969
4104
  (props) => GameStepManager.jumpLabel(RESTART_TEST_LABEL, props)