@drincs/pixi-vn 0.6.0 → 0.6.2

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