@drincs/pixi-vn 0.6.0 → 0.6.1

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 (373) hide show
  1. package/dist/{TickerBase-RQDWNI4K.d.ts → TickerBase-BAUiHet_.d.ts} +18 -13
  2. package/dist/{TickerBase-B5CQCJs8.d.mts → TickerBase-BctFf13y.d.mts} +18 -13
  3. package/dist/classes/CanvasEvent.d.mts +1 -1
  4. package/dist/classes/CanvasEvent.d.ts +1 -1
  5. package/dist/classes/CanvasEvent.js.map +1 -1
  6. package/dist/classes/CanvasEvent.mjs.map +1 -1
  7. package/dist/classes/CharacterBaseModel.d.mts +2 -26
  8. package/dist/classes/CharacterBaseModel.d.ts +2 -26
  9. package/dist/classes/CharacterBaseModel.js +464 -189
  10. package/dist/classes/CharacterBaseModel.js.map +1 -1
  11. package/dist/classes/CharacterBaseModel.mjs +460 -189
  12. package/dist/classes/CharacterBaseModel.mjs.map +1 -1
  13. package/dist/classes/ChoiceMenuOption.d.mts +27 -17
  14. package/dist/classes/ChoiceMenuOption.d.ts +27 -17
  15. package/dist/classes/ChoiceMenuOption.js +467 -190
  16. package/dist/classes/ChoiceMenuOption.js.map +1 -1
  17. package/dist/classes/ChoiceMenuOption.mjs +463 -190
  18. package/dist/classes/ChoiceMenuOption.mjs.map +1 -1
  19. package/dist/classes/CloseLabel.d.mts +1 -1
  20. package/dist/classes/CloseLabel.d.ts +1 -1
  21. package/dist/classes/CloseLabel.js.map +1 -1
  22. package/dist/classes/CloseLabel.mjs.map +1 -1
  23. package/dist/classes/DialogueBaseModel.d.mts +1 -0
  24. package/dist/classes/DialogueBaseModel.d.ts +1 -0
  25. package/dist/classes/StoredClassModel.d.mts +2 -2
  26. package/dist/classes/StoredClassModel.d.ts +2 -2
  27. package/dist/classes/StoredClassModel.js +464 -189
  28. package/dist/classes/StoredClassModel.js.map +1 -1
  29. package/dist/classes/StoredClassModel.mjs +460 -189
  30. package/dist/classes/StoredClassModel.mjs.map +1 -1
  31. package/dist/classes/canvas/CanvasContainer.js.map +1 -1
  32. package/dist/classes/canvas/CanvasContainer.mjs.map +1 -1
  33. package/dist/classes/canvas/CanvasImage.d.mts +2 -2
  34. package/dist/classes/canvas/CanvasImage.d.ts +2 -2
  35. package/dist/classes/canvas/CanvasImage.js.map +1 -1
  36. package/dist/classes/canvas/CanvasImage.mjs.map +1 -1
  37. package/dist/classes/canvas/CanvasSprite.d.mts +1 -1
  38. package/dist/classes/canvas/CanvasSprite.d.ts +1 -1
  39. package/dist/classes/canvas/CanvasSprite.js.map +1 -1
  40. package/dist/classes/canvas/CanvasSprite.mjs.map +1 -1
  41. package/dist/classes/canvas/CanvasText.d.mts +2 -2
  42. package/dist/classes/canvas/CanvasText.d.ts +2 -2
  43. package/dist/classes/canvas/CanvasText.js.map +1 -1
  44. package/dist/classes/canvas/CanvasText.mjs.map +1 -1
  45. package/dist/classes/canvas/index.js.map +1 -1
  46. package/dist/classes/canvas/index.mjs.map +1 -1
  47. package/dist/classes/index.d.mts +5 -4
  48. package/dist/classes/index.d.ts +5 -4
  49. package/dist/classes/index.js +467 -190
  50. package/dist/classes/index.js.map +1 -1
  51. package/dist/classes/index.mjs +463 -190
  52. package/dist/classes/index.mjs.map +1 -1
  53. package/dist/classes/ticker/FadeAlphaTicker.d.mts +26 -0
  54. package/dist/classes/ticker/FadeAlphaTicker.d.ts +26 -0
  55. package/dist/classes/ticker/{TickerFadeAlpha.js → FadeAlphaTicker.js} +469 -196
  56. package/dist/classes/ticker/FadeAlphaTicker.js.map +1 -0
  57. package/dist/classes/ticker/{TickerRotate.mjs → FadeAlphaTicker.mjs} +491 -222
  58. package/dist/classes/ticker/FadeAlphaTicker.mjs.map +1 -0
  59. package/dist/classes/ticker/MoveTicker.d.mts +24 -0
  60. package/dist/classes/ticker/MoveTicker.d.ts +24 -0
  61. package/dist/classes/ticker/MoveTicker.js +1605 -0
  62. package/dist/classes/ticker/MoveTicker.js.map +1 -0
  63. package/dist/classes/ticker/{TickerMove.mjs → MoveTicker.mjs} +463 -192
  64. package/dist/classes/ticker/MoveTicker.mjs.map +1 -0
  65. package/dist/classes/ticker/RotateTicker.d.mts +26 -0
  66. package/dist/classes/ticker/RotateTicker.d.ts +26 -0
  67. package/dist/classes/ticker/{TickerRotate.js → RotateTicker.js} +464 -189
  68. package/dist/classes/ticker/RotateTicker.js.map +1 -0
  69. package/dist/classes/ticker/RotateTicker.mjs +1599 -0
  70. package/dist/classes/ticker/RotateTicker.mjs.map +1 -0
  71. package/dist/classes/ticker/TickerBase.d.mts +1 -1
  72. package/dist/classes/ticker/TickerBase.d.ts +1 -1
  73. package/dist/classes/ticker/TickerBase.js +7 -6
  74. package/dist/classes/ticker/TickerBase.js.map +1 -1
  75. package/dist/classes/ticker/TickerBase.mjs +7 -6
  76. package/dist/classes/ticker/TickerBase.mjs.map +1 -1
  77. package/dist/classes/ticker/ZoomTicker.d.mts +25 -0
  78. package/dist/classes/ticker/ZoomTicker.d.ts +25 -0
  79. package/dist/classes/ticker/{TickerMove.js → ZoomTicker.js} +474 -199
  80. package/dist/classes/ticker/ZoomTicker.js.map +1 -0
  81. package/dist/classes/ticker/{TickerFadeAlpha.mjs → ZoomTicker.mjs} +472 -201
  82. package/dist/classes/ticker/ZoomTicker.mjs.map +1 -0
  83. package/dist/classes/ticker/index.d.mts +10 -8
  84. package/dist/classes/ticker/index.d.ts +10 -8
  85. package/dist/classes/ticker/index.js +479 -206
  86. package/dist/classes/ticker/index.js.map +1 -1
  87. package/dist/classes/ticker/index.mjs +476 -207
  88. package/dist/classes/ticker/index.mjs.map +1 -1
  89. package/dist/constants.d.mts +12 -2
  90. package/dist/constants.d.ts +12 -2
  91. package/dist/constants.js +10 -1
  92. package/dist/constants.js.map +1 -1
  93. package/dist/constants.mjs +9 -2
  94. package/dist/constants.mjs.map +1 -1
  95. package/dist/decorators/CanvasElementDecorator.js.map +1 -1
  96. package/dist/decorators/CanvasElementDecorator.mjs.map +1 -1
  97. package/dist/decorators/CharacterDecorator.d.mts +1 -0
  98. package/dist/decorators/CharacterDecorator.d.ts +1 -0
  99. package/dist/decorators/CharacterDecorator.js +1 -1
  100. package/dist/decorators/CharacterDecorator.js.map +1 -1
  101. package/dist/decorators/CharacterDecorator.mjs +1 -1
  102. package/dist/decorators/CharacterDecorator.mjs.map +1 -1
  103. package/dist/decorators/EventDecorator.js +1 -1
  104. package/dist/decorators/EventDecorator.js.map +1 -1
  105. package/dist/decorators/EventDecorator.mjs +1 -1
  106. package/dist/decorators/EventDecorator.mjs.map +1 -1
  107. package/dist/decorators/LabelDecorator.d.mts +4 -3
  108. package/dist/decorators/LabelDecorator.d.ts +4 -3
  109. package/dist/decorators/LabelDecorator.js +465 -190
  110. package/dist/decorators/LabelDecorator.js.map +1 -1
  111. package/dist/decorators/LabelDecorator.mjs +461 -190
  112. package/dist/decorators/LabelDecorator.mjs.map +1 -1
  113. package/dist/decorators/TickerDecorator.d.mts +6 -3
  114. package/dist/decorators/TickerDecorator.d.ts +6 -3
  115. package/dist/decorators/TickerDecorator.js +1 -1
  116. package/dist/decorators/TickerDecorator.js.map +1 -1
  117. package/dist/decorators/TickerDecorator.mjs +1 -1
  118. package/dist/decorators/TickerDecorator.mjs.map +1 -1
  119. package/dist/decorators/index.d.mts +4 -3
  120. package/dist/decorators/index.d.ts +4 -3
  121. package/dist/decorators/index.js +467 -192
  122. package/dist/decorators/index.js.map +1 -1
  123. package/dist/decorators/index.mjs +463 -192
  124. package/dist/decorators/index.mjs.map +1 -1
  125. package/dist/functions/CanvasUtility.js.map +1 -1
  126. package/dist/functions/CanvasUtility.mjs.map +1 -1
  127. package/dist/functions/DialogueUtility.d.mts +6 -4
  128. package/dist/functions/DialogueUtility.d.ts +6 -4
  129. package/dist/functions/DialogueUtility.js +506 -213
  130. package/dist/functions/DialogueUtility.js.map +1 -1
  131. package/dist/functions/DialogueUtility.mjs +506 -213
  132. package/dist/functions/DialogueUtility.mjs.map +1 -1
  133. package/dist/functions/FlagsUtility.js +464 -189
  134. package/dist/functions/FlagsUtility.js.map +1 -1
  135. package/dist/functions/FlagsUtility.mjs +460 -189
  136. package/dist/functions/FlagsUtility.mjs.map +1 -1
  137. package/dist/functions/GameUtility.js +464 -189
  138. package/dist/functions/GameUtility.js.map +1 -1
  139. package/dist/functions/GameUtility.mjs +460 -189
  140. package/dist/functions/GameUtility.mjs.map +1 -1
  141. package/dist/functions/ImageUtility.d.mts +47 -7
  142. package/dist/functions/ImageUtility.d.ts +47 -7
  143. package/dist/functions/ImageUtility.js +554 -215
  144. package/dist/functions/ImageUtility.js.map +1 -1
  145. package/dist/functions/ImageUtility.mjs +546 -215
  146. package/dist/functions/ImageUtility.mjs.map +1 -1
  147. package/dist/functions/SavesUtility.d.mts +9 -5
  148. package/dist/functions/SavesUtility.d.ts +9 -5
  149. package/dist/functions/SavesUtility.js +485 -196
  150. package/dist/functions/SavesUtility.js.map +1 -1
  151. package/dist/functions/SavesUtility.mjs +485 -196
  152. package/dist/functions/SavesUtility.mjs.map +1 -1
  153. package/dist/functions/TickerUtility.d.mts +1 -1
  154. package/dist/functions/TickerUtility.d.ts +1 -1
  155. package/dist/functions/TickerUtility.js +32 -18
  156. package/dist/functions/TickerUtility.js.map +1 -1
  157. package/dist/functions/TickerUtility.mjs +32 -18
  158. package/dist/functions/TickerUtility.mjs.map +1 -1
  159. package/dist/functions/index.d.mts +15 -8
  160. package/dist/functions/index.d.ts +15 -8
  161. package/dist/functions/index.js +570 -213
  162. package/dist/functions/index.js.map +1 -1
  163. package/dist/functions/index.mjs +566 -213
  164. package/dist/functions/index.mjs.map +1 -1
  165. package/dist/index.d.mts +23 -14
  166. package/dist/index.d.ts +23 -14
  167. package/dist/index.js +990 -224
  168. package/dist/index.js.map +1 -1
  169. package/dist/index.mjs +984 -223
  170. package/dist/index.mjs.map +1 -1
  171. package/dist/interface/CharacterBaseModelProps.d.mts +27 -0
  172. package/dist/interface/CharacterBaseModelProps.d.ts +27 -0
  173. package/dist/interface/CharacterBaseModelProps.js +4 -0
  174. package/dist/interface/CharacterBaseModelProps.mjs +3 -0
  175. package/dist/interface/DialogueHistory.d.mts +3 -7
  176. package/dist/interface/DialogueHistory.d.ts +3 -7
  177. package/dist/interface/IHistoryStep.d.mts +12 -8
  178. package/dist/interface/IHistoryStep.d.ts +12 -8
  179. package/dist/interface/ISaveData.d.mts +8 -4
  180. package/dist/interface/ISaveData.d.ts +8 -4
  181. package/dist/interface/ITicker.d.mts +1 -1
  182. package/dist/interface/ITicker.d.ts +1 -1
  183. package/dist/interface/ITickersSteps.d.mts +3 -3
  184. package/dist/interface/ITickersSteps.d.ts +3 -3
  185. package/dist/interface/{IClassWithArgsHistory.d.mts → TickerHistory.d.mts} +9 -5
  186. package/dist/interface/{IClassWithArgsHistory.d.ts → TickerHistory.d.ts} +9 -5
  187. package/dist/{types/ticker/TickerMoveProps.js → interface/TickerHistory.js} +1 -1
  188. package/dist/interface/TickerHistory.mjs +3 -0
  189. package/dist/interface/TickerProgrationType.d.mts +13 -1
  190. package/dist/interface/TickerProgrationType.d.ts +13 -1
  191. package/dist/interface/TickerTimeoutHistory.d.mts +7 -0
  192. package/dist/interface/TickerTimeoutHistory.d.ts +7 -0
  193. package/dist/interface/TickerTimeoutHistory.js +4 -0
  194. package/dist/interface/TickerTimeoutHistory.mjs +3 -0
  195. package/dist/interface/canvas/ICanvasImageMemory.d.mts +1 -1
  196. package/dist/interface/canvas/ICanvasImageMemory.d.ts +1 -1
  197. package/dist/interface/canvas/ICanvasSpriteMemory.d.mts +1 -1
  198. package/dist/interface/canvas/ICanvasSpriteMemory.d.ts +1 -1
  199. package/dist/interface/canvas/ICanvasTextTextMemory.d.mts +1 -1
  200. package/dist/interface/canvas/ICanvasTextTextMemory.d.ts +1 -1
  201. package/dist/interface/export/ExportedCanvas.d.mts +11 -3
  202. package/dist/interface/export/ExportedCanvas.d.ts +11 -3
  203. package/dist/interface/export/ExportedStep.d.mts +7 -3
  204. package/dist/interface/export/ExportedStep.d.ts +7 -3
  205. package/dist/interface/export/index.d.mts +8 -4
  206. package/dist/interface/export/index.d.ts +8 -4
  207. package/dist/interface/index.d.mts +14 -11
  208. package/dist/interface/index.d.ts +14 -11
  209. package/dist/labels/BaseCanvasElementTestLabel.d.mts +9 -0
  210. package/dist/labels/BaseCanvasElementTestLabel.d.ts +9 -0
  211. package/dist/labels/BaseCanvasElementTestLabel.js +1860 -0
  212. package/dist/labels/BaseCanvasElementTestLabel.js.map +1 -0
  213. package/dist/labels/BaseCanvasElementTestLabel.mjs +1854 -0
  214. package/dist/labels/BaseCanvasElementTestLabel.mjs.map +1 -0
  215. package/dist/labels/EventsTestLabel.d.mts +30 -0
  216. package/dist/labels/EventsTestLabel.d.ts +30 -0
  217. package/dist/labels/EventsTestLabel.js +2600 -0
  218. package/dist/labels/EventsTestLabel.js.map +1 -0
  219. package/dist/labels/EventsTestLabel.mjs +2594 -0
  220. package/dist/labels/EventsTestLabel.mjs.map +1 -0
  221. package/dist/labels/MarkdownTest.d.mts +9 -0
  222. package/dist/labels/MarkdownTest.d.ts +9 -0
  223. package/dist/labels/MarkdownTest.js +2686 -0
  224. package/dist/labels/MarkdownTest.js.map +1 -0
  225. package/dist/labels/MarkdownTest.mjs +2680 -0
  226. package/dist/labels/MarkdownTest.mjs.map +1 -0
  227. package/dist/labels/ShowImageTest.d.mts +9 -0
  228. package/dist/labels/ShowImageTest.d.ts +9 -0
  229. package/dist/labels/ShowImageTest.js +3087 -0
  230. package/dist/labels/ShowImageTest.js.map +1 -0
  231. package/dist/labels/ShowImageTest.mjs +3081 -0
  232. package/dist/labels/ShowImageTest.mjs.map +1 -0
  233. package/dist/labels/StartLabel.d.mts +10 -0
  234. package/dist/labels/StartLabel.d.ts +10 -0
  235. package/dist/labels/StartLabel.js +3199 -0
  236. package/dist/labels/StartLabel.js.map +1 -0
  237. package/dist/labels/StartLabel.mjs +3192 -0
  238. package/dist/labels/StartLabel.mjs.map +1 -0
  239. package/dist/labels/TestConstant.d.mts +15 -0
  240. package/dist/labels/TestConstant.d.ts +15 -0
  241. package/dist/labels/TestConstant.js +1840 -0
  242. package/dist/labels/TestConstant.js.map +1 -0
  243. package/dist/labels/TestConstant.mjs +1826 -0
  244. package/dist/labels/TestConstant.mjs.map +1 -0
  245. package/dist/labels/TickerTestLabel.d.mts +9 -0
  246. package/dist/labels/TickerTestLabel.d.ts +9 -0
  247. package/dist/labels/TickerTestLabel.js +2605 -0
  248. package/dist/labels/TickerTestLabel.js.map +1 -0
  249. package/dist/labels/TickerTestLabel.mjs +2599 -0
  250. package/dist/labels/TickerTestLabel.mjs.map +1 -0
  251. package/dist/labels/TintingTestLabel.d.mts +19 -0
  252. package/dist/labels/TintingTestLabel.d.ts +19 -0
  253. package/dist/labels/TintingTestLabel.js +1786 -0
  254. package/dist/labels/TintingTestLabel.js.map +1 -0
  255. package/dist/labels/TintingTestLabel.mjs +1780 -0
  256. package/dist/labels/TintingTestLabel.mjs.map +1 -0
  257. package/dist/labels/index.d.mts +10 -0
  258. package/dist/labels/index.d.ts +10 -0
  259. package/dist/labels/index.js +3199 -0
  260. package/dist/labels/index.js.map +1 -0
  261. package/dist/labels/index.mjs +3192 -0
  262. package/dist/labels/index.mjs.map +1 -0
  263. package/dist/managers/StepManager.d.mts +18 -13
  264. package/dist/managers/StepManager.d.ts +18 -13
  265. package/dist/managers/StepManager.js +483 -194
  266. package/dist/managers/StepManager.js.map +1 -1
  267. package/dist/managers/StepManager.mjs +483 -194
  268. package/dist/managers/StepManager.mjs.map +1 -1
  269. package/dist/managers/WindowManager.d.mts +38 -24
  270. package/dist/managers/WindowManager.d.ts +38 -24
  271. package/dist/managers/WindowManager.js +280 -118
  272. package/dist/managers/WindowManager.js.map +1 -1
  273. package/dist/managers/WindowManager.mjs +276 -118
  274. package/dist/managers/WindowManager.mjs.map +1 -1
  275. package/dist/managers/index.d.mts +15 -14
  276. package/dist/managers/index.d.ts +15 -14
  277. package/dist/managers/index.js +486 -195
  278. package/dist/managers/index.js.map +1 -1
  279. package/dist/managers/index.mjs +486 -195
  280. package/dist/managers/index.mjs.map +1 -1
  281. package/dist/types/CanvasEventNamesType.d.mts +1 -1
  282. package/dist/types/CanvasEventNamesType.d.ts +1 -1
  283. package/dist/types/ChoiceMenuOptionsType.d.mts +2 -2
  284. package/dist/types/ChoiceMenuOptionsType.d.ts +2 -2
  285. package/dist/types/HistoryChoiceMenuOption.d.mts +22 -0
  286. package/dist/types/HistoryChoiceMenuOption.d.ts +22 -0
  287. package/dist/types/HistoryChoiceMenuOption.js +4 -0
  288. package/dist/types/HistoryChoiceMenuOption.mjs +3 -0
  289. package/dist/types/PauseType.d.mts +8 -4
  290. package/dist/types/PauseType.d.ts +8 -4
  291. package/dist/types/PauseType.js +0 -11
  292. package/dist/types/PauseType.js.map +1 -1
  293. package/dist/types/PauseType.mjs +0 -9
  294. package/dist/types/PauseType.mjs.map +1 -1
  295. package/dist/types/RepeatType.d.mts +1 -2
  296. package/dist/types/RepeatType.d.ts +1 -2
  297. package/dist/types/RepeatType.js +0 -4
  298. package/dist/types/RepeatType.js.map +1 -1
  299. package/dist/types/RepeatType.mjs +0 -3
  300. package/dist/types/RepeatType.mjs.map +1 -1
  301. package/dist/types/index.d.mts +5 -4
  302. package/dist/types/index.d.ts +5 -4
  303. package/dist/types/index.js +0 -15
  304. package/dist/types/index.js.map +1 -1
  305. package/dist/types/index.mjs +1 -13
  306. package/dist/types/index.mjs.map +1 -1
  307. package/dist/types/ticker/{TickerFadeAlphaProps.d.mts → FadeAlphaTickerProps.d.mts} +9 -5
  308. package/dist/types/ticker/{TickerFadeAlphaProps.d.ts → FadeAlphaTickerProps.d.ts} +9 -5
  309. package/dist/types/ticker/FadeAlphaTickerProps.js +4 -0
  310. package/dist/types/ticker/FadeAlphaTickerProps.js.map +1 -0
  311. package/dist/types/ticker/FadeAlphaTickerProps.mjs +3 -0
  312. package/dist/types/ticker/FadeAlphaTickerProps.mjs.map +1 -0
  313. package/dist/types/ticker/MoveTickerProps.d.mts +35 -0
  314. package/dist/types/ticker/MoveTickerProps.d.ts +35 -0
  315. package/dist/types/ticker/{TickerRotateProps.js → MoveTickerProps.js} +1 -1
  316. package/dist/types/ticker/MoveTickerProps.js.map +1 -0
  317. package/dist/types/ticker/MoveTickerProps.mjs +3 -0
  318. package/dist/types/ticker/MoveTickerProps.mjs.map +1 -0
  319. package/dist/types/ticker/{TickerRotateProps.d.mts → RotateTickerProps.d.mts} +11 -5
  320. package/dist/types/ticker/{TickerRotateProps.d.ts → RotateTickerProps.d.ts} +11 -5
  321. package/dist/types/ticker/RotateTickerProps.js +4 -0
  322. package/dist/types/ticker/RotateTickerProps.js.map +1 -0
  323. package/dist/types/ticker/RotateTickerProps.mjs +3 -0
  324. package/dist/types/ticker/RotateTickerProps.mjs.map +1 -0
  325. package/dist/types/ticker/TagToRemoveAfterType.d.mts +4 -0
  326. package/dist/types/ticker/TagToRemoveAfterType.d.ts +4 -0
  327. package/dist/types/ticker/TagToRemoveAfterType.js +8 -0
  328. package/dist/types/ticker/TagToRemoveAfterType.js.map +1 -0
  329. package/dist/types/ticker/TagToRemoveAfterType.mjs +6 -0
  330. package/dist/types/ticker/TagToRemoveAfterType.mjs.map +1 -0
  331. package/dist/types/ticker/ZoomTickerProps.d.mts +45 -0
  332. package/dist/types/ticker/ZoomTickerProps.d.ts +45 -0
  333. package/dist/types/ticker/ZoomTickerProps.js +4 -0
  334. package/dist/types/ticker/ZoomTickerProps.js.map +1 -0
  335. package/dist/types/ticker/ZoomTickerProps.mjs +3 -0
  336. package/dist/types/ticker/ZoomTickerProps.mjs.map +1 -0
  337. package/dist/types/ticker/index.d.mts +4 -2
  338. package/dist/types/ticker/index.d.ts +4 -2
  339. package/package.json +7 -7
  340. package/dist/classes/ticker/TickerFadeAlpha.d.mts +0 -31
  341. package/dist/classes/ticker/TickerFadeAlpha.d.ts +0 -31
  342. package/dist/classes/ticker/TickerFadeAlpha.js.map +0 -1
  343. package/dist/classes/ticker/TickerFadeAlpha.mjs.map +0 -1
  344. package/dist/classes/ticker/TickerMove.d.mts +0 -29
  345. package/dist/classes/ticker/TickerMove.d.ts +0 -29
  346. package/dist/classes/ticker/TickerMove.js.map +0 -1
  347. package/dist/classes/ticker/TickerMove.mjs.map +0 -1
  348. package/dist/classes/ticker/TickerRotate.d.mts +0 -30
  349. package/dist/classes/ticker/TickerRotate.d.ts +0 -30
  350. package/dist/classes/ticker/TickerRotate.js.map +0 -1
  351. package/dist/classes/ticker/TickerRotate.mjs.map +0 -1
  352. package/dist/functions/ErrorUtility.d.mts +0 -24
  353. package/dist/functions/ErrorUtility.d.ts +0 -24
  354. package/dist/functions/ErrorUtility.js +0 -261
  355. package/dist/functions/ErrorUtility.js.map +0 -1
  356. package/dist/functions/ErrorUtility.mjs +0 -258
  357. package/dist/functions/ErrorUtility.mjs.map +0 -1
  358. package/dist/interface/IClassWithArgsHistory.js +0 -4
  359. package/dist/interface/IClassWithArgsHistory.mjs +0 -3
  360. package/dist/types/ticker/TickerFadeAlphaProps.js +0 -4
  361. package/dist/types/ticker/TickerFadeAlphaProps.mjs +0 -3
  362. package/dist/types/ticker/TickerMoveProps.d.mts +0 -26
  363. package/dist/types/ticker/TickerMoveProps.d.ts +0 -26
  364. package/dist/types/ticker/TickerMoveProps.mjs +0 -3
  365. package/dist/types/ticker/TickerRotateProps.mjs +0 -3
  366. /package/dist/interface/{IClassWithArgsHistory.js.map → CharacterBaseModelProps.js.map} +0 -0
  367. /package/dist/interface/{IClassWithArgsHistory.mjs.map → CharacterBaseModelProps.mjs.map} +0 -0
  368. /package/dist/{types/ticker/TickerFadeAlphaProps.js.map → interface/TickerHistory.js.map} +0 -0
  369. /package/dist/{types/ticker/TickerFadeAlphaProps.mjs.map → interface/TickerHistory.mjs.map} +0 -0
  370. /package/dist/{types/ticker/TickerMoveProps.js.map → interface/TickerTimeoutHistory.js.map} +0 -0
  371. /package/dist/{types/ticker/TickerMoveProps.mjs.map → interface/TickerTimeoutHistory.mjs.map} +0 -0
  372. /package/dist/types/{ticker/TickerRotateProps.js.map → HistoryChoiceMenuOption.js.map} +0 -0
  373. /package/dist/types/{ticker/TickerRotateProps.mjs.map → HistoryChoiceMenuOption.mjs.map} +0 -0
@@ -0,0 +1,3199 @@
1
+ 'use strict';
2
+
3
+ var deepDiff = require('deep-diff');
4
+ var sha1 = require('crypto-js/sha1');
5
+ var pixi_js = require('pixi.js');
6
+
7
+ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
8
+
9
+ var sha1__default = /*#__PURE__*/_interopDefault(sha1);
10
+
11
+ var __defProp = Object.defineProperty;
12
+ var __defProps = Object.defineProperties;
13
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
14
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
15
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
16
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
17
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
18
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
19
+ var __spreadValues = (a, b) => {
20
+ for (var prop in b || (b = {}))
21
+ if (__hasOwnProp.call(b, prop))
22
+ __defNormalProp(a, prop, b[prop]);
23
+ if (__getOwnPropSymbols)
24
+ for (var prop of __getOwnPropSymbols(b)) {
25
+ if (__propIsEnum.call(b, prop))
26
+ __defNormalProp(a, prop, b[prop]);
27
+ }
28
+ return a;
29
+ };
30
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
31
+ var __decorateClass = (decorators, target, key, kind) => {
32
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
33
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
34
+ if (decorator = decorators[i])
35
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
36
+ if (kind && result) __defProp(target, key, result);
37
+ return result;
38
+ };
39
+ var __async = (__this, __arguments, generator) => {
40
+ return new Promise((resolve, reject) => {
41
+ var fulfilled = (value) => {
42
+ try {
43
+ step(generator.next(value));
44
+ } catch (e) {
45
+ reject(e);
46
+ }
47
+ };
48
+ var rejected = (value) => {
49
+ try {
50
+ step(generator.throw(value));
51
+ } catch (e) {
52
+ reject(e);
53
+ }
54
+ };
55
+ var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
56
+ step((generator = generator.apply(__this, __arguments)).next());
57
+ });
58
+ };
59
+ function getStepSha1(step) {
60
+ let sha1String = sha1__default.default(step.toString().toLocaleLowerCase());
61
+ return sha1String.toString();
62
+ }
63
+ function checkIfStepsIsEqual(step1, step2) {
64
+ return step1 === step2;
65
+ }
66
+
67
+ // src/classes/Label.ts
68
+ var Label = class {
69
+ /**
70
+ * @param id is the id of the label
71
+ * @param steps is the list of steps that the label will perform
72
+ * @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
73
+ * @param choiseIndex is the index of the choice that the label will perform
74
+ */
75
+ constructor(id, steps, onStepRun, choiseIndex) {
76
+ this._id = id;
77
+ this._steps = steps;
78
+ this._onStepRun = onStepRun;
79
+ this._choiseIndex = choiseIndex;
80
+ }
81
+ /**
82
+ * Get the id of the label
83
+ */
84
+ get id() {
85
+ return this._id;
86
+ }
87
+ /**
88
+ * Get the steps of the label.
89
+ * This class should be extended and the steps method should be overridden.
90
+ * Every time you update this list will also be updated when the other game versions load.
91
+ */
92
+ get steps() {
93
+ if (typeof this._steps === "function") {
94
+ return this._steps();
95
+ }
96
+ return this._steps;
97
+ }
98
+ /**
99
+ * Get the corresponding steps number
100
+ * @param externalSteps
101
+ * @returns Numer of corresponding steps, for example, if externalSteps is [ABC, DEF, GHI] and the steps of the label is [ABC, GHT], the result will be 1
102
+ */
103
+ getCorrespondingStepsNumber(externalSteps) {
104
+ if (externalSteps.length === 0) {
105
+ return 0;
106
+ }
107
+ let res = 0;
108
+ externalSteps.forEach((step, index) => {
109
+ if (checkIfStepsIsEqual(step, this.steps[index])) {
110
+ res = index;
111
+ }
112
+ });
113
+ return res;
114
+ }
115
+ /**
116
+ * 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
117
+ * @returns Promise<void> or void
118
+ * @example
119
+ * ```typescript
120
+ * newLabel("id", [], () => {
121
+ * Assets.load('path/to/image1.png')
122
+ * Assets.load('path/to/image2.png')
123
+ * })
124
+ * ```
125
+ */
126
+ get onStepRun() {
127
+ return this._onStepRun;
128
+ }
129
+ get choiseIndex() {
130
+ return this._choiseIndex;
131
+ }
132
+ };
133
+
134
+ // src/classes/CloseLabel.ts
135
+ var CLOSE_LABEL_ID = "__close-label-id__";
136
+ function newCloseLabel(choiseIndex) {
137
+ return new Label(CLOSE_LABEL_ID, [], void 0, choiseIndex);
138
+ }
139
+
140
+ // src/decorators/LabelDecorator.ts
141
+ var registeredLabels = {};
142
+ function newLabel(id, steps, onStepRun) {
143
+ if (registeredLabels[id]) {
144
+ console.info(`[Pixi'VN] Label ${id} already exists, it will be overwritten`);
145
+ }
146
+ let label = new Label(id, steps, onStepRun);
147
+ registeredLabels[id] = label;
148
+ return label;
149
+ }
150
+ function getLabelById(id) {
151
+ let label = registeredLabels[id];
152
+ if (!label) {
153
+ console.error(`[Pixi'VN] Label ${id} not found`);
154
+ return;
155
+ }
156
+ return label;
157
+ }
158
+
159
+ // src/functions/CanvasUtility.ts
160
+ function getTextureMemory(texture) {
161
+ let sourceTexture = texture.source;
162
+ let textureMemory = {
163
+ image: sourceTexture.label
164
+ };
165
+ return textureMemory;
166
+ }
167
+ function exportCanvasElement(element) {
168
+ return element.memory;
169
+ }
170
+ function importCanvasElement(memory) {
171
+ let element = getCanvasElementInstanceByClassName(memory.className);
172
+ if (element) {
173
+ element.memory = memory;
174
+ } else {
175
+ throw new Error("[Pixi'VN] The element " + memory.className + " could not be created");
176
+ }
177
+ return element;
178
+ }
179
+
180
+ // src/classes/canvas/CanvasContainer.ts
181
+ var CanvasContainer = class extends pixi_js.Container {
182
+ get memory() {
183
+ let memory = getMemoryContainer(this);
184
+ this.children.forEach((child) => {
185
+ memory.elements.push(exportCanvasElement(child));
186
+ });
187
+ return memory;
188
+ }
189
+ set memory(value) {
190
+ setMemoryContainer(this, value);
191
+ value.elements.forEach((child) => {
192
+ this.addChild(importCanvasElement(child));
193
+ });
194
+ }
195
+ };
196
+ function getMemoryContainer(element) {
197
+ return {
198
+ className: "CanvasContainer",
199
+ elements: [],
200
+ width: element.width,
201
+ height: element.height,
202
+ isRenderGroup: element.isRenderGroup,
203
+ blendMode: element.blendMode,
204
+ tint: element.tint,
205
+ alpha: element.alpha,
206
+ angle: element.angle,
207
+ renderable: element.renderable,
208
+ rotation: element.rotation,
209
+ scale: { x: element.scale.x, y: element.scale.y },
210
+ pivot: { x: element.pivot.x, y: element.pivot.y },
211
+ position: { x: element.position.x, y: element.position.y },
212
+ skew: { x: element.skew.x, y: element.skew.y },
213
+ visible: element.visible,
214
+ culled: element.culled,
215
+ x: element.x,
216
+ y: element.y,
217
+ boundsArea: element.boundsArea,
218
+ cursor: element.cursor,
219
+ eventMode: element.eventMode,
220
+ interactive: element.interactive,
221
+ interactiveChildren: element.interactiveChildren,
222
+ hitArea: element.hitArea
223
+ };
224
+ }
225
+ function setMemoryContainer(element, memory) {
226
+ memory.width && (element.width = memory.width);
227
+ memory.height && (element.height = memory.height);
228
+ memory.isRenderGroup && (element.isRenderGroup = memory.isRenderGroup);
229
+ memory.blendMode && (element.blendMode = memory.blendMode);
230
+ memory.tint && (element.tint = memory.tint);
231
+ memory.alpha && (element.alpha = memory.alpha);
232
+ memory.angle && (element.angle = memory.angle);
233
+ memory.renderable && (element.renderable = memory.renderable);
234
+ memory.rotation && (element.rotation = memory.rotation);
235
+ if (memory.scale) {
236
+ if (typeof memory.scale === "number") {
237
+ element.scale.set(memory.scale, memory.scale);
238
+ } else {
239
+ element.scale.set(memory.scale.x, memory.scale.y);
240
+ }
241
+ }
242
+ if (memory.pivot) {
243
+ if (typeof memory.pivot === "number") {
244
+ element.pivot.set(memory.pivot, memory.pivot);
245
+ } else {
246
+ element.pivot.set(memory.pivot.x, memory.pivot.y);
247
+ }
248
+ }
249
+ memory.position && element.position.set(memory.position.x, memory.position.y);
250
+ memory.skew && element.skew.set(memory.skew.x, memory.skew.y);
251
+ memory.visible && (element.visible = memory.visible);
252
+ memory.culled && (element.culled = memory.culled);
253
+ memory.x && (element.x = memory.x);
254
+ memory.y && (element.y = memory.y);
255
+ memory.boundsArea && (element.boundsArea = memory.boundsArea);
256
+ memory.cursor && (element.cursor = memory.cursor);
257
+ memory.eventMode && (element.eventMode = memory.eventMode);
258
+ memory.interactive && (element.interactive = memory.interactive);
259
+ memory.interactiveChildren && (element.interactiveChildren = memory.interactiveChildren);
260
+ memory.hitArea && (element.hitArea = memory.hitArea);
261
+ }
262
+ function getTexture(imageUrl) {
263
+ return __async(this, null, function* () {
264
+ if (pixi_js.Assets.cache.has(imageUrl)) {
265
+ return pixi_js.Assets.get(imageUrl);
266
+ }
267
+ return pixi_js.Assets.load(imageUrl).then((texture) => {
268
+ if (!texture) {
269
+ console.error("[Pixi'VN] Texture not found", imageUrl);
270
+ return;
271
+ }
272
+ if (!(texture instanceof pixi_js.Texture)) {
273
+ console.error("[Pixi'VN] File not is a image", imageUrl);
274
+ return;
275
+ }
276
+ return texture;
277
+ }).catch((e) => {
278
+ console.error("[Pixi'VN] Error loading image", e);
279
+ return;
280
+ });
281
+ });
282
+ }
283
+ function getTextStyle(style) {
284
+ let fill = style.fill;
285
+ if (fill instanceof Object) {
286
+ console.warn("[Pixi'VN] CanvasText.style.fill is a FillGradient or FillPattern, this is not supported yet.", fill);
287
+ fill = "#00FF00";
288
+ }
289
+ return {
290
+ align: style.align,
291
+ breakWords: style.breakWords,
292
+ dropShadow: style.dropShadow,
293
+ fill,
294
+ fontFamily: style.fontFamily,
295
+ fontSize: style.fontSize,
296
+ fontStyle: style.fontStyle,
297
+ fontVariant: style.fontVariant,
298
+ fontWeight: style.fontWeight,
299
+ leading: style.leading,
300
+ letterSpacing: style.letterSpacing,
301
+ lineHeight: style.lineHeight,
302
+ padding: style.padding,
303
+ stroke: style.stroke,
304
+ textBaseline: style.textBaseline,
305
+ trim: style.trim,
306
+ whiteSpace: style.whiteSpace,
307
+ wordWrap: style.wordWrap,
308
+ wordWrapWidth: style.wordWrapWidth
309
+ };
310
+ }
311
+
312
+ // src/decorators/EventDecorator.ts
313
+ var registeredEvents = {};
314
+ function getEventTypeByClassName(eventName) {
315
+ try {
316
+ let eventType = registeredEvents[eventName];
317
+ if (!eventType) {
318
+ console.error(`[Pixi'VN] Event ${eventName} not found`);
319
+ return;
320
+ }
321
+ new eventType();
322
+ return eventType;
323
+ } catch (e) {
324
+ console.error(`[Pixi'VN] Error while getting Event ${eventName}`, e);
325
+ return;
326
+ }
327
+ }
328
+ function getEventInstanceByClassName(eventName) {
329
+ try {
330
+ let eventType = registeredEvents[eventName];
331
+ if (!eventType) {
332
+ console.error(`[Pixi'VN] Event ${eventName} not found`);
333
+ return;
334
+ }
335
+ let event = new eventType();
336
+ return event;
337
+ } catch (e) {
338
+ console.error(`[Pixi'VN] Error while getting Event ${eventName}`, e);
339
+ return;
340
+ }
341
+ }
342
+
343
+ // src/classes/canvas/CanvasSprite.ts
344
+ var CanvasSprite = class _CanvasSprite extends pixi_js.Sprite {
345
+ constructor() {
346
+ super(...arguments);
347
+ this._onEvents = {};
348
+ }
349
+ get memory() {
350
+ return getMemorySprite(this);
351
+ }
352
+ set memory(value) {
353
+ setMemorySprite(this, value);
354
+ }
355
+ get onEvents() {
356
+ return this._onEvents;
357
+ }
358
+ /**
359
+ * is same function as on(), but it keeps in memory the children.
360
+ * @param event The event type, e.g., 'click', 'mousedown', 'mouseup', 'pointerdown', etc.
361
+ * @param eventClass The class that extends CanvasEvent.
362
+ * @returns
363
+ * @example
364
+ * ```typescript
365
+ * \@eventDecorator()
366
+ * export class EventTest extends CanvasEvent<CanvasSprite> {
367
+ * override fn(event: CanvasEventNamesType, sprite: CanvasSprite): void {
368
+ * if (event === 'pointerdown') {
369
+ * sprite.scale.x *= 1.25;
370
+ * sprite.scale.y *= 1.25;
371
+ * }
372
+ * }
373
+ * }
374
+ * ```
375
+ *
376
+ * ```typescript
377
+ * let sprite = addImage("alien", 'https://pixijs.com/assets/eggHead.png')
378
+ * await sprite.load()
379
+ *
380
+ * sprite.eventMode = 'static';
381
+ * sprite.cursor = 'pointer';
382
+ * sprite.onEvent('pointerdown', EventTest);
383
+ *
384
+ * GameWindowManager.addCanvasElement("bunny", sprite);
385
+ * ```
386
+ */
387
+ onEvent(event, eventClass) {
388
+ let className = eventClass.name;
389
+ let instance = getEventInstanceByClassName(className);
390
+ this._onEvents[event] = className;
391
+ if (instance) {
392
+ super.on(event, () => {
393
+ instance.fn(event, this);
394
+ });
395
+ }
396
+ return this;
397
+ }
398
+ /**
399
+ * on() does not keep in memory the event class, use onEvent() instead
400
+ * @deprecated
401
+ * @private
402
+ * @param event
403
+ * @param fn
404
+ * @param context
405
+ */
406
+ on(event, fn, context) {
407
+ return super.on(event, fn, context);
408
+ }
409
+ static from(source, skipCache) {
410
+ let sprite = pixi_js.Sprite.from(source, skipCache);
411
+ let mySprite = new _CanvasSprite();
412
+ mySprite.texture = sprite.texture;
413
+ return mySprite;
414
+ }
415
+ };
416
+ function getMemorySprite(element) {
417
+ let temp = getMemoryContainer(element);
418
+ return __spreadProps(__spreadValues({}, temp), {
419
+ className: "CanvasSprite",
420
+ textureImage: getTextureMemory(element.texture),
421
+ anchor: { x: element.anchor.x, y: element.anchor.y },
422
+ roundPixels: element.roundPixels,
423
+ onEvents: element.onEvents
424
+ });
425
+ }
426
+ function setMemorySprite(element, memory) {
427
+ setMemoryContainer(element, memory);
428
+ getTexture(memory.textureImage.image).then((texture) => {
429
+ if (texture) {
430
+ element.texture = texture;
431
+ }
432
+ });
433
+ if (memory.anchor) {
434
+ if (typeof memory.anchor === "number") {
435
+ element.anchor.set(memory.anchor, memory.anchor);
436
+ } else {
437
+ element.anchor.set(memory.anchor.x, memory.anchor.y);
438
+ }
439
+ }
440
+ memory.roundPixels && (element.roundPixels = memory.roundPixels);
441
+ for (let event in memory.onEvents) {
442
+ let className = memory.onEvents[event];
443
+ let instance = getEventTypeByClassName(className);
444
+ if (instance) {
445
+ element.onEvent(event, instance);
446
+ }
447
+ }
448
+ }
449
+
450
+ // src/classes/canvas/CanvasImage.ts
451
+ var CanvasImage = class _CanvasImage extends CanvasSprite {
452
+ constructor(options, imageLink) {
453
+ super(options);
454
+ this.imageLink = "";
455
+ if (imageLink) {
456
+ this.imageLink = imageLink;
457
+ }
458
+ }
459
+ get memory() {
460
+ return __spreadProps(__spreadValues({}, getMemorySprite(this)), {
461
+ className: "CanvasImage",
462
+ textureImage: { image: this.imageLink }
463
+ });
464
+ }
465
+ set memory(memory) {
466
+ setMemorySprite(this, memory);
467
+ }
468
+ static from(source, skipCache) {
469
+ let sprite = pixi_js.Sprite.from(source, skipCache);
470
+ let mySprite = new _CanvasImage();
471
+ mySprite.texture = sprite.texture;
472
+ return mySprite;
473
+ }
474
+ /**
475
+ * Load the image from the link and set the texture of the sprite.
476
+ * @param image The link of the image. If it is not set, it will use the imageLink property.
477
+ * @returns A promise that resolves when the image is loaded.
478
+ */
479
+ load(image) {
480
+ return __async(this, null, function* () {
481
+ if (!image) {
482
+ image = this.imageLink;
483
+ }
484
+ return getTexture(this.imageLink).then((texture) => {
485
+ if (texture) {
486
+ this.texture = texture;
487
+ }
488
+ }).catch((e) => {
489
+ console.error("[Pixi'VN] Error into CanvasImage.load()", e);
490
+ });
491
+ });
492
+ }
493
+ };
494
+ var CanvasText = class extends pixi_js.Text {
495
+ constructor() {
496
+ super(...arguments);
497
+ this._onEvents = {};
498
+ }
499
+ get memory() {
500
+ return getMemoryText(this);
501
+ }
502
+ set memory(value) {
503
+ setMemoryText(this, value);
504
+ }
505
+ get onEvents() {
506
+ return this._onEvents;
507
+ }
508
+ /**
509
+ * is same function as on(), but it keeps in memory the children.
510
+ * @param event The event type, e.g., 'click', 'mousedown', 'mouseup', 'pointerdown', etc.
511
+ * @param eventClass The class that extends CanvasEvent.
512
+ * @returns
513
+ * @example
514
+ * ```typescript
515
+ * \@eventDecorator()
516
+ * export class EventTest extends CanvasEvent<CanvasText> {
517
+ * override fn(event: CanvasEventNamesType, text: CanvasText): void {
518
+ * if (event === 'pointerdown') {
519
+ * text.scale.x *= 1.25;
520
+ * text.scale.y *= 1.25;
521
+ * }
522
+ * }
523
+ * }
524
+ * ```
525
+ *
526
+ * ```typescript
527
+ * const text = new CanvasText();
528
+ * text.text = "Hello World"
529
+ *
530
+ * text.eventMode = 'static';
531
+ * text.cursor = 'pointer';
532
+ * text.onEvent('pointerdown', EventTest);
533
+ *
534
+ * GameWindowManager.addCanvasElement("text", text);
535
+ * ```
536
+ */
537
+ onEvent(event, eventClass) {
538
+ let className = eventClass.name;
539
+ let instance = getEventInstanceByClassName(className);
540
+ this._onEvents[event] = className;
541
+ if (instance) {
542
+ super.on(event, () => {
543
+ instance.fn(event, this);
544
+ });
545
+ }
546
+ return this;
547
+ }
548
+ /**
549
+ * on() does not keep in memory the event class, use onEvent() instead
550
+ * @deprecated
551
+ * @private
552
+ * @param event
553
+ * @param fn
554
+ * @param context
555
+ */
556
+ on(event, fn, context) {
557
+ return super.on(event, fn, context);
558
+ }
559
+ };
560
+ function getMemoryText(element) {
561
+ let temp = getMemoryContainer(element);
562
+ return __spreadProps(__spreadValues({}, temp), {
563
+ className: "CanvasText",
564
+ anchor: { x: element.anchor.x, y: element.anchor.y },
565
+ text: element.text,
566
+ resolution: element.resolution,
567
+ style: getTextStyle(element.style),
568
+ roundPixels: element.roundPixels,
569
+ onEvents: element.onEvents
570
+ });
571
+ }
572
+ function setMemoryText(element, memory) {
573
+ setMemoryContainer(element, memory);
574
+ if (memory.anchor) {
575
+ if (typeof memory.anchor === "number") {
576
+ element.anchor.set(memory.anchor, memory.anchor);
577
+ } else {
578
+ element.anchor.set(memory.anchor.x, memory.anchor.y);
579
+ }
580
+ }
581
+ memory.text && (element.text = memory.text);
582
+ memory.resolution && (element.resolution = memory.resolution);
583
+ memory.style && (element.style = memory.style);
584
+ memory.roundPixels && (element.roundPixels = memory.roundPixels);
585
+ for (let event in memory.onEvents) {
586
+ let className = memory.onEvents[event];
587
+ let instance = getEventTypeByClassName(className);
588
+ if (instance) {
589
+ element.onEvent(event, instance);
590
+ }
591
+ }
592
+ }
593
+
594
+ // src/decorators/CanvasElementDecorator.ts
595
+ var registeredCanvasElement = {};
596
+ function getCanvasElementInstanceByClassName(canvasName) {
597
+ try {
598
+ let eventType = registeredCanvasElement[canvasName];
599
+ if (!eventType) {
600
+ if (canvasName === "CanvasContainer") {
601
+ eventType = CanvasContainer;
602
+ } else if (canvasName === "CanvasImage") {
603
+ eventType = CanvasImage;
604
+ } else if (canvasName === "CanvasSprite") {
605
+ eventType = CanvasSprite;
606
+ } else if (canvasName === "CanvasText") {
607
+ eventType = CanvasText;
608
+ }
609
+ }
610
+ if (!eventType) {
611
+ console.error(`[Pixi'VN] CanvasElement ${canvasName} not found`);
612
+ return;
613
+ }
614
+ let canvasElement = new eventType();
615
+ return canvasElement;
616
+ } catch (e) {
617
+ console.error(`[Pixi'VN] Error while getting CanvasElement ${canvasName}`, e);
618
+ return;
619
+ }
620
+ }
621
+
622
+ // src/decorators/CharacterDecorator.ts
623
+ var registeredCharacters = {};
624
+ function saveCharacter(character) {
625
+ if (Array.isArray(character)) {
626
+ character.forEach((c) => saveCharacter(c));
627
+ return;
628
+ }
629
+ if (registeredCharacters[character.id]) {
630
+ console.info(`[Pixi'VN] Character id ${character.id} already exists, it will be overwritten`);
631
+ }
632
+ registeredCharacters[character.id] = character;
633
+ }
634
+
635
+ // src/decorators/TickerDecorator.ts
636
+ var registeredTickers = {};
637
+ function tickerDecorator(name) {
638
+ return function(target) {
639
+ if (!name) {
640
+ name = target.name;
641
+ }
642
+ if (registeredTickers[name]) {
643
+ console.info(`[Pixi'VN] Ticker ${name} already exists, it will be overwritten`);
644
+ }
645
+ registeredTickers[name] = target;
646
+ };
647
+ }
648
+ function geTickerInstanceByClassName(tickerName, args, duration, priority) {
649
+ try {
650
+ let ticker = registeredTickers[tickerName];
651
+ if (!ticker) {
652
+ console.error(`[Pixi'VN] Ticker ${tickerName} not found`);
653
+ return;
654
+ }
655
+ return new ticker(args, duration, priority);
656
+ } catch (e) {
657
+ console.error(`[Pixi'VN] Error while getting Ticker ${tickerName}`, e);
658
+ return;
659
+ }
660
+ }
661
+
662
+ // src/types/CloseType.ts
663
+ var Close = "close";
664
+
665
+ // src/classes/ChoiceMenuOption.ts
666
+ var ChoiceMenuOption = class {
667
+ /**
668
+ * @param text Text to be displayed in the menu
669
+ * @param label Label to be opened when the option is selected or the id of the label
670
+ * @param type Type of the label to be opened. @default "call"
671
+ * @param props Properties to be passed to the label, when the label is called. it cannot contain functions or classes. @default {}
672
+ */
673
+ constructor(text, label, type = "call", props) {
674
+ /**
675
+ * Properties to be passed to the label
676
+ */
677
+ this.props = {};
678
+ if (typeof label === "string") {
679
+ let tLabel = getLabelById(label);
680
+ if (!tLabel) {
681
+ throw new Error(`[Pixi'VN] Label ${label} not found`);
682
+ } else {
683
+ label = tLabel;
684
+ }
685
+ }
686
+ this.text = text;
687
+ this.label = label;
688
+ this.type = type;
689
+ if (props) {
690
+ this.props = props;
691
+ }
692
+ }
693
+ };
694
+ var ChoiceMenuOptionClose = class {
695
+ /**
696
+ * @param text Text to be displayed in the menu
697
+ * @param closeCurrentLabel If true, the current label will be closed. @default false
698
+ */
699
+ constructor(text, closeCurrentLabel = false) {
700
+ /**
701
+ * Label to be opened when the option is selected
702
+ */
703
+ this.label = newCloseLabel();
704
+ /**
705
+ * Type of the label to be opened
706
+ */
707
+ this.type = Close;
708
+ /**
709
+ * Properties to be passed to the label
710
+ */
711
+ this.props = {};
712
+ this.text = text;
713
+ this.closeCurrentLabel = closeCurrentLabel;
714
+ }
715
+ };
716
+
717
+ // src/functions/DialogueUtility.ts
718
+ function setDialogue(props) {
719
+ let text = "";
720
+ let characterId = void 0;
721
+ let dialogue;
722
+ if (typeof props === "string") {
723
+ text = props;
724
+ dialogue = new DialogueBaseModel(text, characterId);
725
+ } else if (!(props instanceof DialogueBaseModel)) {
726
+ text = props.text;
727
+ if (props.character) {
728
+ if (typeof props.character === "string") {
729
+ characterId = props.character;
730
+ } else {
731
+ characterId = props.character.id;
732
+ }
733
+ }
734
+ dialogue = new DialogueBaseModel(text, characterId);
735
+ } else {
736
+ dialogue = props;
737
+ }
738
+ GameStorageManager.setVariable(GameStorageManager.keysSystem.CURRENT_DIALOGUE_MEMORY_KEY, dialogue);
739
+ GameStorageManager.setVariable(GameStorageManager.keysSystem.LAST_DIALOGUE_ADDED_IN_STEP_MEMORY_KEY, GameStepManager.lastStepIndex);
740
+ }
741
+ function getDialogue() {
742
+ return GameStorageManager.getVariable(GameStorageManager.keysSystem.CURRENT_DIALOGUE_MEMORY_KEY);
743
+ }
744
+ function setChoiceMenuOptions(options) {
745
+ let value = options.map((option) => {
746
+ if (option instanceof ChoiceMenuOptionClose) {
747
+ return {
748
+ text: option.text,
749
+ type: Close,
750
+ closeCurrentLabel: option.closeCurrentLabel
751
+ };
752
+ }
753
+ return __spreadProps(__spreadValues({}, option), {
754
+ label: option.label.id
755
+ });
756
+ });
757
+ GameStorageManager.setVariable(GameStorageManager.keysSystem.CURRENT_MENU_OPTIONS_MEMORY_KEY, value);
758
+ GameStorageManager.setVariable(GameStorageManager.keysSystem.LAST_MENU_OPTIONS_ADDED_IN_STEP_MEMORY_KEY, GameStepManager.lastStepIndex);
759
+ }
760
+
761
+ // src/classes/ticker/TickerBase.ts
762
+ var TickerBase = class {
763
+ /**
764
+ * @param args The arguments that you want to pass to the ticker.
765
+ * @param duration The duration of the ticker in seconds. If is undefined, the step will end only when the animation is finished (if the animation doesn't have a goal to reach then it won't finish). @default undefined
766
+ * @param priority The priority of the ticker. @default UPDATE_PRIORITY.NORMAL
767
+ */
768
+ constructor(args, duration, priority) {
769
+ this.args = args;
770
+ this.duration = duration;
771
+ this.priority = priority;
772
+ }
773
+ /**
774
+ * The method that will be called every frame.
775
+ * This method should be overridden and you can use GameWindowManager.addCanvasElement() to get the canvas element of the canvas, and edit them.
776
+ * @param _ticker The ticker that is calling this method
777
+ * @param _args The arguments that you passed when you added the ticker
778
+ * @param _tags The tags of the canvas elements that are connected to this ticker
779
+ * @param _tickerId The id of the ticker. You can use this to get the ticker from the {@link GameWindowManager.currentTickers}
780
+ */
781
+ fn(_ticker, _args, _tags, _tickerId) {
782
+ throw new Error("[Pixi'VN] The method TickerBase.fn() must be overridden");
783
+ }
784
+ };
785
+
786
+ // src/classes/ticker/FadeAlphaTicker.ts
787
+ var FadeAlphaTicker = class extends TickerBase {
788
+ fn(ticker, args, tags, tickerId) {
789
+ let type = args.type === void 0 ? "hide" : args.type;
790
+ let duration = args.duration === void 0 ? 1 : args.duration;
791
+ let speed = 1 / (duration * 60);
792
+ let limit = args.limit === void 0 ? type === "hide" ? 0 : 1 : args.limit;
793
+ let tagToRemoveAfter2 = args.tagToRemoveAfter || [];
794
+ if (typeof tagToRemoveAfter2 === "string") {
795
+ tagToRemoveAfter2 = [tagToRemoveAfter2];
796
+ }
797
+ if (type === "hide" && limit < 0) {
798
+ limit = 0;
799
+ }
800
+ if (type === "show" && limit > 1) {
801
+ limit = 1;
802
+ }
803
+ tags.filter((tag) => {
804
+ var _a;
805
+ let element = GameWindowManager.getCanvasElement(tag);
806
+ if (args.startOnlyIfHaveTexture) {
807
+ if (element && element instanceof pixi_js.Sprite && ((_a = element.texture) == null ? void 0 : _a.label) == "EMPTY") {
808
+ return false;
809
+ }
810
+ }
811
+ return true;
812
+ }).forEach((tag) => {
813
+ let element = GameWindowManager.getCanvasElement(tag);
814
+ if (element && element instanceof pixi_js.Container) {
815
+ if (type === "show" && element.alpha < limit) {
816
+ element.alpha += speed * ticker.deltaTime;
817
+ } else if (type === "hide" && element.alpha > limit) {
818
+ element.alpha -= speed * ticker.deltaTime;
819
+ }
820
+ if (type === "show" && element.alpha >= limit) {
821
+ element.alpha = limit;
822
+ GameWindowManager.onEndOfTicker(tag, this, tagToRemoveAfter2, tickerId);
823
+ } else if (type === "hide" && element.alpha <= limit) {
824
+ element.alpha = limit;
825
+ GameWindowManager.onEndOfTicker(tag, this, tagToRemoveAfter2, tickerId);
826
+ }
827
+ }
828
+ });
829
+ }
830
+ };
831
+ FadeAlphaTicker = __decorateClass([
832
+ tickerDecorator()
833
+ ], FadeAlphaTicker);
834
+
835
+ // src/functions/TickerUtility.ts
836
+ function updateTickerProgression(args, propertyName, progression) {
837
+ if (args[propertyName] === void 0 || !progression || args[propertyName] === progression.limit) {
838
+ return;
839
+ }
840
+ if (typeof args[propertyName] === "number") {
841
+ if (progression.type === "linear") {
842
+ args[propertyName] = getLinearProgression(args[propertyName], progression);
843
+ } else if (progression.type === "exponential") {
844
+ args[propertyName] = getExponentialProgression(args[propertyName], progression);
845
+ }
846
+ } else if (args[propertyName] !== void 0 && typeof args[propertyName] === "object" && args[propertyName].haveOwnProperty("x") && args[propertyName].haveOwnProperty("y") && typeof args[propertyName].x === "number" && typeof args[propertyName].y === "number") {
847
+ if (progression.type === "linear") {
848
+ args[propertyName].x = getLinearProgression(args[propertyName].x, progression);
849
+ args[propertyName].y = getLinearProgression(args[propertyName].y, progression);
850
+ } else if (progression.type === "exponential") {
851
+ args[propertyName].x = getExponentialProgression(args[propertyName].x, progression);
852
+ args[propertyName].y = getExponentialProgression(args[propertyName].y, progression);
853
+ }
854
+ }
855
+ }
856
+ function getLinearProgression(number, progression) {
857
+ if (progression.limit !== void 0) {
858
+ if (number > progression.limit && progression.amt > 0) {
859
+ return progression.limit;
860
+ } else if (number < progression.limit && progression.amt < 0) {
861
+ return progression.limit;
862
+ }
863
+ }
864
+ return number + progression.amt / 60;
865
+ }
866
+ function getExponentialProgression(number, progression) {
867
+ if (progression.limit !== void 0) {
868
+ if (number > progression.limit && progression.percentage > 0) {
869
+ return progression.limit;
870
+ } else if (number < progression.limit && progression.percentage < 0) {
871
+ return progression.limit;
872
+ }
873
+ }
874
+ return number + number * progression.percentage;
875
+ }
876
+
877
+ // src/classes/ticker/MoveTicker.ts
878
+ var MoveTicker = class extends TickerBase {
879
+ fn(ticker, args, tags, tickerId) {
880
+ let xSpeed = 1;
881
+ let ySpeed = 1;
882
+ if (args.speed) {
883
+ if (typeof args.speed === "number") {
884
+ xSpeed = args.speed;
885
+ ySpeed = args.speed;
886
+ } else {
887
+ xSpeed = args.speed.x;
888
+ ySpeed = args.speed.y;
889
+ }
890
+ }
891
+ xSpeed /= 60;
892
+ ySpeed /= 60;
893
+ let destination = args.destination;
894
+ let tagToRemoveAfter2 = args.tagToRemoveAfter || [];
895
+ if (typeof tagToRemoveAfter2 === "string") {
896
+ tagToRemoveAfter2 = [tagToRemoveAfter2];
897
+ }
898
+ tags.filter((tag) => {
899
+ var _a;
900
+ let element = GameWindowManager.getCanvasElement(tag);
901
+ if (args.startOnlyIfHaveTexture) {
902
+ if (element && element instanceof pixi_js.Sprite && ((_a = element.texture) == null ? void 0 : _a.label) == "EMPTY") {
903
+ return false;
904
+ }
905
+ }
906
+ return true;
907
+ }).forEach((tag) => {
908
+ let element = GameWindowManager.getCanvasElement(tag);
909
+ if (element && element instanceof pixi_js.Container) {
910
+ let xDistance = destination.x - element.x > 0 ? 1 : -1;
911
+ if (xDistance != 0) {
912
+ element.x += xDistance * xSpeed * ticker.deltaTime;
913
+ let newDistance = destination.x - element.x;
914
+ if (xDistance < 0 && newDistance > 0 || xDistance > 0 && newDistance < 0) {
915
+ element.x = destination.x;
916
+ }
917
+ }
918
+ let yDistance = destination.y - element.y > 0 ? 1 : -1;
919
+ if (yDistance != 0) {
920
+ element.y += yDistance * ySpeed * ticker.deltaTime;
921
+ let newDistance = destination.y - element.y;
922
+ if (yDistance < 0 && newDistance > 0 || yDistance > 0 && newDistance < 0) {
923
+ element.y = destination.y;
924
+ }
925
+ }
926
+ if (element.x == destination.x && element.y == destination.y) {
927
+ GameWindowManager.onEndOfTicker(tag, this, tagToRemoveAfter2, tickerId);
928
+ }
929
+ }
930
+ });
931
+ if (args.speedProgression)
932
+ updateTickerProgression(args, "speed", args.speedProgression);
933
+ }
934
+ };
935
+ MoveTicker = __decorateClass([
936
+ tickerDecorator()
937
+ ], MoveTicker);
938
+ var RotateTicker = class extends TickerBase {
939
+ fn(ticker, args, tags, tickerId) {
940
+ let speed = (args.speed === void 0 ? 1 : args.speed) / 60;
941
+ let clockwise = args.clockwise === void 0 ? true : args.clockwise;
942
+ let tagToRemoveAfter2 = args.tagToRemoveAfter || [];
943
+ if (typeof tagToRemoveAfter2 === "string") {
944
+ tagToRemoveAfter2 = [tagToRemoveAfter2];
945
+ }
946
+ tags.filter((tag) => {
947
+ var _a;
948
+ let element = GameWindowManager.getCanvasElement(tag);
949
+ if (args.startOnlyIfHaveTexture) {
950
+ if (element && element instanceof pixi_js.Sprite && ((_a = element.texture) == null ? void 0 : _a.label) == "EMPTY") {
951
+ return false;
952
+ }
953
+ }
954
+ return true;
955
+ }).forEach((tag) => {
956
+ let element = GameWindowManager.getCanvasElement(tag);
957
+ if (element && element instanceof pixi_js.Container) {
958
+ if (clockwise)
959
+ element.rotation += speed * ticker.deltaTime;
960
+ else
961
+ element.rotation -= speed * ticker.deltaTime;
962
+ if (speed < 1e-5 && !(args.speedProgression && args.speedProgression.type == "linear" && args.speedProgression.amt != 0)) {
963
+ GameWindowManager.onEndOfTicker(tag, this, tagToRemoveAfter2, tickerId);
964
+ }
965
+ }
966
+ });
967
+ if (args.speedProgression)
968
+ updateTickerProgression(args, "speed", args.speedProgression);
969
+ }
970
+ };
971
+ RotateTicker = __decorateClass([
972
+ tickerDecorator()
973
+ ], RotateTicker);
974
+ var ZoomTicker = class extends TickerBase {
975
+ fn(ticker, args, tags, tickerId) {
976
+ let xSpeed = 0.1;
977
+ let ySpeed = 0.1;
978
+ if (args.speed) {
979
+ if (typeof args.speed === "number") {
980
+ xSpeed = args.speed;
981
+ ySpeed = args.speed;
982
+ } else {
983
+ xSpeed = args.speed.x;
984
+ ySpeed = args.speed.y;
985
+ }
986
+ }
987
+ xSpeed /= 60;
988
+ ySpeed /= 60;
989
+ let tagToRemoveAfter2 = args.tagToRemoveAfter || [];
990
+ if (typeof tagToRemoveAfter2 === "string") {
991
+ tagToRemoveAfter2 = [tagToRemoveAfter2];
992
+ }
993
+ let type = args.type || "zoom";
994
+ let xLimit = Infinity;
995
+ let yLimit = Infinity;
996
+ if (args.limit) {
997
+ if (typeof args.limit === "number") {
998
+ xLimit = args.limit;
999
+ yLimit = args.limit;
1000
+ } else {
1001
+ xLimit = args.limit.x;
1002
+ yLimit = args.limit.y;
1003
+ }
1004
+ }
1005
+ tags.filter((tag) => {
1006
+ var _a;
1007
+ let element = GameWindowManager.getCanvasElement(tag);
1008
+ if (args.startOnlyIfHaveTexture) {
1009
+ if (element && element instanceof pixi_js.Sprite && ((_a = element.texture) == null ? void 0 : _a.label) == "EMPTY") {
1010
+ return false;
1011
+ }
1012
+ }
1013
+ return true;
1014
+ }).forEach((tag) => {
1015
+ let element = GameWindowManager.getCanvasElement(tag);
1016
+ if (element && element instanceof pixi_js.Container) {
1017
+ if (type === "zoom" && (element.scale.x < xLimit || element.scale.y < yLimit)) {
1018
+ element.scale.x += xSpeed * ticker.deltaTime;
1019
+ element.scale.y += ySpeed * ticker.deltaTime;
1020
+ } else if (type === "unzoom" && (element.scale.x > xLimit || element.scale.y > yLimit)) {
1021
+ element.scale.x -= xSpeed * ticker.deltaTime;
1022
+ element.scale.y -= ySpeed * ticker.deltaTime;
1023
+ }
1024
+ if (type === "zoom") {
1025
+ if (element.scale.x > xLimit) {
1026
+ element.scale.x = xLimit;
1027
+ }
1028
+ if (element.scale.y > yLimit) {
1029
+ element.scale.y = yLimit;
1030
+ }
1031
+ if (element.scale.x >= xLimit && element.scale.y >= yLimit) {
1032
+ element.scale.x = xLimit;
1033
+ element.scale.y = yLimit;
1034
+ GameWindowManager.onEndOfTicker(tag, this, tagToRemoveAfter2, tickerId);
1035
+ }
1036
+ } else if (type === "unzoom") {
1037
+ if (element.scale.x < xLimit) {
1038
+ element.scale.x = xLimit;
1039
+ }
1040
+ if (element.scale.y < yLimit) {
1041
+ element.scale.y = yLimit;
1042
+ }
1043
+ if (element.scale.x <= xLimit && element.scale.y <= yLimit) {
1044
+ element.scale.x = xLimit;
1045
+ element.scale.y = yLimit;
1046
+ GameWindowManager.onEndOfTicker(tag, this, tagToRemoveAfter2, tickerId);
1047
+ }
1048
+ }
1049
+ if (xSpeed < 1e-5 && ySpeed < 1e-5 && !(args.speedProgression && args.speedProgression.type == "linear" && args.speedProgression.amt != 0)) {
1050
+ GameWindowManager.onEndOfTicker(tag, this, tagToRemoveAfter2, tickerId);
1051
+ }
1052
+ }
1053
+ });
1054
+ if (args.speedProgression)
1055
+ updateTickerProgression(args, "speed", args.speedProgression);
1056
+ }
1057
+ };
1058
+ ZoomTicker = __decorateClass([
1059
+ tickerDecorator()
1060
+ ], ZoomTicker);
1061
+
1062
+ // src/constants.ts
1063
+ var Repeat = "repeat";
1064
+ function Pause(duration) {
1065
+ return {
1066
+ type: "pause",
1067
+ duration
1068
+ };
1069
+ }
1070
+
1071
+ // src/functions/ImageUtility.ts
1072
+ function addImage(tag, imageUrl) {
1073
+ let image = new CanvasImage();
1074
+ image.imageLink = imageUrl;
1075
+ GameWindowManager.addCanvasElement(tag, image);
1076
+ return image;
1077
+ }
1078
+ function loadImage(canvasImages) {
1079
+ return __async(this, null, function* () {
1080
+ if (!Array.isArray(canvasImages)) {
1081
+ return [canvasImages];
1082
+ }
1083
+ let promises = Array(canvasImages.length);
1084
+ for (let i = 0; i < canvasImages.length; i++) {
1085
+ promises[i] = getTexture(canvasImages[i].imageLink);
1086
+ }
1087
+ return Promise.all(promises).then((textures) => {
1088
+ return textures.map((texture, index) => {
1089
+ if (texture) {
1090
+ canvasImages[index].texture = texture;
1091
+ return canvasImages[index];
1092
+ }
1093
+ canvasImages[index].load();
1094
+ return canvasImages[index];
1095
+ });
1096
+ });
1097
+ });
1098
+ }
1099
+ function showWithDissolveTransition(_0, _1) {
1100
+ return __async(this, arguments, function* (tag, image, props = {}, priority) {
1101
+ var _a;
1102
+ let oldCanvasTag = void 0;
1103
+ if (GameWindowManager.getCanvasElement(tag)) {
1104
+ oldCanvasTag = tag + "_temp_disolve";
1105
+ GameWindowManager.editCanvasElementTag(tag, oldCanvasTag);
1106
+ }
1107
+ let canvasElement;
1108
+ if (typeof image === "string") {
1109
+ canvasElement = addImage(tag, image);
1110
+ } else {
1111
+ canvasElement = image;
1112
+ GameWindowManager.addCanvasElement(tag, canvasElement);
1113
+ }
1114
+ if (canvasElement instanceof CanvasImage && ((_a = canvasElement.texture) == null ? void 0 : _a.label) == "EMPTY") {
1115
+ yield canvasElement.load();
1116
+ }
1117
+ canvasElement.alpha = 0;
1118
+ let effect = new FadeAlphaTicker(__spreadProps(__spreadValues({}, props), {
1119
+ type: "show",
1120
+ tagToRemoveAfter: oldCanvasTag,
1121
+ startOnlyIfHaveTexture: true
1122
+ }), 10, priority);
1123
+ GameWindowManager.addTicker(tag, effect);
1124
+ return;
1125
+ });
1126
+ }
1127
+ function removeWithDissolveTransition(tag, props = {}, priority) {
1128
+ if (typeof tag === "string") {
1129
+ tag = [tag];
1130
+ }
1131
+ let effect = new FadeAlphaTicker(__spreadProps(__spreadValues({}, props), {
1132
+ type: "hide",
1133
+ tagToRemoveAfter: tag,
1134
+ startOnlyIfHaveTexture: true
1135
+ }), 10, priority);
1136
+ GameWindowManager.addTicker(tag, effect);
1137
+ }
1138
+ function showWithFadeTransition(_0, _1) {
1139
+ return __async(this, arguments, function* (tag, image, props = {}, priority) {
1140
+ var _a;
1141
+ if (!GameWindowManager.getCanvasElement(tag)) {
1142
+ return showWithDissolveTransition(tag, image, props, priority);
1143
+ }
1144
+ let oldCanvasTag = tag + "_temp_fade";
1145
+ GameWindowManager.editCanvasElementTag(tag, oldCanvasTag);
1146
+ let canvasElement;
1147
+ if (typeof image === "string") {
1148
+ canvasElement = addImage(tag, image);
1149
+ } else {
1150
+ canvasElement = image;
1151
+ GameWindowManager.addCanvasElement(tag, canvasElement);
1152
+ }
1153
+ if (canvasElement instanceof CanvasImage && ((_a = canvasElement.texture) == null ? void 0 : _a.label) == "EMPTY") {
1154
+ yield canvasElement.load();
1155
+ }
1156
+ canvasElement.alpha = 0;
1157
+ GameWindowManager.addTickersSteps(oldCanvasTag, [
1158
+ new FadeAlphaTicker(__spreadProps(__spreadValues({}, props), {
1159
+ type: "hide",
1160
+ startOnlyIfHaveTexture: true
1161
+ }))
1162
+ ]);
1163
+ GameWindowManager.addTickersSteps(tag, [
1164
+ Pause(props.duration || 1),
1165
+ new FadeAlphaTicker(__spreadProps(__spreadValues({}, props), {
1166
+ type: "show",
1167
+ startOnlyIfHaveTexture: true
1168
+ }))
1169
+ ]);
1170
+ });
1171
+ }
1172
+ function removeWithFadeTransition(tag, props = {}, priority) {
1173
+ return removeWithDissolveTransition(tag, props, priority);
1174
+ }
1175
+
1176
+ // src/functions/ExportUtility.ts
1177
+ function createExportableElement(element) {
1178
+ try {
1179
+ let elementString = JSON.stringify(element);
1180
+ return JSON.parse(elementString);
1181
+ } catch (e) {
1182
+ console.error("[Pixi'VN] Error creating exportable element", e);
1183
+ throw new Error("[Pixi'VN] Error creating exportable element");
1184
+ }
1185
+ }
1186
+
1187
+ // src/functions/DiffUtility.ts
1188
+ function restoreDeepDiffChanges(data, differences) {
1189
+ let result = createExportableElement(data);
1190
+ differences.forEach((diff2) => {
1191
+ let dataToEdit = result;
1192
+ if (diff2.path && diff2.path.length > 0) {
1193
+ diff2.path.forEach((path, index) => {
1194
+ if (diff2.path && index === diff2.path.length - 1) {
1195
+ if (diff2.kind === "E" || diff2.kind === "D") {
1196
+ dataToEdit[path] = diff2.lhs;
1197
+ } else if (diff2.kind === "N") {
1198
+ if (Number.isInteger(path)) {
1199
+ if (Array.isArray(dataToEdit)) {
1200
+ dataToEdit.splice(path, 1);
1201
+ }
1202
+ } else if (typeof path === "string") {
1203
+ delete dataToEdit[path];
1204
+ }
1205
+ } else if (diff2.kind === "A") {
1206
+ let index2 = diff2.index;
1207
+ if (diff2.item.kind === "N") {
1208
+ dataToEdit[path].splice(index2, 1);
1209
+ } else if (diff2.item.kind === "E" || diff2.item.kind === "D") {
1210
+ dataToEdit[path][index2] = diff2.item.lhs;
1211
+ } else if (diff2.item.kind === "A") {
1212
+ console.warn("[Pixi'VN] Nested array found, skipping diff", diff2);
1213
+ } else {
1214
+ console.warn("[Pixi'VN] No array found, skipping diff", diff2);
1215
+ }
1216
+ }
1217
+ } else {
1218
+ dataToEdit = dataToEdit[path];
1219
+ }
1220
+ });
1221
+ } else {
1222
+ console.warn("[Pixi'VN] No path found, skipping diff", diff2);
1223
+ }
1224
+ });
1225
+ return result;
1226
+ }
1227
+
1228
+ // src/managers/StorageManager.ts
1229
+ var _GameStorageManager = class _GameStorageManager {
1230
+ constructor() {
1231
+ }
1232
+ static get keysSystem() {
1233
+ return {
1234
+ CURRENT_DIALOGUE_MEMORY_KEY: "___current_dialogue_memory___",
1235
+ LAST_DIALOGUE_ADDED_IN_STEP_MEMORY_KEY: "___last_dialogue_added_in_step_memory___",
1236
+ CURRENT_MENU_OPTIONS_MEMORY_KEY: "___current_menu_options_memory___",
1237
+ LAST_MENU_OPTIONS_ADDED_IN_STEP_MEMORY_KEY: "___last_menu_options_added_in_step_memory___",
1238
+ CHARACTER_CATEGORY_KEY: "___character___",
1239
+ FLAGS_CATEGORY_KEY: "___flags___"
1240
+ };
1241
+ }
1242
+ /**
1243
+ * Set a variable in the storage
1244
+ * @param key The key of the variable
1245
+ * @param value The value of the variable. If undefined, the variable will be removed
1246
+ * @returns
1247
+ */
1248
+ static setVariable(key, value) {
1249
+ key = key.toLowerCase();
1250
+ if (value === void 0 || value === null) {
1251
+ if (_GameStorageManager.storage.hasOwnProperty(key)) {
1252
+ delete _GameStorageManager.storage[key];
1253
+ }
1254
+ return;
1255
+ }
1256
+ _GameStorageManager.storage[key] = value;
1257
+ }
1258
+ /**
1259
+ * Get a variable from the storage
1260
+ * @param key The key of the variable
1261
+ * @returns The value of the variable. If the variable does not exist, it will return undefined
1262
+ */
1263
+ static getVariable(key) {
1264
+ key = key.toLowerCase();
1265
+ if (_GameStorageManager.storage.hasOwnProperty(key)) {
1266
+ return _GameStorageManager.storage[key];
1267
+ }
1268
+ return void 0;
1269
+ }
1270
+ /**
1271
+ * Remove a variable from the storage
1272
+ * @param key The key of the variable
1273
+ * @returns
1274
+ */
1275
+ static removeVariable(key) {
1276
+ key = key.toLowerCase();
1277
+ if (_GameStorageManager.storage.hasOwnProperty(key)) {
1278
+ delete _GameStorageManager.storage[key];
1279
+ }
1280
+ }
1281
+ /**
1282
+ * Clear the storage and the oidsUsed
1283
+ * @returns
1284
+ */
1285
+ static clear() {
1286
+ _GameStorageManager.storage = {};
1287
+ }
1288
+ static exportJson() {
1289
+ return JSON.stringify(this.export());
1290
+ }
1291
+ static export() {
1292
+ return createExportableElement(_GameStorageManager.storage);
1293
+ }
1294
+ static importJson(dataString) {
1295
+ _GameStorageManager.import(JSON.parse(dataString));
1296
+ }
1297
+ static import(data) {
1298
+ _GameStorageManager.clear();
1299
+ try {
1300
+ if (data) {
1301
+ _GameStorageManager.storage = data;
1302
+ } else {
1303
+ console.warn("[Pixi'VN] No storage data found");
1304
+ }
1305
+ } catch (e) {
1306
+ console.error("[Pixi'VN] Error importing data", e);
1307
+ }
1308
+ }
1309
+ };
1310
+ _GameStorageManager.storage = {};
1311
+ var GameStorageManager = _GameStorageManager;
1312
+
1313
+ // src/functions/EasterEgg.ts
1314
+ function asciiArtLog() {
1315
+ console.info(`
1316
+ ____ _ _ ___ ___ _
1317
+ | _ \\(_)_ _(_| ) \\ / / \\ | |
1318
+ | |_) | \\ \\/ / |/ \\ \\ / /| \\| |
1319
+ | __/| |> <| | \\ V / | |\\ |
1320
+ |_| |_/_/\\_\\_| \\_/ |_| \\_|
1321
+ `);
1322
+ }
1323
+
1324
+ // src/types/ticker/TagToRemoveAfterType.ts
1325
+ var tagToRemoveAfter = "tagToRemoveAfter";
1326
+
1327
+ // src/managers/WindowManager.ts
1328
+ var _GameWindowManager = class _GameWindowManager {
1329
+ constructor() {
1330
+ }
1331
+ /**
1332
+ * The PIXI Application instance.
1333
+ * It not recommended to use this property directly.
1334
+ */
1335
+ static get app() {
1336
+ if (!_GameWindowManager._app) {
1337
+ throw new Error("[Pixi'VN] GameWindowManager.app is undefined");
1338
+ }
1339
+ return _GameWindowManager._app;
1340
+ }
1341
+ /**
1342
+ * If the manager is initialized.
1343
+ */
1344
+ static get isInitialized() {
1345
+ return _GameWindowManager._isInitialized;
1346
+ }
1347
+ static get screen() {
1348
+ return _GameWindowManager.app.screen;
1349
+ }
1350
+ /**
1351
+ * Initialize the PIXI Application and the interface div.
1352
+ * This method should be called before any other method.
1353
+ * @param element The html element where I will put the canvas. Example: document.body
1354
+ * @param width The width of the canvas
1355
+ * @param height The height of the canvas
1356
+ * @param options The options of PIXI Application
1357
+ * @example
1358
+ * ```typescript
1359
+ * const body = document.body
1360
+ * if (!body) {
1361
+ * throw new Error('body element not found')
1362
+ * }
1363
+ * await GameWindowManager.initialize(body, 1920, 1080, {
1364
+ * backgroundColor: "#303030"
1365
+ * })
1366
+ * ```
1367
+ */
1368
+ static initialize(element, width, height, options) {
1369
+ return __async(this, null, function* () {
1370
+ _GameWindowManager.canvasWidth = width;
1371
+ _GameWindowManager.canvasHeight = height;
1372
+ _GameWindowManager._app = new pixi_js.Application();
1373
+ return _GameWindowManager.app.init(__spreadValues({
1374
+ resolution: window.devicePixelRatio || 1,
1375
+ autoDensity: true,
1376
+ width,
1377
+ height
1378
+ }, options)).then(() => {
1379
+ _GameWindowManager._isInitialized = true;
1380
+ this.addCanvasIntoElement(element);
1381
+ window.addEventListener("resize", _GameWindowManager.resize);
1382
+ _GameWindowManager.resize();
1383
+ asciiArtLog();
1384
+ });
1385
+ });
1386
+ }
1387
+ /**
1388
+ * Add the canvas into a html element.
1389
+ * @param element it is the html element where I will put the canvas. Example: document.body
1390
+ */
1391
+ static addCanvasIntoElement(element) {
1392
+ if (_GameWindowManager.isInitialized) {
1393
+ element.appendChild(_GameWindowManager.app.canvas);
1394
+ } else {
1395
+ console.error("[Pixi'VN] GameWindowManager is not initialized");
1396
+ }
1397
+ }
1398
+ /**
1399
+ * Initialize the interface div and add it into a html element.
1400
+ * @param element it is the html element where I will put the interface div. Example: document.getElementById('root')
1401
+ * @example
1402
+ * ```tsx
1403
+ * const root = document.getElementById('root')
1404
+ * if (!root) {
1405
+ * throw new Error('root element not found')
1406
+ * }
1407
+ * GameWindowManager.initializeHTMLLayout(root)
1408
+ * const reactRoot = createRoot(GameWindowManager.htmlLayout)
1409
+ * reactRoot.render(
1410
+ * <App />
1411
+ * )
1412
+ * ```
1413
+ */
1414
+ static initializeHTMLLayout(element) {
1415
+ let div = document.createElement("div");
1416
+ div.style.position = "absolute";
1417
+ div.style.pointerEvents = "none";
1418
+ element.appendChild(div);
1419
+ _GameWindowManager.htmlLayout = div;
1420
+ _GameWindowManager.resize();
1421
+ }
1422
+ /* Resize Metods */
1423
+ /**
1424
+ * This method returns the scale of the screen.
1425
+ */
1426
+ static get screenScale() {
1427
+ let screenWidth = Math.max(document.documentElement.clientWidth, window.innerWidth || 0);
1428
+ let screenHeight = Math.max(document.documentElement.clientHeight, window.innerHeight || 0);
1429
+ return Math.min(screenWidth / _GameWindowManager.canvasWidth, screenHeight / _GameWindowManager.canvasHeight);
1430
+ }
1431
+ /**
1432
+ * This method returns the width of the screen enlarged by the scale.
1433
+ */
1434
+ static get screenWidth() {
1435
+ return Math.floor(_GameWindowManager.screenScale * _GameWindowManager.canvasWidth);
1436
+ }
1437
+ /**
1438
+ * This method returns the height of the screen enlarged by the scale.
1439
+ */
1440
+ static get screenHeight() {
1441
+ return Math.floor(_GameWindowManager.screenScale * _GameWindowManager.canvasHeight);
1442
+ }
1443
+ /**
1444
+ * This method returns the horizontal margin of the screen.
1445
+ */
1446
+ static get horizontalMargin() {
1447
+ let screenWidth = Math.max(document.documentElement.clientWidth, window.innerWidth || 0);
1448
+ return (screenWidth - _GameWindowManager.screenWidth) / 2;
1449
+ }
1450
+ /**
1451
+ * This method returns the vertical margin of the screen.
1452
+ */
1453
+ static get verticalMargin() {
1454
+ let screenHeight = Math.max(document.documentElement.clientHeight, window.innerHeight || 0);
1455
+ return (screenHeight - _GameWindowManager.screenHeight) / 2;
1456
+ }
1457
+ /**
1458
+ * This method is called when the screen is resized.
1459
+ */
1460
+ static resize() {
1461
+ if (_GameWindowManager.isInitialized) {
1462
+ let style = _GameWindowManager.app.canvas.style;
1463
+ style.width = `${_GameWindowManager.screenWidth}px`;
1464
+ style.height = `${_GameWindowManager.screenHeight}px`;
1465
+ style.marginLeft = `${_GameWindowManager.horizontalMargin}px`;
1466
+ style.marginRight = `${_GameWindowManager.horizontalMargin}px`;
1467
+ style.marginTop = `${_GameWindowManager.verticalMargin}px`;
1468
+ style.marginBottom = `${_GameWindowManager.verticalMargin}px`;
1469
+ }
1470
+ if (_GameWindowManager.htmlLayout) {
1471
+ _GameWindowManager.htmlLayout.style.width = `${_GameWindowManager.screenWidth}px`;
1472
+ _GameWindowManager.htmlLayout.style.height = `${_GameWindowManager.screenHeight}px`;
1473
+ _GameWindowManager.htmlLayout.style.marginLeft = `${_GameWindowManager.horizontalMargin}px`;
1474
+ _GameWindowManager.htmlLayout.style.marginRight = `${_GameWindowManager.horizontalMargin}px`;
1475
+ _GameWindowManager.htmlLayout.style.marginTop = `${_GameWindowManager.verticalMargin}px`;
1476
+ _GameWindowManager.htmlLayout.style.marginBottom = `${_GameWindowManager.verticalMargin}px`;
1477
+ }
1478
+ }
1479
+ /* Edit Canvas Elements Methods */
1480
+ /**
1481
+ * This is a dictionary that contains all Canvas Elements of Canvas, currently.
1482
+ */
1483
+ static get currentCanvasElements() {
1484
+ return _GameWindowManager._children;
1485
+ }
1486
+ /**
1487
+ * Add a canvas element to the canvas.
1488
+ * If there is a canvas element with the same tag, it will be removed.
1489
+ * @param tag The tag of the canvas element.
1490
+ * @param canvasElement The canvas elements to be added.
1491
+ * @example
1492
+ * ```typescript
1493
+ * const texture = await Assets.load('https://pixijs.com/assets/bunny.png');
1494
+ * const sprite = CanvasSprite.from(texture);
1495
+ * GameWindowManager.addCanvasElement("bunny", sprite);
1496
+ * ```
1497
+ */
1498
+ static addCanvasElement(tag, canvasElement) {
1499
+ if (_GameWindowManager._children[tag]) {
1500
+ _GameWindowManager.removeCanvasElement(tag);
1501
+ }
1502
+ _GameWindowManager.app.stage.addChild(canvasElement);
1503
+ _GameWindowManager._children[tag] = canvasElement;
1504
+ _GameWindowManager.childrenTagsOrder.push(tag);
1505
+ }
1506
+ /**
1507
+ * Remove a canvas element from the canvas.
1508
+ * And remove all tickers that are not connected to any canvas element.
1509
+ * @param tags The tag of the canvas element to be removed.
1510
+ * @returns
1511
+ * @example
1512
+ * ```typescript
1513
+ * GameWindowManager.removeCanvasElement("bunny");
1514
+ * ```
1515
+ */
1516
+ static removeCanvasElement(tags) {
1517
+ if (typeof tags === "string") {
1518
+ tags = [tags];
1519
+ }
1520
+ tags.forEach((tag) => {
1521
+ if (_GameWindowManager._children[tag]) {
1522
+ _GameWindowManager.app.stage.removeChild(_GameWindowManager._children[tag]);
1523
+ delete _GameWindowManager._children[tag];
1524
+ _GameWindowManager.removeTickerByCanvasElement(tag);
1525
+ }
1526
+ });
1527
+ _GameWindowManager.childrenTagsOrder = _GameWindowManager.childrenTagsOrder.filter((t) => !tags.includes(t));
1528
+ }
1529
+ /**
1530
+ * Get a canvas element by the tag.
1531
+ * @param tag The tag of the canvas element.
1532
+ * @returns The canvas element.
1533
+ * @example
1534
+ * ```typescript
1535
+ * const sprite = GameWindowManager.getCanvasElement<CanvasSprite>("bunny");
1536
+ * ```
1537
+ */
1538
+ static getCanvasElement(tag) {
1539
+ return _GameWindowManager._children[tag];
1540
+ }
1541
+ /**
1542
+ * Check if a DisplayObject is on the canvas.
1543
+ * @param pixiElement The DisplayObject to be checked.
1544
+ * @returns If the DisplayObject is on the canvas.
1545
+ */
1546
+ static canvasElementIsOnCanvas(pixiElement) {
1547
+ return _GameWindowManager.app.stage.children.includes(pixiElement);
1548
+ }
1549
+ /**
1550
+ * Remove all canvas elements from the canvas.
1551
+ * And remove all tickers that are not connected to any canvas element.
1552
+ */
1553
+ static removeCanvasElements() {
1554
+ _GameWindowManager.app.stage.removeChildren();
1555
+ _GameWindowManager._children = {};
1556
+ _GameWindowManager.childrenTagsOrder = [];
1557
+ _GameWindowManager.removeAllTickers();
1558
+ }
1559
+ /**
1560
+ * Edit the tag of a canvas element.
1561
+ * @param oldTag The old tag of the canvas element.
1562
+ * @param newTag The new tag of the canvas element.
1563
+ */
1564
+ static editCanvasElementTag(oldTag, newTag) {
1565
+ if (_GameWindowManager._children[oldTag]) {
1566
+ _GameWindowManager._children[newTag] = _GameWindowManager._children[oldTag];
1567
+ delete _GameWindowManager._children[oldTag];
1568
+ }
1569
+ if (_GameWindowManager._currentTickersSteps[oldTag]) {
1570
+ _GameWindowManager._currentTickersSteps[newTag] = _GameWindowManager._currentTickersSteps[oldTag];
1571
+ delete _GameWindowManager._currentTickersSteps[oldTag];
1572
+ }
1573
+ for (let id in _GameWindowManager._currentTickers) {
1574
+ let ticker = _GameWindowManager._currentTickers[id];
1575
+ if (ticker.canvasElementTags.includes(oldTag)) {
1576
+ ticker.canvasElementTags = ticker.canvasElementTags.map((t) => t === oldTag ? newTag : t);
1577
+ if (ticker.args.hasOwnProperty(tagToRemoveAfter)) {
1578
+ let tagToRemoveAfter2 = ticker.args.tagToRemoveAfter;
1579
+ if (typeof tagToRemoveAfter2 === "string") {
1580
+ tagToRemoveAfter2 = [tagToRemoveAfter2];
1581
+ }
1582
+ if (Array.isArray(tagToRemoveAfter2)) {
1583
+ ticker.args.tagToRemoveAfter = tagToRemoveAfter2.map((t) => t === oldTag ? newTag : t);
1584
+ }
1585
+ }
1586
+ }
1587
+ }
1588
+ for (let timeout in _GameWindowManager._currentTickersTimeouts) {
1589
+ let TickerTimeout = _GameWindowManager._currentTickersTimeouts[timeout];
1590
+ if (TickerTimeout.tags.includes(oldTag)) {
1591
+ TickerTimeout.tags = TickerTimeout.tags.map((t) => t === oldTag ? newTag : t);
1592
+ }
1593
+ }
1594
+ }
1595
+ /** Edit Tickers Methods */
1596
+ /**
1597
+ * Currently tickers that are running.
1598
+ */
1599
+ static get currentTickers() {
1600
+ return _GameWindowManager._currentTickers;
1601
+ }
1602
+ static get currentTickersList() {
1603
+ return Object.values(_GameWindowManager._currentTickers);
1604
+ }
1605
+ static get currentTickersWithoutCreatedBySteps() {
1606
+ return Object.fromEntries(Object.entries(_GameWindowManager._currentTickers).filter(([_, ticker]) => !ticker.createdByTicketStepsId));
1607
+ }
1608
+ /**
1609
+ * The steps of the tickers
1610
+ */
1611
+ static get currentTickersSteps() {
1612
+ return _GameWindowManager._currentTickersSteps;
1613
+ }
1614
+ static generateTickerId(tickerData) {
1615
+ try {
1616
+ return sha1__default.default(JSON.stringify(tickerData)).toString() + "_" + Math.random().toString(36).substring(7);
1617
+ } catch (e) {
1618
+ throw new Error(`[Pixi'VN] Error to generate ticker id: ${e}`);
1619
+ }
1620
+ }
1621
+ /**
1622
+ * Run a ticker. You can run multiple addTicker with the same tag and different tickerClasses.
1623
+ * If you run a ticker with the same tag and tickerClass, the old ticker will be removed.
1624
+ * If already exists a sequence of tickers with the same tag, it will be removed.
1625
+ * @param canvasEslementTag The tag of the canvas element that will use the ticker.
1626
+ * @param ticker The ticker class to be run.
1627
+ * @param args The arguments to be used in the ticker.
1628
+ * @param duration The time to be used in the ticker. This number is in seconds. If it is undefined, the ticker will run forever.
1629
+ * @param priority The priority to be used in the ticker.
1630
+ * @returns
1631
+ * @example
1632
+ * ```typescript
1633
+ * GameWindowManager.addTicker("alien", new RotateTicker({ speed: 0.2 }))
1634
+ * ```
1635
+ */
1636
+ static addTicker(canvasElementTag, ticker) {
1637
+ let tickerName = ticker.constructor.name;
1638
+ if (typeof canvasElementTag === "string") {
1639
+ canvasElementTag = [canvasElementTag];
1640
+ }
1641
+ if (!geTickerInstanceByClassName(tickerName, ticker.args, ticker.duration, ticker.priority)) {
1642
+ console.error(`[Pixi'VN] Ticker ${tickerName} not found`);
1643
+ return;
1644
+ }
1645
+ let tickerHistory = {
1646
+ fn: () => {
1647
+ },
1648
+ className: tickerName,
1649
+ args: createExportableElement(ticker.args),
1650
+ canvasElementTags: canvasElementTag,
1651
+ priority: ticker.priority,
1652
+ duration: ticker.duration
1653
+ };
1654
+ let id = _GameWindowManager.generateTickerId(tickerHistory);
1655
+ _GameWindowManager.pushTicker(id, tickerHistory, ticker);
1656
+ if (ticker.duration) {
1657
+ let timeout = setTimeout(() => {
1658
+ _GameWindowManager.removeTickerTimeoutInfo(timeout);
1659
+ let tickerTimeoutInfo = _GameWindowManager._currentTickersTimeouts[timeout.toString()];
1660
+ if (tickerTimeoutInfo) {
1661
+ _GameWindowManager.removeTicker(id);
1662
+ }
1663
+ }, ticker.duration * 1e3);
1664
+ _GameWindowManager.addTickerTimeoutInfo(canvasElementTag, tickerName, timeout.toString(), true);
1665
+ }
1666
+ }
1667
+ static pushTicker(id, tickerData, ticker) {
1668
+ _GameWindowManager.removeAssociationBetweenTickerCanvasElement(tickerData.canvasElementTags, tickerData);
1669
+ _GameWindowManager._currentTickers[id] = tickerData;
1670
+ tickerData.fn = (t) => {
1671
+ let data = _GameWindowManager._currentTickers[id];
1672
+ if (data) {
1673
+ ticker == null ? void 0 : ticker.fn(t, data.args, data.canvasElementTags, id);
1674
+ }
1675
+ };
1676
+ _GameWindowManager.app.ticker.add(tickerData.fn, void 0, tickerData.priority);
1677
+ }
1678
+ /**
1679
+ * Run a sequence of tickers. If exists a ticker steps with the same tag, it will be removed.
1680
+ * @param tag The tag of canvas element that will use the tickers.
1681
+ * @param steps The steps of the tickers.
1682
+ * @param currentStepNumber The current step number. It is used to continue the sequence of tickers.
1683
+ * @returns
1684
+ * @example
1685
+ * ```typescript
1686
+ * GameWindowManager.addTickersSteps("alien", [
1687
+ * new RotateTicker({ speed: 0.1, clockwise: true }, 2), // 2 seconds
1688
+ * Pause(1), // 1 second
1689
+ * new RotateTicker({ speed: 0.2, clockwise: false }, 2),
1690
+ * Repeat,
1691
+ * ])
1692
+ * ```
1693
+ */
1694
+ static addTickersSteps(tag, steps, currentStepNumber = 0) {
1695
+ if (steps.length == 0) {
1696
+ console.warn("[Pixi'VN] The steps of the tickers is empty");
1697
+ return;
1698
+ }
1699
+ _GameWindowManager.removeTickerStepByCanvasElement(tag);
1700
+ _GameWindowManager._currentTickersSteps[tag] = {
1701
+ currentStepNumber,
1702
+ steps: steps.map((step) => {
1703
+ if (step === Repeat) {
1704
+ return step;
1705
+ }
1706
+ if (step.hasOwnProperty("type") && step.type === "pause") {
1707
+ return step;
1708
+ }
1709
+ let tickerName = step.constructor.name;
1710
+ return {
1711
+ ticker: tickerName,
1712
+ args: createExportableElement(step.args),
1713
+ duration: step.duration
1714
+ };
1715
+ })
1716
+ };
1717
+ _GameWindowManager.runTickersSteps(tag);
1718
+ }
1719
+ static restoneTickersSteps(data) {
1720
+ for (let tag in data) {
1721
+ let steps = data[tag];
1722
+ _GameWindowManager._currentTickersSteps[tag] = steps;
1723
+ _GameWindowManager.runTickersSteps(tag);
1724
+ }
1725
+ }
1726
+ static runTickersSteps(tag) {
1727
+ let step = _GameWindowManager._currentTickersSteps[tag].steps[_GameWindowManager._currentTickersSteps[tag].currentStepNumber];
1728
+ if (step === Repeat) {
1729
+ step = _GameWindowManager._currentTickersSteps[tag].steps[0];
1730
+ _GameWindowManager._currentTickersSteps[tag].currentStepNumber = 0;
1731
+ if (step === Repeat) {
1732
+ console.error("[Pixi'VN] TikersSteps has a RepeatType in the first step");
1733
+ return;
1734
+ }
1735
+ }
1736
+ if (step.hasOwnProperty("type") && step.type === "pause") {
1737
+ let timeout = setTimeout(() => {
1738
+ let tickerTimeoutInfo = _GameWindowManager._currentTickersTimeouts[timeout.toString()];
1739
+ if (tickerTimeoutInfo) {
1740
+ tickerTimeoutInfo.tags.forEach((tag2) => {
1741
+ _GameWindowManager.nextTickerStep(tag2);
1742
+ });
1743
+ }
1744
+ _GameWindowManager.removeTickerTimeoutInfo(timeout);
1745
+ }, step.duration * 1e3);
1746
+ _GameWindowManager.addTickerTimeoutInfo(tag, "steps", timeout.toString(), false);
1747
+ return;
1748
+ }
1749
+ let ticker = geTickerInstanceByClassName(step.ticker, step.args, step.duration, step.priority);
1750
+ if (!ticker) {
1751
+ console.error(`[Pixi'VN] Ticker ${step.ticker} not found`);
1752
+ return;
1753
+ }
1754
+ let tickerName = ticker.constructor.name;
1755
+ let tickerHistory = {
1756
+ fn: () => {
1757
+ },
1758
+ className: tickerName,
1759
+ args: createExportableElement(ticker.args),
1760
+ canvasElementTags: [tag],
1761
+ priority: ticker.priority,
1762
+ duration: ticker.duration,
1763
+ createdByTicketStepsId: tag
1764
+ };
1765
+ let id = _GameWindowManager.generateTickerId(tickerHistory);
1766
+ _GameWindowManager.pushTicker(id, tickerHistory, ticker);
1767
+ if (ticker.duration) {
1768
+ let timeout = setTimeout(() => {
1769
+ let tickerTimeoutInfo = _GameWindowManager._currentTickersTimeouts[timeout.toString()];
1770
+ if (tickerTimeoutInfo) {
1771
+ _GameWindowManager.removeTicker(id);
1772
+ tickerTimeoutInfo.tags.forEach((tag2) => {
1773
+ _GameWindowManager.nextTickerStep(tag2);
1774
+ });
1775
+ }
1776
+ _GameWindowManager.removeTickerTimeoutInfo(timeout);
1777
+ }, ticker.duration * 1e3);
1778
+ _GameWindowManager.addTickerTimeoutInfo(tag, tickerName, timeout.toString(), false);
1779
+ }
1780
+ }
1781
+ static nextTickerStep(tag) {
1782
+ if (_GameWindowManager._currentTickersSteps[tag]) {
1783
+ let steps = _GameWindowManager._currentTickersSteps[tag];
1784
+ if (steps.currentStepNumber + 1 < steps.steps.length) {
1785
+ steps.currentStepNumber++;
1786
+ _GameWindowManager._currentTickersSteps[tag] = steps;
1787
+ _GameWindowManager.runTickersSteps(tag);
1788
+ } else {
1789
+ _GameWindowManager.removeTickerStepByCanvasElement(tag);
1790
+ }
1791
+ }
1792
+ }
1793
+ static onEndOfTicker(canvasElementTags, ticker, canvasElementTagsToDelete, tickerId) {
1794
+ let tickerData = _GameWindowManager._currentTickers[tickerId];
1795
+ _GameWindowManager.removeAssociationBetweenTickerCanvasElement(canvasElementTags, ticker);
1796
+ _GameWindowManager.removeCanvasElement(canvasElementTagsToDelete);
1797
+ if (tickerData) {
1798
+ _GameWindowManager.removeTicker(tickerId);
1799
+ if (tickerData.duration == void 0 && tickerData.createdByTicketStepsId) {
1800
+ _GameWindowManager.nextTickerStep(tickerData.createdByTicketStepsId);
1801
+ }
1802
+ }
1803
+ }
1804
+ /**
1805
+ * Remove a connection between a canvas element and a ticker.
1806
+ * And remove the ticker if there is no canvas element connected to it.
1807
+ * @param tags The tag of the canvas element that will use the ticker.
1808
+ * @param ticker The ticker class to be removed.
1809
+ * @example
1810
+ * ```typescript
1811
+ * GameWindowManager.removeAssociationBetweenTickerCanvasElement("alien", RotateTicker)
1812
+ * ```
1813
+ */
1814
+ static removeAssociationBetweenTickerCanvasElement(tags, ticker) {
1815
+ let tickerName;
1816
+ if (typeof ticker === "string") {
1817
+ tickerName = ticker;
1818
+ } else if (ticker instanceof TickerBase) {
1819
+ tickerName = ticker.constructor.name;
1820
+ } else {
1821
+ tickerName = ticker.name;
1822
+ }
1823
+ if (typeof tags === "string") {
1824
+ tags = [tags];
1825
+ }
1826
+ for (let id in _GameWindowManager._currentTickers) {
1827
+ let ticker2 = _GameWindowManager._currentTickers[id];
1828
+ if (ticker2.className === tickerName) {
1829
+ _GameWindowManager._currentTickers[id].canvasElementTags = ticker2.canvasElementTags.filter((e) => !tags.includes(e));
1830
+ }
1831
+ }
1832
+ for (let timeout in _GameWindowManager._currentTickersTimeouts) {
1833
+ let TickerTimeout = _GameWindowManager._currentTickersTimeouts[timeout];
1834
+ if (TickerTimeout.ticker === tickerName && TickerTimeout.canBeDeletedBeforeEnd) {
1835
+ _GameWindowManager._currentTickersTimeouts[timeout].tags = TickerTimeout.tags.filter((t) => !tags.includes(t));
1836
+ }
1837
+ }
1838
+ _GameWindowManager.removeTickersWithoutAssociatedCanvasElement();
1839
+ }
1840
+ /**
1841
+ * Remove all tickers that are not connected to any existing canvas element.
1842
+ */
1843
+ static removeTickersWithoutAssociatedCanvasElement() {
1844
+ for (let id in _GameWindowManager._currentTickers) {
1845
+ let ticker = _GameWindowManager._currentTickers[id];
1846
+ ticker.canvasElementTags = ticker.canvasElementTags.filter((e) => _GameWindowManager._children[e]);
1847
+ if (ticker.canvasElementTags.length === 0) {
1848
+ _GameWindowManager.removeTicker(id);
1849
+ }
1850
+ }
1851
+ for (let tag in _GameWindowManager._currentTickersSteps) {
1852
+ if (_GameWindowManager._children[tag] === void 0) {
1853
+ delete _GameWindowManager._currentTickersSteps[tag];
1854
+ }
1855
+ }
1856
+ Object.entries(_GameWindowManager._currentTickersTimeouts).forEach(([timeout, { tags }]) => {
1857
+ if (tags.length === 0) {
1858
+ _GameWindowManager.removeTickerTimeout(timeout);
1859
+ }
1860
+ });
1861
+ }
1862
+ static addTickerTimeoutInfo(tags, ticker, timeout, canBeDeletedBeforeEnd) {
1863
+ if (typeof tags === "string") {
1864
+ tags = [tags];
1865
+ }
1866
+ _GameWindowManager._currentTickersTimeouts[timeout] = {
1867
+ tags,
1868
+ ticker,
1869
+ canBeDeletedBeforeEnd
1870
+ };
1871
+ }
1872
+ static removeTickerTimeoutInfo(timeout) {
1873
+ if (typeof timeout !== "string") {
1874
+ timeout = timeout.toString();
1875
+ }
1876
+ if (_GameWindowManager._currentTickersTimeouts[timeout]) {
1877
+ delete _GameWindowManager._currentTickersTimeouts[timeout];
1878
+ }
1879
+ }
1880
+ static removeTickerTimeout(timeout) {
1881
+ if (typeof timeout !== "string") {
1882
+ timeout = timeout.toString();
1883
+ }
1884
+ clearTimeout(Number(timeout));
1885
+ _GameWindowManager.removeTickerTimeoutInfo(timeout);
1886
+ }
1887
+ static removeTickerTimeoutsByTag(tag, checkCanBeDeletedBeforeEnd) {
1888
+ for (let timeout in _GameWindowManager._currentTickersTimeouts) {
1889
+ let tagsWithoutTagToRemove = _GameWindowManager._currentTickersTimeouts[timeout].tags.filter((t) => t !== tag);
1890
+ if (tagsWithoutTagToRemove.length === 0) {
1891
+ let canBeDeletedBeforeEnd = _GameWindowManager._currentTickersTimeouts[timeout].canBeDeletedBeforeEnd;
1892
+ if (!checkCanBeDeletedBeforeEnd || canBeDeletedBeforeEnd) {
1893
+ _GameWindowManager.removeTickerTimeout(timeout);
1894
+ }
1895
+ } else {
1896
+ _GameWindowManager._currentTickersTimeouts[timeout].tags = tagsWithoutTagToRemove;
1897
+ }
1898
+ }
1899
+ }
1900
+ /**
1901
+ * Remove all tickers from the canvas.
1902
+ */
1903
+ static removeAllTickers() {
1904
+ _GameWindowManager._currentTickersSteps = {};
1905
+ Object.keys(_GameWindowManager._currentTickers).forEach((id) => {
1906
+ _GameWindowManager.removeTicker(id);
1907
+ });
1908
+ _GameWindowManager._currentTickers = {};
1909
+ for (let timeout in _GameWindowManager._currentTickersTimeouts) {
1910
+ _GameWindowManager.removeTickerTimeout(timeout);
1911
+ }
1912
+ }
1913
+ /**
1914
+ * Remove all tickers from a canvas element.
1915
+ * @param tag The tag of the canvas element that will use the ticker.
1916
+ */
1917
+ static removeTickerByCanvasElement(tag) {
1918
+ if (typeof tag === "string") {
1919
+ tag = [tag];
1920
+ }
1921
+ tag.forEach((tag2) => {
1922
+ for (let id in _GameWindowManager._currentTickers) {
1923
+ let ticker = _GameWindowManager._currentTickers[id];
1924
+ if (ticker.canvasElementTags.includes(tag2)) {
1925
+ _GameWindowManager.removeTicker(id);
1926
+ }
1927
+ }
1928
+ if (_GameWindowManager._currentTickersSteps[tag2]) {
1929
+ delete _GameWindowManager._currentTickersSteps[tag2];
1930
+ }
1931
+ _GameWindowManager.removeTickerTimeoutsByTag(tag2, false);
1932
+ delete _GameWindowManager._currentTickersSteps[tag2];
1933
+ });
1934
+ }
1935
+ static removeTickerStepByCanvasElement(tag) {
1936
+ if (_GameWindowManager._currentTickersSteps[tag]) {
1937
+ delete _GameWindowManager._currentTickersSteps[tag];
1938
+ }
1939
+ for (let id in _GameWindowManager._currentTickers) {
1940
+ let ticker = _GameWindowManager._currentTickers[id];
1941
+ if (ticker.createdByTicketStepsId === tag) {
1942
+ _GameWindowManager.removeTicker(id);
1943
+ }
1944
+ }
1945
+ }
1946
+ static removeTicker(tickerId) {
1947
+ let ticker = _GameWindowManager._currentTickers[tickerId];
1948
+ if (ticker) {
1949
+ if (ticker.args.hasOwnProperty(tagToRemoveAfter)) {
1950
+ let tagToRemoveAfter2 = ticker.args.tagToRemoveAfter;
1951
+ _GameWindowManager.removeCanvasElement(tagToRemoveAfter2);
1952
+ }
1953
+ _GameWindowManager.app.ticker.remove(ticker.fn);
1954
+ delete _GameWindowManager._currentTickers[tickerId];
1955
+ }
1956
+ }
1957
+ /**
1958
+ * Clear the canvas and the tickers.
1959
+ */
1960
+ static clear() {
1961
+ _GameWindowManager.removeCanvasElements();
1962
+ }
1963
+ /* Export and Import Methods */
1964
+ /**
1965
+ * Export the canvas and the tickers to a JSON string.
1966
+ * @returns The JSON string.
1967
+ */
1968
+ static exportJson() {
1969
+ return JSON.stringify(this.export());
1970
+ }
1971
+ /**
1972
+ * Export the canvas and the tickers to an object.
1973
+ * @returns The object.
1974
+ */
1975
+ static export() {
1976
+ let currentElements = {};
1977
+ for (let tag in _GameWindowManager._children) {
1978
+ currentElements[tag] = exportCanvasElement(_GameWindowManager._children[tag]);
1979
+ }
1980
+ return {
1981
+ currentTickers: createExportableElement(_GameWindowManager.currentTickersWithoutCreatedBySteps),
1982
+ currentTickersSteps: createExportableElement(_GameWindowManager._currentTickersSteps),
1983
+ currentElements: createExportableElement(currentElements),
1984
+ childrenTagsOrder: createExportableElement(_GameWindowManager.childrenTagsOrder)
1985
+ };
1986
+ }
1987
+ /**
1988
+ * Import the canvas and the tickers from a JSON string.
1989
+ * @param dataString The JSON string.
1990
+ */
1991
+ static importJson(dataString) {
1992
+ _GameWindowManager.import(JSON.parse(dataString));
1993
+ }
1994
+ /**
1995
+ * Import the canvas and the tickers from an object.
1996
+ * @param data The object.
1997
+ */
1998
+ static import(data) {
1999
+ _GameWindowManager.clear();
2000
+ try {
2001
+ if (data.hasOwnProperty("childrenTagsOrder") && data.hasOwnProperty("currentElements")) {
2002
+ let currentElements = data["currentElements"];
2003
+ let childrenTagsOrder = data["childrenTagsOrder"];
2004
+ childrenTagsOrder.forEach((tag) => {
2005
+ if (currentElements[tag]) {
2006
+ let element = importCanvasElement(currentElements[tag]);
2007
+ _GameWindowManager.addCanvasElement(tag, element);
2008
+ _GameWindowManager.childrenTagsOrder.push(tag);
2009
+ }
2010
+ });
2011
+ } else {
2012
+ console.error("[Pixi'VN] The data does not have the properties childrenTagsOrder and currentElements");
2013
+ return;
2014
+ }
2015
+ if (data.hasOwnProperty("currentTickers")) {
2016
+ let currentTickers = data["currentTickers"];
2017
+ for (let id in currentTickers) {
2018
+ let t = currentTickers[id];
2019
+ let tags = t.canvasElementTags;
2020
+ let ticker = geTickerInstanceByClassName(t.className, t.args, t.duration, t.priority);
2021
+ if (ticker) {
2022
+ _GameWindowManager.addTicker(tags, ticker);
2023
+ } else {
2024
+ console.error(`[Pixi'VN] Ticker ${t.className} not found`);
2025
+ }
2026
+ }
2027
+ }
2028
+ if (data.hasOwnProperty("currentTickersSteps")) {
2029
+ let currentTickersSteps = data["currentTickersSteps"];
2030
+ _GameWindowManager.restoneTickersSteps(currentTickersSteps);
2031
+ }
2032
+ } catch (e) {
2033
+ console.error("[Pixi'VN] Error importing data", e);
2034
+ }
2035
+ }
2036
+ };
2037
+ _GameWindowManager._app = void 0;
2038
+ _GameWindowManager._isInitialized = false;
2039
+ _GameWindowManager._children = {};
2040
+ /**
2041
+ * The order of the children tags.
2042
+ */
2043
+ _GameWindowManager.childrenTagsOrder = [];
2044
+ _GameWindowManager._currentTickers = {};
2045
+ _GameWindowManager._currentTickersSteps = {};
2046
+ _GameWindowManager._currentTickersTimeouts = {};
2047
+ var GameWindowManager = _GameWindowManager;
2048
+
2049
+ // src/managers/StepManager.ts
2050
+ var _GameStepManager = class _GameStepManager {
2051
+ constructor() {
2052
+ }
2053
+ static get stepsHistory() {
2054
+ return _GameStepManager._stepsHistory;
2055
+ }
2056
+ /**
2057
+ * lastStepIndex is the last step index that occurred during the progression of the steps. **Not is the length of the stepsHistory - 1.**
2058
+ */
2059
+ static get lastStepIndex() {
2060
+ return _GameStepManager._lastStepIndex;
2061
+ }
2062
+ /**
2063
+ * Increase the last step index that occurred during the progression of the steps.
2064
+ */
2065
+ static increaseLastStepIndex() {
2066
+ _GameStepManager._lastStepIndex++;
2067
+ }
2068
+ static get openedLabels() {
2069
+ return _GameStepManager._openedLabels;
2070
+ }
2071
+ /**
2072
+ * currentLabelId is the current label id that occurred during the progression of the steps.
2073
+ */
2074
+ static get currentLabelId() {
2075
+ if (_GameStepManager._openedLabels.length > 0) {
2076
+ let item = _GameStepManager._openedLabels[_GameStepManager._openedLabels.length - 1];
2077
+ return item.label;
2078
+ }
2079
+ return void 0;
2080
+ }
2081
+ /**
2082
+ * currentLabel is the current label that occurred during the progression of the steps.
2083
+ */
2084
+ static get currentLabel() {
2085
+ if (_GameStepManager.currentLabelId) {
2086
+ return getLabelById(_GameStepManager.currentLabelId);
2087
+ }
2088
+ }
2089
+ static get currentLabelStepIndex() {
2090
+ if (_GameStepManager._openedLabels.length > 0) {
2091
+ let item = _GameStepManager._openedLabels[_GameStepManager._openedLabels.length - 1];
2092
+ return item.currentStepIndex;
2093
+ }
2094
+ return null;
2095
+ }
2096
+ /**
2097
+ * lastHistoryStep is the last history step that occurred during the progression of the steps.
2098
+ */
2099
+ static get lastHistoryStep() {
2100
+ if (_GameStepManager._stepsHistory.length > 0) {
2101
+ return _GameStepManager._stepsHistory[_GameStepManager._stepsHistory.length - 1];
2102
+ }
2103
+ return null;
2104
+ }
2105
+ static get originalStepData() {
2106
+ if (!_GameStepManager._originalStepData) {
2107
+ return {
2108
+ path: "",
2109
+ storage: {},
2110
+ canvas: {
2111
+ childrenTagsOrder: [],
2112
+ currentElements: {},
2113
+ currentTickers: {},
2114
+ currentTickersSteps: {}
2115
+ },
2116
+ labelIndex: -1,
2117
+ openedLabels: []
2118
+ };
2119
+ }
2120
+ return createExportableElement(_GameStepManager._originalStepData);
2121
+ }
2122
+ static set originalStepData(value) {
2123
+ _GameStepManager._originalStepData = createExportableElement(value);
2124
+ }
2125
+ /* Edit History Methods */
2126
+ /**
2127
+ * Add a label to the history.
2128
+ * @param label The label to add to the history.
2129
+ */
2130
+ static addStepHistory(step, choiseMade) {
2131
+ let stepHistory = getStepSha1(step);
2132
+ let historyStep = {
2133
+ path: window.location.pathname,
2134
+ storage: GameStorageManager.export(),
2135
+ canvas: GameWindowManager.export(),
2136
+ labelIndex: _GameStepManager.currentLabelStepIndex || 0,
2137
+ openedLabels: createExportableElement(_GameStepManager._openedLabels)
2138
+ };
2139
+ if (_GameStepManager.originalStepData) {
2140
+ if (_GameStepManager.originalStepData.openedLabels.length === historyStep.openedLabels.length) {
2141
+ try {
2142
+ let lastStepDataOpenedLabelsString = JSON.stringify(_GameStepManager.originalStepData.openedLabels);
2143
+ let historyStepOpenedLabelsString = JSON.stringify(historyStep.openedLabels);
2144
+ if (lastStepDataOpenedLabelsString === historyStepOpenedLabelsString && _GameStepManager.originalStepData.path === historyStep.path && _GameStepManager.originalStepData.labelIndex === historyStep.labelIndex) {
2145
+ return;
2146
+ }
2147
+ } catch (e) {
2148
+ console.error("[Pixi'VN] Error comparing openedLabels", e);
2149
+ }
2150
+ }
2151
+ }
2152
+ let data = deepDiff.diff(_GameStepManager.originalStepData, historyStep);
2153
+ if (data) {
2154
+ let dialoge = void 0;
2155
+ let requiredChoices = void 0;
2156
+ if (GameStorageManager.getVariable(GameStorageManager.keysSystem.LAST_DIALOGUE_ADDED_IN_STEP_MEMORY_KEY) === _GameStepManager.lastStepIndex) {
2157
+ dialoge = getDialogue();
2158
+ }
2159
+ if (GameStorageManager.getVariable(GameStorageManager.keysSystem.LAST_MENU_OPTIONS_ADDED_IN_STEP_MEMORY_KEY) === _GameStepManager.lastStepIndex) {
2160
+ requiredChoices = GameStorageManager.getVariable(GameStorageManager.keysSystem.CURRENT_MENU_OPTIONS_MEMORY_KEY);
2161
+ }
2162
+ _GameStepManager._stepsHistory.push({
2163
+ diff: data,
2164
+ currentLabel: _GameStepManager.currentLabelId,
2165
+ dialoge,
2166
+ choices: requiredChoices,
2167
+ stepSha1: stepHistory,
2168
+ index: _GameStepManager.lastStepIndex,
2169
+ choiceIndexMade: choiseMade
2170
+ });
2171
+ _GameStepManager.originalStepData = historyStep;
2172
+ }
2173
+ _GameStepManager.increaseLastStepIndex();
2174
+ }
2175
+ /**
2176
+ * Add a label to the history.
2177
+ * @param label The label to add to the history.
2178
+ */
2179
+ static pushNewLabel(label) {
2180
+ let currentLabel = getLabelById(label);
2181
+ if (!currentLabel) {
2182
+ throw new Error(`[Pixi'VN] Label ${label} not found`);
2183
+ }
2184
+ _GameStepManager._openedLabels.push({
2185
+ label,
2186
+ currentStepIndex: 0
2187
+ });
2188
+ }
2189
+ /**
2190
+ * Close the current label and add it to the history.
2191
+ * @returns
2192
+ */
2193
+ static closeCurrentLabel() {
2194
+ if (!_GameStepManager.currentLabelId) {
2195
+ console.warn("[Pixi'VN] No label to close");
2196
+ return;
2197
+ }
2198
+ if (!_GameStepManager.currentLabel) {
2199
+ console.error("[Pixi'VN] currentLabel not found");
2200
+ return;
2201
+ }
2202
+ _GameStepManager._openedLabels.pop();
2203
+ }
2204
+ /**
2205
+ * Close all labels and add them to the history. **Attention: This method can cause an unhandled game ending.**
2206
+ */
2207
+ static closeAllLabels() {
2208
+ while (_GameStepManager._openedLabels.length > 0) {
2209
+ _GameStepManager.closeCurrentLabel();
2210
+ }
2211
+ }
2212
+ /**
2213
+ * Increase the current step index of the current label.
2214
+ */
2215
+ static increaseCurrentStepIndex() {
2216
+ let item = _GameStepManager._openedLabels[_GameStepManager._openedLabels.length - 1];
2217
+ _GameStepManager._openedLabels[_GameStepManager._openedLabels.length - 1] = __spreadProps(__spreadValues({}, item), {
2218
+ currentStepIndex: item.currentStepIndex + 1
2219
+ });
2220
+ }
2221
+ static restorLastLabelList() {
2222
+ _GameStepManager._openedLabels = _GameStepManager.originalStepData.openedLabels;
2223
+ }
2224
+ /* Run Methods */
2225
+ /**
2226
+ * Execute the next step and add it to the history.
2227
+ * @param props The props to pass to the step.
2228
+ * @param choiseMade The index of the choise made by the player. (This params is used in the choice menu)
2229
+ * @returns StepLabelResultType or undefined.
2230
+ * @example
2231
+ * ```typescript
2232
+ * function nextOnClick() {
2233
+ * setLoading(true)
2234
+ * GameStepManager.runNextStep(yourParams)
2235
+ * .then((result) => {
2236
+ * setUpdate((p) => p + 1)
2237
+ * setLoading(false)
2238
+ * if (result) {
2239
+ * // your code
2240
+ * }
2241
+ * })
2242
+ * .catch((e) => {
2243
+ * setLoading(false)
2244
+ * console.error(e)
2245
+ * })
2246
+ * }
2247
+ * ```
2248
+ */
2249
+ static runNextStep(props, choiseMade) {
2250
+ return __async(this, null, function* () {
2251
+ _GameStepManager.increaseCurrentStepIndex();
2252
+ return yield _GameStepManager.runCurrentStep(props, choiseMade);
2253
+ });
2254
+ }
2255
+ /**
2256
+ * Execute the current step and add it to the history.
2257
+ * @param props The props to pass to the step.
2258
+ * @param choiseMade The choise made by the player.
2259
+ * @returns StepLabelResultType or undefined.
2260
+ */
2261
+ static runCurrentStep(props, choiseMade) {
2262
+ return __async(this, null, function* () {
2263
+ if (_GameStepManager.currentLabelId) {
2264
+ let currentLabelStepIndex = _GameStepManager.currentLabelStepIndex;
2265
+ if (currentLabelStepIndex === null) {
2266
+ console.error("[Pixi'VN] currentLabelStepIndex is null");
2267
+ return;
2268
+ }
2269
+ let currentLabel = _GameStepManager.currentLabel;
2270
+ if (!currentLabel) {
2271
+ console.error("[Pixi'VN] currentLabel not found");
2272
+ return;
2273
+ }
2274
+ if (currentLabel.steps.length > currentLabelStepIndex) {
2275
+ let step = currentLabel.steps[currentLabelStepIndex];
2276
+ let result = yield step(props);
2277
+ _GameStepManager.addStepHistory(step, choiseMade);
2278
+ return result;
2279
+ } else if (_GameStepManager.openedLabels.length > 1) {
2280
+ _GameStepManager.closeCurrentLabel();
2281
+ return yield _GameStepManager.runNextStep(props, choiseMade);
2282
+ } else {
2283
+ _GameStepManager.restorLastLabelList();
2284
+ console.error("[Pixi'VN] The end of the game is not managed, so the game is blocked. Read this documentation to know how to manage the end of the game: https://pixi-vn.web.app/start/labels.html#how-manage-the-end-of-the-game");
2285
+ return;
2286
+ }
2287
+ }
2288
+ });
2289
+ }
2290
+ /**
2291
+ * Execute the label and add it to the history. (It's similar to Ren'Py's call function)
2292
+ * @param label The label to execute or the id of the label
2293
+ * @param props The props to pass to the label.
2294
+ * @returns StepLabelResultType or undefined.
2295
+ * @example
2296
+ * ```typescript
2297
+ * GameStepManager.callLabel(startLabel, yourParams).then((result) => {
2298
+ * if (result) {
2299
+ * // your code
2300
+ * }
2301
+ * })
2302
+ * ```
2303
+ * @example
2304
+ * ```typescript
2305
+ * // if you use it in a step label you should return the result.
2306
+ * return GameStepManager.callLabel(startLabel).then((result) => {
2307
+ * return result
2308
+ * })
2309
+ * ```
2310
+ */
2311
+ static callLabel(label, props) {
2312
+ return __async(this, null, function* () {
2313
+ let choiseMade = void 0;
2314
+ let labelId;
2315
+ if (typeof label === "string") {
2316
+ labelId = label;
2317
+ } else {
2318
+ labelId = label.id;
2319
+ if (typeof label.choiseIndex === "number") {
2320
+ choiseMade = label.choiseIndex;
2321
+ }
2322
+ }
2323
+ try {
2324
+ if (labelId === CLOSE_LABEL_ID) {
2325
+ let closeCurrentLabel = newCloseLabel(choiseMade);
2326
+ let choice = {
2327
+ label: closeCurrentLabel,
2328
+ text: "",
2329
+ closeCurrentLabel: false,
2330
+ type: "close",
2331
+ props: {}
2332
+ };
2333
+ return _GameStepManager.closeChoiceMenu(choice, props);
2334
+ }
2335
+ let tempLabel = getLabelById(labelId);
2336
+ if (!tempLabel) {
2337
+ throw new Error(`[Pixi'VN] Label ${labelId} not found`);
2338
+ }
2339
+ _GameStepManager.pushNewLabel(tempLabel.id);
2340
+ } catch (e) {
2341
+ console.error("[Pixi'VN] Error calling label", e);
2342
+ return;
2343
+ }
2344
+ return yield _GameStepManager.runCurrentStep(props, choiseMade);
2345
+ });
2346
+ }
2347
+ /**
2348
+ * Execute the label, close the current label, execute the new label and add the new label to the history. (It's similar to Ren'Py's jump function)
2349
+ * @param label The label to execute.
2350
+ * @param props The props to pass to the label or the id of the label
2351
+ * @returns StepLabelResultType or undefined.
2352
+ * @example
2353
+ * ```typescript
2354
+ * GameStepManager.jumpLabel(startLabel, yourParams).then((result) => {
2355
+ * if (result) {
2356
+ * // your code
2357
+ * }
2358
+ * })
2359
+ * ```
2360
+ * @example
2361
+ * ```typescript
2362
+ * // if you use it in a step label you should return the result.
2363
+ * return GameStepManager.jumpLabel(startLabel).then((result) => {
2364
+ * return result
2365
+ * })
2366
+ * ```
2367
+ */
2368
+ static jumpLabel(label, props) {
2369
+ return __async(this, null, function* () {
2370
+ _GameStepManager.closeCurrentLabel();
2371
+ let choiseMade = void 0;
2372
+ let labelId;
2373
+ if (typeof label === "string") {
2374
+ labelId = label;
2375
+ } else {
2376
+ labelId = label.id;
2377
+ if (typeof label.choiseIndex === "number") {
2378
+ choiseMade = label.choiseIndex;
2379
+ }
2380
+ }
2381
+ try {
2382
+ if (labelId === CLOSE_LABEL_ID) {
2383
+ let closeCurrentLabel = newCloseLabel(choiseMade);
2384
+ let choice = {
2385
+ label: closeCurrentLabel,
2386
+ text: "",
2387
+ closeCurrentLabel: false,
2388
+ type: "close",
2389
+ props: {}
2390
+ };
2391
+ return _GameStepManager.closeChoiceMenu(choice, props);
2392
+ }
2393
+ let tempLabel = getLabelById(labelId);
2394
+ if (!tempLabel) {
2395
+ throw new Error(`[Pixi'VN] Label ${labelId} not found`);
2396
+ }
2397
+ _GameStepManager.pushNewLabel(tempLabel.id);
2398
+ } catch (e) {
2399
+ console.error("[Pixi'VN] Error jumping label", e);
2400
+ return;
2401
+ }
2402
+ return yield _GameStepManager.runCurrentStep(props, choiseMade);
2403
+ });
2404
+ }
2405
+ /**
2406
+ * When the player is in a choice menu, can use this function to exit to the choice menu.
2407
+ * @param choice
2408
+ * @param props
2409
+ * @returns StepLabelResultType or undefined.
2410
+ * @example
2411
+ * ```typescript
2412
+ * GameStepManager.closeChoiceMenu(yourParams).then((result) => {
2413
+ * if (result) {
2414
+ * // your code
2415
+ * }
2416
+ * })
2417
+ * ```
2418
+ */
2419
+ static closeChoiceMenu(choice, props) {
2420
+ return __async(this, null, function* () {
2421
+ let label = choice.label;
2422
+ let choiseMade = void 0;
2423
+ if (typeof label.choiseIndex === "number") {
2424
+ choiseMade = label.choiseIndex;
2425
+ }
2426
+ if (choice.closeCurrentLabel) {
2427
+ _GameStepManager.closeCurrentLabel();
2428
+ }
2429
+ return _GameStepManager.runNextStep(props, choiseMade);
2430
+ });
2431
+ }
2432
+ /* After Update Methods */
2433
+ // /**
2434
+ // * After the update or code edit, some steps or labels may no longer match.
2435
+ // * - In case of step mismatch, the game will be updated to the last matching step.
2436
+ // * - In case of label mismatch, the game gives an error.
2437
+ // * @returns
2438
+ // */
2439
+ // private static afterUpdate() {
2440
+ // // TODO: implement
2441
+ // if (!GameStepManager.currentLabel) {
2442
+ // // TODO: implement
2443
+ // return
2444
+ // }
2445
+ // let currentLabel = getLabelInstanceByClassName(GameStepManager.currentLabel)
2446
+ // if (!currentLabel) {
2447
+ // console.error("Label not found")
2448
+ // return
2449
+ // }
2450
+ // let oldSteps = GameStepManager.stepsAfterLastHistoryLabel
2451
+ // let currentStepIndex = currentLabel.getCorrespondingStepsNumber(oldSteps)
2452
+ // let stepToRemove = oldSteps.length - currentStepIndex
2453
+ // GameStepManager.removeLastHistoryNodes(stepToRemove)
2454
+ // GameStepManager.loadLastStep()
2455
+ // }
2456
+ // private static loadLastStep() {
2457
+ // // TODO: implement
2458
+ // }
2459
+ // /**
2460
+ // * Remove a number of items from the last of the history.
2461
+ // * @param itemNumber The number of items to remove from the last of the history.
2462
+ // */
2463
+ // private static removeLastHistoryNodes(itemNumber: number) {
2464
+ // // TODO: implement
2465
+ // for (let i = 0; i < itemNumber; i++) {
2466
+ // GameStepManager._stepsHistory.pop()
2467
+ // }
2468
+ // }
2469
+ // /**
2470
+ // * stepsAfterLastHistoryLabel is a list of steps that occurred after the last history label.
2471
+ // */
2472
+ // private static get stepsAfterLastHistoryLabel(): StepHistoryDataType[] {
2473
+ // let length = GameStepManager._stepsHistory.length
2474
+ // let steps: StepHistoryDataType[] = []
2475
+ // for (let i = length - 1; i >= 0; i--) {
2476
+ // let element = GameStepManager._stepsHistory[i]
2477
+ // if (typeof element === "object" && "stepSha1" in element) {
2478
+ // steps.push(element.stepSha1)
2479
+ // }
2480
+ // else {
2481
+ // break
2482
+ // }
2483
+ // }
2484
+ // steps = steps.reverse()
2485
+ // return steps
2486
+ // }
2487
+ /* Go Back & Refresh Methods */
2488
+ /**
2489
+ * Go back to the last step and add it to the history.
2490
+ * @param navigate The navigate function.
2491
+ * @param steps The number of steps to go back.
2492
+ * @returns
2493
+ * @example
2494
+ * ```typescript
2495
+ * export function goBack(navigate: (path: string) => void, afterBack?: () => void) {
2496
+ * GameStepManager.goBack(navigate)
2497
+ * afterBack && afterBack()
2498
+ * }
2499
+ * ```
2500
+ */
2501
+ static goBack(navigate, steps = 1) {
2502
+ if (steps <= 0) {
2503
+ console.warn("[Pixi'VN] Steps must be greater than 0");
2504
+ return;
2505
+ }
2506
+ if (_GameStepManager._stepsHistory.length <= 1) {
2507
+ console.warn("[Pixi'VN] No steps to go back");
2508
+ return;
2509
+ }
2510
+ let restoredStep = _GameStepManager.goBackInternal(steps, _GameStepManager.originalStepData);
2511
+ if (restoredStep) {
2512
+ _GameStepManager._originalStepData = restoredStep;
2513
+ _GameStepManager._openedLabels = createExportableElement(restoredStep.openedLabels);
2514
+ GameStorageManager.import(createExportableElement(restoredStep.storage));
2515
+ GameWindowManager.import(createExportableElement(restoredStep.canvas));
2516
+ navigate(restoredStep.path);
2517
+ } else {
2518
+ console.error("[Pixi'VN] Error going back");
2519
+ }
2520
+ }
2521
+ static goBackInternal(steps, restoredStep) {
2522
+ if (steps <= 0) {
2523
+ return restoredStep;
2524
+ }
2525
+ if (_GameStepManager._stepsHistory.length == 0) {
2526
+ return restoredStep;
2527
+ }
2528
+ let lastHistoryStep = _GameStepManager.lastHistoryStep;
2529
+ if (lastHistoryStep) {
2530
+ try {
2531
+ let result = restoreDeepDiffChanges(restoredStep, lastHistoryStep.diff);
2532
+ _GameStepManager._lastStepIndex = lastHistoryStep.index;
2533
+ _GameStepManager._stepsHistory.pop();
2534
+ return _GameStepManager.goBackInternal(steps - 1, result);
2535
+ } catch (e) {
2536
+ console.error("[Pixi'VN] Error applying diff", e);
2537
+ return restoredStep;
2538
+ }
2539
+ } else {
2540
+ return restoredStep;
2541
+ }
2542
+ }
2543
+ /**
2544
+ * Return true if it is possible to go back.
2545
+ */
2546
+ static get canGoBack() {
2547
+ return _GameStepManager._stepsHistory.length > 1;
2548
+ }
2549
+ /**
2550
+ * Add a label to the history.
2551
+ */
2552
+ static clear() {
2553
+ _GameStepManager._stepsHistory = [];
2554
+ _GameStepManager._openedLabels = [];
2555
+ }
2556
+ /* Export and Import Methods */
2557
+ /**
2558
+ * Export the history to a JSON string.
2559
+ * @returns The history in a JSON string.
2560
+ */
2561
+ static exportJson() {
2562
+ return JSON.stringify(this.export());
2563
+ }
2564
+ /**
2565
+ * Export the history to an object.
2566
+ * @returns The history in an object.
2567
+ */
2568
+ static export() {
2569
+ return {
2570
+ stepsHistory: _GameStepManager._stepsHistory,
2571
+ openedLabels: _GameStepManager._openedLabels,
2572
+ lastStepIndex: _GameStepManager._lastStepIndex,
2573
+ originalStepData: _GameStepManager._originalStepData
2574
+ };
2575
+ }
2576
+ /**
2577
+ * Import the history from a JSON string.
2578
+ * @param dataString The history in a JSON string.
2579
+ */
2580
+ static importJson(dataString) {
2581
+ _GameStepManager.import(JSON.parse(dataString));
2582
+ }
2583
+ /**
2584
+ * Import the history from an object.
2585
+ * @param data The history in an object.
2586
+ */
2587
+ static import(data) {
2588
+ _GameStepManager.clear();
2589
+ try {
2590
+ if (data.hasOwnProperty("stepsHistory")) {
2591
+ _GameStepManager._stepsHistory = data["stepsHistory"];
2592
+ } else {
2593
+ console.warn("[Pixi'VN] Could not import stepsHistory data, so will be ignored");
2594
+ }
2595
+ if (data.hasOwnProperty("openedLabels")) {
2596
+ _GameStepManager._openedLabels = data["openedLabels"];
2597
+ } else {
2598
+ console.warn("[Pixi'VN] Could not import openedLabels data, so will be ignored");
2599
+ }
2600
+ if (data.hasOwnProperty("lastStepIndex")) {
2601
+ _GameStepManager._lastStepIndex = data["lastStepIndex"];
2602
+ } else {
2603
+ console.warn("[Pixi'VN] Could not import lastStepIndex data, so will be ignored");
2604
+ }
2605
+ if (data.hasOwnProperty("originalStepData")) {
2606
+ _GameStepManager._originalStepData = data["originalStepData"];
2607
+ } else {
2608
+ console.warn("[Pixi'VN] Could not import originalStepData data, so will be ignored");
2609
+ }
2610
+ } catch (e) {
2611
+ console.error("[Pixi'VN] Error importing data", e);
2612
+ }
2613
+ }
2614
+ };
2615
+ /**
2616
+ * stepHistory is a list of label events and steps that occurred during the progression of the steps.
2617
+ */
2618
+ _GameStepManager._stepsHistory = [];
2619
+ _GameStepManager._lastStepIndex = 0;
2620
+ _GameStepManager._openedLabels = [];
2621
+ _GameStepManager._originalStepData = void 0;
2622
+ var GameStepManager = _GameStepManager;
2623
+
2624
+ // src/classes/StoredClassModel.ts
2625
+ var StoredClassModel = class {
2626
+ /**
2627
+ * @param categoryId The id of the category. For example if you are storing a character class, you can use "characters" as categoryId. so all instances of the character class will be stored in the "characters" category.
2628
+ * @param id The id of instance of the class. This id must be unique for the category.
2629
+ */
2630
+ constructor(categoryId, id) {
2631
+ this.categoryId = categoryId;
2632
+ this._id = id;
2633
+ }
2634
+ /**
2635
+ * Is id of the stored class. is unique for this class.
2636
+ */
2637
+ get id() {
2638
+ return this._id;
2639
+ }
2640
+ /**
2641
+ * Update a property in the storage.
2642
+ * @param propertyName The name of the property to set.
2643
+ * @param value The value to set. If is undefined, the property will be removed from the storage.
2644
+ */
2645
+ setStorageProperty(propertyName, value) {
2646
+ let storage = GameStorageManager.getVariable(this.categoryId);
2647
+ if (!storage) {
2648
+ storage = {};
2649
+ }
2650
+ if (!storage.hasOwnProperty(this.id)) {
2651
+ storage[this.id] = {};
2652
+ }
2653
+ if (value === void 0 || value === null) {
2654
+ if (storage[this.id].hasOwnProperty(propertyName)) {
2655
+ delete storage[this.id][propertyName];
2656
+ }
2657
+ } else {
2658
+ storage[this.id] = __spreadProps(__spreadValues({}, storage[this.id]), { [propertyName]: value });
2659
+ }
2660
+ if (Object.keys(storage[this.id]).length === 0) {
2661
+ delete storage[this.id];
2662
+ }
2663
+ GameStorageManager.setVariable(this.categoryId, storage);
2664
+ }
2665
+ /**
2666
+ * Get a property from the storage.
2667
+ * @param propertyName The name of the property to get.
2668
+ * @returns The value of the property. If the property is not found, returns undefined.
2669
+ */
2670
+ getStorageProperty(propertyName) {
2671
+ let storage = GameStorageManager.getVariable(this.categoryId);
2672
+ if (storage && storage.hasOwnProperty(this.id) && storage[this.id].hasOwnProperty(propertyName)) {
2673
+ return storage[this.id][propertyName];
2674
+ }
2675
+ return void 0;
2676
+ }
2677
+ };
2678
+
2679
+ // src/classes/CharacterBaseModel.ts
2680
+ var CharacterBaseModel2 = class extends StoredClassModel {
2681
+ /**
2682
+ * @param id The id of the character.
2683
+ * @param props The properties of the character.
2684
+ */
2685
+ constructor(id, props) {
2686
+ super(GameStorageManager.keysSystem.CHARACTER_CATEGORY_KEY, id);
2687
+ this.defaultName = "";
2688
+ this.defaultName = props.name;
2689
+ this.defaultSurname = props.surname;
2690
+ this.defaultAge = props.age;
2691
+ this._icon = props.icon;
2692
+ this._color = props.color;
2693
+ }
2694
+ /***
2695
+ * The name of the character.
2696
+ * If you set undefined, it will return the default name.
2697
+ */
2698
+ get name() {
2699
+ return this.getStorageProperty("name") || this.defaultName;
2700
+ }
2701
+ set name(value) {
2702
+ this.setStorageProperty("name", value);
2703
+ }
2704
+ /**
2705
+ * The surname of the character.
2706
+ * If you set undefined, it will return the default surname.
2707
+ */
2708
+ get surname() {
2709
+ return this.getStorageProperty("surname") || this.defaultSurname;
2710
+ }
2711
+ set surname(value) {
2712
+ this.setStorageProperty("surname", value);
2713
+ }
2714
+ /**
2715
+ * The age of the character.
2716
+ * If you set undefined, it will return the default age.
2717
+ */
2718
+ get age() {
2719
+ return this.getStorageProperty("age") || this.defaultAge;
2720
+ }
2721
+ set age(value) {
2722
+ this.setStorageProperty("age", value);
2723
+ }
2724
+ /**
2725
+ * The icon of the character.
2726
+ */
2727
+ get icon() {
2728
+ return this._icon;
2729
+ }
2730
+ /**
2731
+ * The color of the character.
2732
+ */
2733
+ get color() {
2734
+ return this._color;
2735
+ }
2736
+ };
2737
+
2738
+ // src/classes/DialogueBaseModel.ts
2739
+ var DialogueBaseModel = class {
2740
+ /**
2741
+ * @param text The text of the dialogue.
2742
+ * @param character The id of the character that is speaking.
2743
+ * @param oltherParams Other parameters that can be stored in the dialogue.
2744
+ */
2745
+ constructor(text, character, oltherParams = {}) {
2746
+ /**
2747
+ * The text of the dialogue.
2748
+ */
2749
+ this.text = "";
2750
+ /**
2751
+ * Other parameters that can be stored in the dialogue.
2752
+ */
2753
+ this.oltherParams = {};
2754
+ if (typeof text === "string") {
2755
+ this.text = text;
2756
+ if (typeof character === "string") {
2757
+ this.characterId = character;
2758
+ } else {
2759
+ this.characterId = character == null ? void 0 : character.id;
2760
+ }
2761
+ this.oltherParams = oltherParams;
2762
+ } else {
2763
+ this.text = text.text;
2764
+ if (text.characterId) {
2765
+ this.characterId = text.characterId;
2766
+ }
2767
+ this.oltherParams = text.oltherParams || {};
2768
+ }
2769
+ }
2770
+ /**
2771
+ * Export the dialogue to a DialogueBaseData object.
2772
+ *
2773
+ * @returns The data of the dialogue.
2774
+ */
2775
+ export() {
2776
+ return {
2777
+ text: this.text,
2778
+ characterId: this.characterId,
2779
+ oltherParams: this.oltherParams
2780
+ };
2781
+ }
2782
+ };
2783
+
2784
+ // src/labels/TestConstant.ts
2785
+ var juliette = new CharacterBaseModel2("___pixivn_juliette___", {
2786
+ name: "Juliette",
2787
+ age: 25,
2788
+ 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",
2789
+ color: "#ac0086"
2790
+ });
2791
+ saveCharacter(juliette);
2792
+ var eggHeadImage = "https://pixijs.com/assets/eggHead.png";
2793
+ var eggHeadName = `<span style="color:purple">Egg Head</span>`;
2794
+ var flowerTopImage = "https://pixijs.com/assets/flowerTop.png";
2795
+ var flowerTopName = `<span style="color:green">Flower Top</span>`;
2796
+ var helmlokImage = "https://pixijs.com/assets/helmlok.png";
2797
+ var helmlokName = `<span style="color:blue">Helmlok</span>`;
2798
+ var skullyImage = "https://pixijs.com/assets/skully.png";
2799
+ var skullyName = `<span style="color:red">Skully</span>`;
2800
+
2801
+ // src/labels/MarkdownTest.ts
2802
+ var MARKDOWN_TEST_LABEL = "___pixi_vn_markdown_test___";
2803
+ var markdownTest = newLabel(MARKDOWN_TEST_LABEL, [
2804
+ () => __async(void 0, null, function* () {
2805
+ setDialogue({
2806
+ character: juliette,
2807
+ text: `
2808
+ # Markdown Test
2809
+
2810
+ Hello, this is a test of the markdown parser. Pixi'VN does not manage markdown, but you can implement a markdown parser to display text with markdown syntax.
2811
+
2812
+ For example in React, you can use the library [react-markdown](https://www.npmjs.com/package/react-markdown).
2813
+
2814
+ ## Colored Text
2815
+
2816
+ <span style="color:blue">some *blue* text</span>.
2817
+
2818
+ <span style="color:red">some *red* text</span>.
2819
+
2820
+ <span style="color:green">some *green* text</span>.
2821
+
2822
+ ## Bold Text
2823
+
2824
+ **This is bold text.**
2825
+
2826
+ ## Italic Text
2827
+
2828
+ *This is italic text.*
2829
+
2830
+ ## Delete Text
2831
+
2832
+ ~~This is deleted text.~~
2833
+
2834
+ ## Link Test
2835
+
2836
+ [Link to Google](https://www.google.com)
2837
+
2838
+ ## H2 Test
2839
+
2840
+ ### H3 Test
2841
+
2842
+ #### H4 Test
2843
+
2844
+ ## Code Test
2845
+
2846
+ \`Hello World\`
2847
+
2848
+ \`\`\`js
2849
+ console.log("Hello World")
2850
+ \`\`\`
2851
+
2852
+ ## List Test
2853
+
2854
+ - Item 1
2855
+ * Item 2
2856
+ - [x] Item 3
2857
+
2858
+ ## Table Test
2859
+
2860
+ | Header 1 | Header 2 |
2861
+ | -------- | -------- |
2862
+ | Cell 1 | Cell 2 |
2863
+
2864
+ ## Separator Test
2865
+
2866
+ ***
2867
+ Footer
2868
+
2869
+ `
2870
+ });
2871
+ })
2872
+ ]);
2873
+
2874
+ // src/labels/ShowImageTest.ts
2875
+ var IMAGE_ANIMAIONS_TEST_LABEL = "___pixi_vn_images_animations_test___";
2876
+ var imagesAnimationsTest = newLabel(IMAGE_ANIMAIONS_TEST_LABEL, [
2877
+ () => __async(void 0, null, function* () {
2878
+ setDialogue({ character: juliette, text: `These are my 4 puppets: ${eggHeadName}, ${flowerTopName}, ${helmlokName} and ${skullyName}. They can appear, disappear and animate at my will.` });
2879
+ let eggHead = addImage("eggHead", eggHeadImage);
2880
+ yield eggHead.load();
2881
+ eggHead.x = 100;
2882
+ eggHead.y = 100;
2883
+ let flowerTop = addImage("flowerTop", flowerTopImage);
2884
+ flowerTop.x = 300;
2885
+ flowerTop.y = 100;
2886
+ flowerTop.load();
2887
+ let helmlok = addImage("helmlok", helmlokImage);
2888
+ helmlok.x = 100;
2889
+ helmlok.y = 300;
2890
+ let skully = addImage("skully", skullyImage);
2891
+ skully.x = 300;
2892
+ skully.y = 300;
2893
+ yield loadImage([helmlok, skully]);
2894
+ }),
2895
+ () => __async(void 0, null, function* () {
2896
+ setDialogue({ character: juliette, text: "Here's what they can do." });
2897
+ setChoiceMenuOptions([
2898
+ new ChoiceMenuOption("Dissolve effect", imagesDissolveTest),
2899
+ new ChoiceMenuOption("Fade effect", imagesFadeTest),
2900
+ new ChoiceMenuOption("Rotate", imagesRotateTest),
2901
+ new ChoiceMenuOption("Move", imagesMoveTest),
2902
+ new ChoiceMenuOption("Zoom", imagesZoomTest),
2903
+ new ChoiceMenuOptionClose("Cancel", true)
2904
+ ]);
2905
+ }),
2906
+ (props) => GameStepManager.jumpLabel(IMAGE_ANIMAIONS_TEST_LABEL, props)
2907
+ ]);
2908
+ var imagesDissolveTest = newLabel("___pixi_vn_images_dissolve_test___", [
2909
+ () => {
2910
+ setDialogue({
2911
+ character: juliette,
2912
+ text: `Here's what's going to happen:
2913
+ - ${eggHeadName} will disappear with a dissolve effect. If you go next, ${eggHeadName} reappears with a dissolve effect without stopping the dissolve effect
2914
+ - ${eggHeadName} will appear instead of ${flowerTopName}.
2915
+ - ${helmlokName} will disappear with a fade effect and reappear with a fade effect, and repeat.
2916
+ - ${skullyName} will disappear with a fade effect, wait for 0.5 seconds, and reappear with a fade effect.`
2917
+ });
2918
+ removeWithDissolveTransition(["eggHead"], { duration: 2 });
2919
+ let eggHead = new CanvasImage({ x: 300, y: 100 }, eggHeadImage);
2920
+ showWithDissolveTransition("flowerTop", eggHead, { duration: 1 });
2921
+ GameWindowManager.addTickersSteps(
2922
+ "helmlok",
2923
+ [
2924
+ new FadeAlphaTicker({
2925
+ duration: 1,
2926
+ type: "hide"
2927
+ }, 1),
2928
+ new FadeAlphaTicker({
2929
+ duration: 1,
2930
+ type: "show"
2931
+ }, 1),
2932
+ Repeat
2933
+ ]
2934
+ );
2935
+ GameWindowManager.addTickersSteps(
2936
+ "skully",
2937
+ [
2938
+ new FadeAlphaTicker({
2939
+ duration: 0.5,
2940
+ type: "hide",
2941
+ limit: 0.3
2942
+ }, 1),
2943
+ Pause(0.5),
2944
+ new FadeAlphaTicker({
2945
+ duration: 1,
2946
+ type: "show"
2947
+ }, 1)
2948
+ ]
2949
+ );
2950
+ },
2951
+ () => __async(void 0, null, function* () {
2952
+ showWithDissolveTransition("eggHead", eggHeadImage, { duration: 0.5 });
2953
+ })
2954
+ ]);
2955
+ var imagesFadeTest = newLabel("___pixi_vn_images_fade_test___", [
2956
+ () => {
2957
+ setDialogue({
2958
+ character: juliette,
2959
+ text: `Here's what's going to happen:
2960
+ - ${eggHeadName} will disappear with a dissolve effect. If you go next, ${eggHeadName} reappears with a dissolve effect with stopping the dissolve effect
2961
+ - ${eggHeadName} will appear instead of ${flowerTopName}.
2962
+ - ${helmlokName} will disappear with a fade effect and reappear with a fade effect, and repeat.
2963
+ - ${skullyName} will disappear with a fade effect, wait for 0.5 seconds, and reappear with a fade effect.`
2964
+ });
2965
+ removeWithFadeTransition(["eggHead"], { duration: 2 });
2966
+ let eggHead = new CanvasImage({ x: 300, y: 100 }, eggHeadImage);
2967
+ showWithFadeTransition("flowerTop", eggHead, { duration: 1 });
2968
+ GameWindowManager.addTickersSteps(
2969
+ "helmlok",
2970
+ [
2971
+ new FadeAlphaTicker({
2972
+ duration: 1,
2973
+ type: "hide"
2974
+ }),
2975
+ new FadeAlphaTicker({
2976
+ duration: 1,
2977
+ type: "show"
2978
+ }),
2979
+ Repeat
2980
+ ]
2981
+ );
2982
+ GameWindowManager.addTickersSteps(
2983
+ "skully",
2984
+ [
2985
+ new FadeAlphaTicker({
2986
+ duration: 0.5,
2987
+ type: "hide",
2988
+ limit: 0.3
2989
+ }),
2990
+ Pause(0.5),
2991
+ new FadeAlphaTicker({
2992
+ duration: 1,
2993
+ type: "show"
2994
+ })
2995
+ ]
2996
+ );
2997
+ },
2998
+ () => __async(void 0, null, function* () {
2999
+ let eggHeadOld = GameWindowManager.getCanvasElement("eggHead");
3000
+ if (eggHeadOld)
3001
+ eggHeadOld.alpha = 0;
3002
+ showWithFadeTransition("eggHead", eggHeadImage, { duration: 0.5 });
3003
+ })
3004
+ ]);
3005
+ var imagesRotateTest = newLabel("___pixi_vn_images_rotate_test___", [
3006
+ () => {
3007
+ setDialogue({
3008
+ character: juliette,
3009
+ text: `Here's what's going to happen:
3010
+ - ${eggHeadName} will rotate with a anchor set to 0.
3011
+ - ${flowerTopName} will rotate with a anchor set to 0.5 and a exponential speed progression.
3012
+ - ${helmlokName} will rotate with a anchor set to 0.5, rotate 2 times, move to the right, rotate 5 times, and repeat.
3013
+ - ${skullyName} will rotate with a anchor set to 1, rotate 3 times, wait for 0.5 seconds, rotate 7 times.`
3014
+ });
3015
+ let eggHead = GameWindowManager.getCanvasElement("eggHead");
3016
+ if (eggHead)
3017
+ eggHead.anchor.set(0);
3018
+ let flowerTop = GameWindowManager.getCanvasElement("flowerTop");
3019
+ if (flowerTop)
3020
+ flowerTop.anchor.set(0.5);
3021
+ let helmlok = GameWindowManager.getCanvasElement("helmlok");
3022
+ if (helmlok)
3023
+ helmlok.anchor.set(0.5);
3024
+ let skully = GameWindowManager.getCanvasElement("skully");
3025
+ if (skully)
3026
+ skully.anchor.set(1);
3027
+ GameWindowManager.addTicker("eggHead", new RotateTicker({
3028
+ speed: 6,
3029
+ clockwise: true
3030
+ }));
3031
+ GameWindowManager.addTicker("flowerTop", new RotateTicker({
3032
+ speed: 6,
3033
+ clockwise: false,
3034
+ speedProgression: { type: "exponential", percentage: 0.01, limit: 300 }
3035
+ }));
3036
+ GameWindowManager.addTickersSteps("helmlok", [
3037
+ new RotateTicker({
3038
+ speed: 6,
3039
+ clockwise: true
3040
+ }, 2),
3041
+ new RotateTicker({
3042
+ speed: 100,
3043
+ clockwise: false,
3044
+ speedProgression: { type: "exponential", percentage: -0.05 }
3045
+ }),
3046
+ Repeat
3047
+ ]);
3048
+ GameWindowManager.addTickersSteps("skully", [
3049
+ new RotateTicker({
3050
+ speed: 6,
3051
+ clockwise: true
3052
+ }, 3),
3053
+ Pause(0.5),
3054
+ new RotateTicker({
3055
+ speed: 6,
3056
+ clockwise: false
3057
+ }, 7)
3058
+ ]);
3059
+ }
3060
+ ]);
3061
+ var imagesMoveTest = newLabel("___pixi_vn_images_move_test___", [
3062
+ () => {
3063
+ setDialogue({
3064
+ character: juliette,
3065
+ text: `Here's what's going to happen:
3066
+ - ${eggHeadName} will move to { x: 500, y: 100 } with a speed of 0.4.
3067
+ - ${flowerTopName} will move to { x: 500, y: 300 } with a speed of 0.3.
3068
+ - ${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.
3069
+ - ${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.`
3070
+ });
3071
+ GameWindowManager.addTicker("eggHead", new MoveTicker({
3072
+ destination: { x: 500, y: 100 },
3073
+ speed: 24
3074
+ }));
3075
+ GameWindowManager.addTicker("flowerTop", new MoveTicker({
3076
+ destination: { x: 500, y: 300 },
3077
+ speed: 18
3078
+ }));
3079
+ GameWindowManager.addTickersSteps("helmlok", [
3080
+ new MoveTicker({
3081
+ destination: { x: 100, y: 500 },
3082
+ speed: 1200,
3083
+ speedProgression: { type: "linear", amt: -12, limit: 60 }
3084
+ }),
3085
+ new MoveTicker({
3086
+ destination: { x: 1700, y: 500 },
3087
+ speed: 6,
3088
+ speedProgression: { type: "linear", amt: 3 }
3089
+ }),
3090
+ Repeat
3091
+ ]);
3092
+ GameWindowManager.addTickersSteps("skully", [
3093
+ new MoveTicker({
3094
+ destination: { x: 500, y: 500 },
3095
+ speed: 60
3096
+ }),
3097
+ Pause(0.5),
3098
+ new MoveTicker({
3099
+ destination: { x: 100, y: 100 },
3100
+ speed: 60
3101
+ })
3102
+ ]);
3103
+ }
3104
+ ]);
3105
+ var imagesZoomTest = newLabel("___pixi_vn_images_zoom_test___", [
3106
+ () => {
3107
+ setDialogue({
3108
+ character: juliette,
3109
+ text: `Here's what's going to happen:
3110
+ - ${eggHeadName} will zoom out with a speed of 3 and a limit of -0.5.
3111
+ - ${flowerTopName} will zoom in with a speed of 3 and a limit of 2.
3112
+ - ${helmlokName} will unzoom with a speed of 3 and a limit of -1, and zoom in with a speed of 3 and a limit of 1, and repeat.
3113
+ - ${skullyName} will zoom in with a speed of 0.1 and a limit of 5, wait for 0.5 seconds, and zoom out with a speed of 3 and a limit of 1.`
3114
+ });
3115
+ let eggHead = GameWindowManager.getCanvasElement("eggHead");
3116
+ if (eggHead)
3117
+ eggHead.scale.set(2);
3118
+ let helmlok = GameWindowManager.getCanvasElement("helmlok");
3119
+ if (helmlok)
3120
+ helmlok.anchor.set(0.5);
3121
+ GameWindowManager.addTicker("eggHead", new ZoomTicker({
3122
+ speed: 3,
3123
+ limit: -0.5,
3124
+ type: "unzoom"
3125
+ }));
3126
+ GameWindowManager.addTicker("flowerTop", new ZoomTicker({
3127
+ speed: 3,
3128
+ limit: 2
3129
+ }));
3130
+ GameWindowManager.addTickersSteps("helmlok", [
3131
+ new ZoomTicker({
3132
+ speed: 3,
3133
+ limit: -1,
3134
+ type: "unzoom"
3135
+ }),
3136
+ new ZoomTicker({
3137
+ speed: 3,
3138
+ limit: 1
3139
+ }),
3140
+ Repeat
3141
+ ]);
3142
+ GameWindowManager.addTickersSteps("skully", [
3143
+ new ZoomTicker({
3144
+ speed: 0.1,
3145
+ limit: 5,
3146
+ speedProgression: { type: "exponential", percentage: 0.02 }
3147
+ }),
3148
+ Pause(0.5),
3149
+ new ZoomTicker({
3150
+ "type": "unzoom",
3151
+ speed: 3,
3152
+ limit: 1
3153
+ })
3154
+ ]);
3155
+ }
3156
+ ]);
3157
+
3158
+ // src/labels/StartLabel.ts
3159
+ var pixivnTestStartLabel = newLabel(
3160
+ "___pixi_vn_example_start_label___",
3161
+ [
3162
+ () => {
3163
+ let currentTimeName = "";
3164
+ const hour = (/* @__PURE__ */ new Date()).getHours();
3165
+ if (hour >= 5 && hour < 12) {
3166
+ currentTimeName = "morning";
3167
+ } else if (hour >= 12 && hour < 18) {
3168
+ currentTimeName = "afternoon";
3169
+ } else if (hour >= 18 && hour < 22) {
3170
+ currentTimeName = "evening";
3171
+ } else {
3172
+ currentTimeName = "night";
3173
+ }
3174
+ setDialogue({ character: juliette, text: `Good ${currentTimeName}! I'm ${juliette.name}, your virtual assistant. I'm here to help you with your tests.` });
3175
+ },
3176
+ () => setDialogue({ character: juliette, text: `You are running the Pixi\u2019VN test. This test will guide you through the different features of the library.` }),
3177
+ (props) => GameStepManager.jumpLabel(pixivnTestStartLabel2, props)
3178
+ ]
3179
+ );
3180
+ var RESTART_TEST_LABEL = "___pixi_vn_restart_test_label___";
3181
+ var pixivnTestStartLabel2 = newLabel(
3182
+ RESTART_TEST_LABEL,
3183
+ [
3184
+ () => {
3185
+ GameWindowManager.clear();
3186
+ setDialogue({ character: juliette, text: "Which test would you like to start with?" });
3187
+ setChoiceMenuOptions([
3188
+ new ChoiceMenuOption("Images and Animations", imagesAnimationsTest),
3189
+ new ChoiceMenuOption("Markdown Test", markdownTest)
3190
+ ]);
3191
+ },
3192
+ (props) => GameStepManager.jumpLabel(RESTART_TEST_LABEL, props)
3193
+ ]
3194
+ );
3195
+
3196
+ exports.pixivnTestStartLabel = pixivnTestStartLabel;
3197
+ exports.pixivnTestStartLabel2 = pixivnTestStartLabel2;
3198
+ //# sourceMappingURL=out.js.map
3199
+ //# sourceMappingURL=StartLabel.js.map