@rpgjs/client 5.0.0-alpha.8 → 5.0.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (305) hide show
  1. package/dist/Game/AnimationManager.d.ts +8 -0
  2. package/dist/Game/AnimationManager.js +26 -0
  3. package/dist/Game/AnimationManager.js.map +1 -0
  4. package/dist/Game/Event.d.ts +1 -1
  5. package/dist/Game/Event.js +12 -0
  6. package/dist/Game/Event.js.map +1 -0
  7. package/dist/Game/Map.d.ts +23 -2
  8. package/dist/Game/Map.js +80 -0
  9. package/dist/Game/Map.js.map +1 -0
  10. package/dist/Game/Object.d.ts +157 -0
  11. package/dist/Game/Object.js +211 -0
  12. package/dist/Game/Object.js.map +1 -0
  13. package/dist/Game/Player.d.ts +1 -1
  14. package/dist/Game/Player.js +12 -0
  15. package/dist/Game/Player.js.map +1 -0
  16. package/dist/Gui/Gui.d.ts +177 -5
  17. package/dist/Gui/Gui.js +445 -0
  18. package/dist/Gui/Gui.js.map +1 -0
  19. package/dist/Gui/NotificationManager.d.ts +23 -0
  20. package/dist/Gui/NotificationManager.js +49 -0
  21. package/dist/Gui/NotificationManager.js.map +1 -0
  22. package/dist/Resource.d.ts +97 -0
  23. package/dist/Resource.js +133 -0
  24. package/dist/Resource.js.map +1 -0
  25. package/dist/RpgClient.d.ts +290 -58
  26. package/dist/RpgClientEngine.d.ts +649 -9
  27. package/dist/RpgClientEngine.js +1334 -0
  28. package/dist/RpgClientEngine.js.map +1 -0
  29. package/dist/Sound.d.ts +199 -0
  30. package/dist/Sound.js +167 -0
  31. package/dist/Sound.js.map +1 -0
  32. package/dist/_virtual/_@oxc-project_runtime@0.122.0/helpers/decorate.js +9 -0
  33. package/dist/_virtual/_@oxc-project_runtime@0.122.0/helpers/decorateMetadata.js +6 -0
  34. package/dist/components/animations/animation.ce.js +24 -0
  35. package/dist/components/animations/animation.ce.js.map +1 -0
  36. package/dist/components/animations/hit.ce.js +70 -0
  37. package/dist/components/animations/hit.ce.js.map +1 -0
  38. package/dist/components/animations/index.d.ts +4 -0
  39. package/dist/components/animations/index.js +11 -0
  40. package/dist/components/animations/index.js.map +1 -0
  41. package/dist/components/character.ce.js +392 -0
  42. package/dist/components/character.ce.js.map +1 -0
  43. package/dist/components/dynamics/parse-value.d.ts +1 -0
  44. package/dist/components/dynamics/parse-value.js +44 -0
  45. package/dist/components/dynamics/parse-value.js.map +1 -0
  46. package/dist/components/dynamics/text.ce.js +73 -0
  47. package/dist/components/dynamics/text.ce.js.map +1 -0
  48. package/dist/components/gui/box.ce.js +28 -0
  49. package/dist/components/gui/box.ce.js.map +1 -0
  50. package/dist/components/gui/dialogbox/index.ce.js +205 -0
  51. package/dist/components/gui/dialogbox/index.ce.js.map +1 -0
  52. package/dist/components/gui/gameover.ce.js +193 -0
  53. package/dist/components/gui/gameover.ce.js.map +1 -0
  54. package/dist/components/gui/hud/hud.ce.js +92 -0
  55. package/dist/components/gui/hud/hud.ce.js.map +1 -0
  56. package/dist/components/gui/index.d.ts +15 -3
  57. package/dist/components/gui/index.js +14 -0
  58. package/dist/components/gui/menu/equip-menu.ce.js +481 -0
  59. package/dist/components/gui/menu/equip-menu.ce.js.map +1 -0
  60. package/dist/components/gui/menu/exit-menu.ce.js +54 -0
  61. package/dist/components/gui/menu/exit-menu.ce.js.map +1 -0
  62. package/dist/components/gui/menu/items-menu.ce.js +344 -0
  63. package/dist/components/gui/menu/items-menu.ce.js.map +1 -0
  64. package/dist/components/gui/menu/main-menu.ce.js +417 -0
  65. package/dist/components/gui/menu/main-menu.ce.js.map +1 -0
  66. package/dist/components/gui/menu/options-menu.ce.js +48 -0
  67. package/dist/components/gui/menu/options-menu.ce.js.map +1 -0
  68. package/dist/components/gui/menu/skills-menu.ce.js +107 -0
  69. package/dist/components/gui/menu/skills-menu.ce.js.map +1 -0
  70. package/dist/components/gui/mobile/index.d.ts +8 -0
  71. package/dist/components/gui/mobile/index.js +21 -0
  72. package/dist/components/gui/mobile/index.js.map +1 -0
  73. package/dist/components/gui/mobile/mobile.ce.js +78 -0
  74. package/dist/components/gui/mobile/mobile.ce.js.map +1 -0
  75. package/dist/components/gui/notification/notification.ce.js +64 -0
  76. package/dist/components/gui/notification/notification.ce.js.map +1 -0
  77. package/dist/components/gui/save-load.ce.js +389 -0
  78. package/dist/components/gui/save-load.ce.js.map +1 -0
  79. package/dist/components/gui/shop/shop.ce.js +652 -0
  80. package/dist/components/gui/shop/shop.ce.js.map +1 -0
  81. package/dist/components/gui/title-screen.ce.js +190 -0
  82. package/dist/components/gui/title-screen.ce.js.map +1 -0
  83. package/dist/components/index.d.ts +1 -0
  84. package/dist/components/index.js +4 -0
  85. package/dist/components/prebuilt/hp-bar.ce.js +116 -0
  86. package/dist/components/prebuilt/hp-bar.ce.js.map +1 -0
  87. package/dist/components/prebuilt/index.d.ts +19 -0
  88. package/dist/components/prebuilt/index.js +2 -0
  89. package/dist/components/prebuilt/light-halo.ce.js +94 -0
  90. package/dist/components/prebuilt/light-halo.ce.js.map +1 -0
  91. package/dist/components/scenes/canvas.ce.js +60 -0
  92. package/dist/components/scenes/canvas.ce.js.map +1 -0
  93. package/dist/components/scenes/draw-map.ce.js +89 -0
  94. package/dist/components/scenes/draw-map.ce.js.map +1 -0
  95. package/dist/components/scenes/event-layer.ce.js +28 -0
  96. package/dist/components/scenes/event-layer.ce.js.map +1 -0
  97. package/dist/core/inject.js +18 -0
  98. package/dist/core/inject.js.map +1 -0
  99. package/dist/core/setup.js +16 -0
  100. package/dist/core/setup.js.map +1 -0
  101. package/dist/index.d.ts +15 -1
  102. package/dist/index.js +44 -14
  103. package/dist/module.d.ts +43 -4
  104. package/dist/module.js +176 -0
  105. package/dist/module.js.map +1 -0
  106. package/dist/node_modules/.pnpm/@signe_di@2.9.0/node_modules/@signe/di/dist/index.js +277 -0
  107. package/dist/node_modules/.pnpm/@signe_di@2.9.0/node_modules/@signe/di/dist/index.js.map +1 -0
  108. package/dist/node_modules/.pnpm/@signe_reactive@2.8.3/node_modules/@signe/reactive/dist/index.js +457 -0
  109. package/dist/node_modules/.pnpm/@signe_reactive@2.8.3/node_modules/@signe/reactive/dist/index.js.map +1 -0
  110. package/dist/node_modules/.pnpm/@signe_reactive@2.9.0/node_modules/@signe/reactive/dist/index.js +463 -0
  111. package/dist/node_modules/.pnpm/@signe_reactive@2.9.0/node_modules/@signe/reactive/dist/index.js.map +1 -0
  112. package/dist/node_modules/.pnpm/@signe_room@2.9.0/node_modules/@signe/room/dist/index.js +2191 -0
  113. package/dist/node_modules/.pnpm/@signe_room@2.9.0/node_modules/@signe/room/dist/index.js.map +1 -0
  114. package/dist/node_modules/.pnpm/@signe_sync@2.9.0/node_modules/@signe/sync/dist/chunk-7QVYU63E.js +10 -0
  115. package/dist/node_modules/.pnpm/@signe_sync@2.9.0/node_modules/@signe/sync/dist/chunk-7QVYU63E.js.map +1 -0
  116. package/dist/node_modules/.pnpm/@signe_sync@2.9.0/node_modules/@signe/sync/dist/client/index.js +91 -0
  117. package/dist/node_modules/.pnpm/@signe_sync@2.9.0/node_modules/@signe/sync/dist/client/index.js.map +1 -0
  118. package/dist/node_modules/.pnpm/@signe_sync@2.9.0/node_modules/@signe/sync/dist/index.js +325 -0
  119. package/dist/node_modules/.pnpm/@signe_sync@2.9.0/node_modules/@signe/sync/dist/index.js.map +1 -0
  120. package/dist/node_modules/.pnpm/dset@3.1.4/node_modules/dset/dist/index.js +14 -0
  121. package/dist/node_modules/.pnpm/dset@3.1.4/node_modules/dset/dist/index.js.map +1 -0
  122. package/dist/node_modules/.pnpm/partysocket@1.1.3/node_modules/partysocket/dist/chunk-HAC622V3.js +115 -0
  123. package/dist/node_modules/.pnpm/partysocket@1.1.3/node_modules/partysocket/dist/chunk-HAC622V3.js.map +1 -0
  124. package/dist/node_modules/.pnpm/partysocket@1.1.3/node_modules/partysocket/dist/chunk-S74YV6PU.js +401 -0
  125. package/dist/node_modules/.pnpm/partysocket@1.1.3/node_modules/partysocket/dist/chunk-S74YV6PU.js.map +1 -0
  126. package/dist/node_modules/.pnpm/partysocket@1.1.3/node_modules/partysocket/dist/index.js +2 -0
  127. package/dist/node_modules/.pnpm/zod@3.24.2/node_modules/zod/lib/index.js +3756 -0
  128. package/dist/node_modules/.pnpm/zod@3.24.2/node_modules/zod/lib/index.js.map +1 -0
  129. package/dist/presets/animation.d.ts +31 -0
  130. package/dist/presets/animation.js +39 -0
  131. package/dist/presets/animation.js.map +1 -0
  132. package/dist/presets/faceset.d.ts +30 -0
  133. package/dist/presets/faceset.js +51 -0
  134. package/dist/presets/faceset.js.map +1 -0
  135. package/dist/presets/icon.d.ts +20 -0
  136. package/dist/presets/icon.js +15 -0
  137. package/dist/presets/icon.js.map +1 -0
  138. package/dist/presets/index.d.ts +123 -0
  139. package/dist/presets/index.js +17 -0
  140. package/dist/presets/index.js.map +1 -0
  141. package/dist/presets/lpc.d.ts +89 -0
  142. package/dist/presets/lpc.js +98 -0
  143. package/dist/presets/lpc.js.map +1 -0
  144. package/dist/presets/rmspritesheet.js +42 -0
  145. package/dist/presets/rmspritesheet.js.map +1 -0
  146. package/dist/services/AbstractSocket.d.ts +9 -5
  147. package/dist/services/AbstractSocket.js +11 -0
  148. package/dist/services/AbstractSocket.js.map +1 -0
  149. package/dist/services/keyboardControls.d.ts +15 -0
  150. package/dist/services/keyboardControls.js +23 -0
  151. package/dist/services/keyboardControls.js.map +1 -0
  152. package/dist/services/loadMap.js +123 -0
  153. package/dist/services/loadMap.js.map +1 -0
  154. package/dist/services/mmorpg.d.ts +21 -9
  155. package/dist/services/mmorpg.js +131 -0
  156. package/dist/services/mmorpg.js.map +1 -0
  157. package/dist/services/save.d.ts +19 -0
  158. package/dist/services/save.js +77 -0
  159. package/dist/services/save.js.map +1 -0
  160. package/dist/services/standalone.d.ts +67 -7
  161. package/dist/services/standalone.js +168 -0
  162. package/dist/services/standalone.js.map +1 -0
  163. package/dist/utils/getEntityProp.d.ts +39 -0
  164. package/dist/utils/getEntityProp.js +52 -0
  165. package/dist/utils/getEntityProp.js.map +1 -0
  166. package/package.json +13 -9
  167. package/src/Game/{EffectManager.ts → AnimationManager.ts} +3 -2
  168. package/src/Game/Event.ts +1 -1
  169. package/src/Game/Map.ts +95 -3
  170. package/src/Game/Object.ts +330 -14
  171. package/src/Game/Player.ts +1 -1
  172. package/src/Gui/Gui.ts +506 -18
  173. package/src/Gui/NotificationManager.ts +69 -0
  174. package/src/Resource.ts +150 -0
  175. package/src/RpgClient.ts +300 -58
  176. package/src/RpgClientEngine.ts +1707 -48
  177. package/src/Sound.ts +253 -0
  178. package/src/components/{effects → animations}/animation.ce +3 -6
  179. package/src/components/{effects → animations}/index.ts +1 -1
  180. package/src/components/character.ce +406 -40
  181. package/src/components/dynamics/parse-value.ts +80 -0
  182. package/src/components/dynamics/text.ce +183 -0
  183. package/src/components/gui/box.ce +17 -0
  184. package/src/components/gui/dialogbox/index.ce +204 -187
  185. package/src/components/gui/gameover.ce +158 -0
  186. package/src/components/gui/hud/hud.ce +61 -0
  187. package/src/components/gui/index.ts +30 -4
  188. package/src/components/gui/menu/equip-menu.ce +410 -0
  189. package/src/components/gui/menu/exit-menu.ce +41 -0
  190. package/src/components/gui/menu/items-menu.ce +317 -0
  191. package/src/components/gui/menu/main-menu.ce +294 -0
  192. package/src/components/gui/menu/options-menu.ce +35 -0
  193. package/src/components/gui/menu/skills-menu.ce +83 -0
  194. package/src/components/gui/mobile/index.ts +24 -0
  195. package/src/components/gui/mobile/mobile.ce +80 -0
  196. package/src/components/gui/notification/notification.ce +51 -0
  197. package/src/components/gui/save-load.ce +208 -0
  198. package/src/components/gui/shop/shop.ce +493 -0
  199. package/src/components/gui/title-screen.ce +163 -0
  200. package/src/components/index.ts +3 -0
  201. package/src/components/prebuilt/hp-bar.ce +255 -0
  202. package/src/components/prebuilt/index.ts +24 -0
  203. package/src/components/prebuilt/light-halo.ce +148 -0
  204. package/src/components/scenes/canvas.ce +20 -15
  205. package/src/components/scenes/draw-map.ce +60 -13
  206. package/src/components/scenes/event-layer.ce +9 -2
  207. package/src/components/scenes/transition.ce +60 -0
  208. package/src/index.ts +16 -2
  209. package/src/module.ts +145 -9
  210. package/src/presets/animation.ts +46 -0
  211. package/src/presets/faceset.ts +60 -0
  212. package/src/presets/icon.ts +17 -0
  213. package/src/presets/index.ts +9 -1
  214. package/src/presets/lpc.ts +108 -0
  215. package/src/services/AbstractSocket.ts +10 -2
  216. package/src/services/keyboardControls.ts +20 -0
  217. package/src/services/loadMap.ts +1 -1
  218. package/src/services/mmorpg.ts +100 -12
  219. package/src/services/save.ts +103 -0
  220. package/src/services/standalone.ts +110 -18
  221. package/src/utils/getEntityProp.ts +87 -0
  222. package/tsconfig.json +1 -1
  223. package/vite.config.ts +4 -2
  224. package/dist/Game/EffectManager.d.ts +0 -5
  225. package/dist/components/effects/index.d.ts +0 -4
  226. package/dist/index.js.map +0 -1
  227. package/dist/index10.js +0 -8
  228. package/dist/index10.js.map +0 -1
  229. package/dist/index11.js +0 -10
  230. package/dist/index11.js.map +0 -1
  231. package/dist/index12.js +0 -8
  232. package/dist/index12.js.map +0 -1
  233. package/dist/index13.js +0 -17
  234. package/dist/index13.js.map +0 -1
  235. package/dist/index14.js +0 -91
  236. package/dist/index14.js.map +0 -1
  237. package/dist/index15.js +0 -50
  238. package/dist/index15.js.map +0 -1
  239. package/dist/index16.js +0 -191
  240. package/dist/index16.js.map +0 -1
  241. package/dist/index17.js +0 -9
  242. package/dist/index17.js.map +0 -1
  243. package/dist/index18.js +0 -387
  244. package/dist/index18.js.map +0 -1
  245. package/dist/index19.js +0 -31
  246. package/dist/index19.js.map +0 -1
  247. package/dist/index2.js +0 -112
  248. package/dist/index2.js.map +0 -1
  249. package/dist/index20.js +0 -24
  250. package/dist/index20.js.map +0 -1
  251. package/dist/index21.js +0 -2421
  252. package/dist/index21.js.map +0 -1
  253. package/dist/index22.js +0 -114
  254. package/dist/index22.js.map +0 -1
  255. package/dist/index23.js +0 -109
  256. package/dist/index23.js.map +0 -1
  257. package/dist/index24.js +0 -71
  258. package/dist/index24.js.map +0 -1
  259. package/dist/index25.js +0 -21
  260. package/dist/index25.js.map +0 -1
  261. package/dist/index26.js +0 -41
  262. package/dist/index26.js.map +0 -1
  263. package/dist/index27.js +0 -5
  264. package/dist/index27.js.map +0 -1
  265. package/dist/index28.js +0 -322
  266. package/dist/index28.js.map +0 -1
  267. package/dist/index29.js +0 -27
  268. package/dist/index29.js.map +0 -1
  269. package/dist/index3.js +0 -87
  270. package/dist/index3.js.map +0 -1
  271. package/dist/index30.js +0 -11
  272. package/dist/index30.js.map +0 -1
  273. package/dist/index31.js +0 -11
  274. package/dist/index31.js.map +0 -1
  275. package/dist/index32.js +0 -12
  276. package/dist/index32.js.map +0 -1
  277. package/dist/index33.js +0 -4403
  278. package/dist/index33.js.map +0 -1
  279. package/dist/index34.js +0 -316
  280. package/dist/index34.js.map +0 -1
  281. package/dist/index35.js +0 -174
  282. package/dist/index35.js.map +0 -1
  283. package/dist/index36.js +0 -501
  284. package/dist/index36.js.map +0 -1
  285. package/dist/index37.js +0 -61
  286. package/dist/index37.js.map +0 -1
  287. package/dist/index38.js +0 -20
  288. package/dist/index38.js.map +0 -1
  289. package/dist/index39.js +0 -20
  290. package/dist/index39.js.map +0 -1
  291. package/dist/index4.js +0 -67
  292. package/dist/index4.js.map +0 -1
  293. package/dist/index5.js +0 -16
  294. package/dist/index5.js.map +0 -1
  295. package/dist/index6.js +0 -17
  296. package/dist/index6.js.map +0 -1
  297. package/dist/index7.js +0 -39
  298. package/dist/index7.js.map +0 -1
  299. package/dist/index8.js +0 -90
  300. package/dist/index8.js.map +0 -1
  301. package/dist/index9.js +0 -76
  302. package/dist/index9.js.map +0 -1
  303. package/src/components/gui/dialogbox/itemMenu.ce +0 -23
  304. package/src/components/gui/dialogbox/selection.ce +0 -67
  305. /package/src/components/{effects → animations}/hit.ce +0 -0
@@ -0,0 +1,39 @@
1
+ //#region src/presets/animation.ts
2
+ /**
3
+ * Creates an animation spritesheet preset with automatic frame generation
4
+ *
5
+ * This function generates animation frames based on the provided width and height dimensions.
6
+ * It creates a sequence of frames that progresses through the spritesheet from left to right,
7
+ * top to bottom, with each frame having a 10ms time increment.
8
+ *
9
+ * @param {number} framesWidth - The number of frames horizontally in the spritesheet
10
+ * @param {number} framesHeight - The number of frames vertically in the spritesheet
11
+ * @returns {Object} Animation preset configuration object
12
+ *
13
+ * @example
14
+ * ```javascript
15
+ * // For a 4x4 spritesheet
16
+ * const preset = AnimationSpritesheetPreset(4, 4);
17
+ * // This will generate 16 frames with coordinates from (0,0) to (3,3)
18
+ * ```
19
+ */
20
+ var AnimationSpritesheetPreset = (framesWidth, framesHeight) => {
21
+ const animations = [];
22
+ for (let y = 0; y < framesHeight; y++) for (let x = 0; x < framesWidth; x++) {
23
+ const frameIndex = y * framesWidth + x;
24
+ animations.push({
25
+ time: frameIndex * 10,
26
+ frameX: x,
27
+ frameY: y
28
+ });
29
+ }
30
+ return {
31
+ framesWidth,
32
+ framesHeight,
33
+ textures: { default: { animations: () => [animations] } }
34
+ };
35
+ };
36
+ //#endregion
37
+ export { AnimationSpritesheetPreset };
38
+
39
+ //# sourceMappingURL=animation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"animation.js","names":[],"sources":["../../src/presets/animation.ts"],"sourcesContent":["/**\n * Creates an animation spritesheet preset with automatic frame generation\n * \n * This function generates animation frames based on the provided width and height dimensions.\n * It creates a sequence of frames that progresses through the spritesheet from left to right,\n * top to bottom, with each frame having a 10ms time increment.\n * \n * @param {number} framesWidth - The number of frames horizontally in the spritesheet\n * @param {number} framesHeight - The number of frames vertically in the spritesheet\n * @returns {Object} Animation preset configuration object\n * \n * @example\n * ```javascript\n * // For a 4x4 spritesheet\n * const preset = AnimationSpritesheetPreset(4, 4);\n * // This will generate 16 frames with coordinates from (0,0) to (3,3)\n * ```\n */\nexport const AnimationSpritesheetPreset = (framesWidth: number, framesHeight: number) => {\n \n const animations: Array<{ time: number; frameX: number; frameY: number }> = [];\n\n for (let y = 0; y < framesHeight; y++) {\n for (let x = 0; x < framesWidth; x++) {\n const frameIndex = y * framesWidth + x;\n animations.push({ \n time: frameIndex * 10, \n frameX: x, \n frameY: y \n });\n }\n }\n \n return {\n framesWidth,\n framesHeight,\n textures: {\n default: {\n animations: () => [\n animations\n ],\n }\n }\n };\n};\n "],"mappings":";;;;;;;;;;;;;;;;;;;AAkBA,IAAa,8BAA8B,aAAqB,iBAAyB;CAErF,MAAM,aAAsE,EAAE;AAE9E,MAAK,IAAI,IAAI,GAAG,IAAI,cAAc,IAC9B,MAAK,IAAI,IAAI,GAAG,IAAI,aAAa,KAAK;EAClC,MAAM,aAAa,IAAI,cAAc;AACrC,aAAW,KAAK;GACZ,MAAM,aAAa;GACnB,QAAQ;GACR,QAAQ;GACX,CAAC;;AAIV,QAAO;EACH;EACA;EACA,UAAU,EACN,SAAS,EACL,kBAAkB,CACd,WACH,EACJ,EACJ;EACJ"}
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Creates a faceset preset for character expressions
3
+ *
4
+ * This preset allows you to define multiple facial expressions for a character,
5
+ * where each expression corresponds to a specific frame position (frameX, frameY)
6
+ * within a single faceset texture. Each expression is defined by its position
7
+ * in the faceset grid.
8
+ *
9
+ * @param options - Object containing the faceset configuration
10
+ * @param framesWidth - Number of frames horizontally in the faceset texture
11
+ * @param framesHeight - Number of frames vertically in the faceset texture
12
+ * @param expressions - Object mapping expression names to their frame positions as tuples [frameX, frameY]
13
+ * @returns Faceset configuration with animations for each expression
14
+ *
15
+ * @example
16
+ * ```typescript
17
+ * const faceset = FacesetPreset({
18
+ * id: "facesetId",
19
+ * image: "faceset.png",
20
+ * width: 1024,
21
+ * height: 1024,
22
+ * }, 4, 2, {
23
+ * happy: [0, 0],
24
+ * sad: [1, 0],
25
+ * angry: [2, 0],
26
+ * surprised: [3, 0]
27
+ * });
28
+ * ```
29
+ */
30
+ export declare const FacesetPreset: (options: any, framesWidth: number, framesHeight: number, expressions: Record<string, [number, number]>) => any;
@@ -0,0 +1,51 @@
1
+ //#region src/presets/faceset.ts
2
+ /**
3
+ * Creates a faceset preset for character expressions
4
+ *
5
+ * This preset allows you to define multiple facial expressions for a character,
6
+ * where each expression corresponds to a specific frame position (frameX, frameY)
7
+ * within a single faceset texture. Each expression is defined by its position
8
+ * in the faceset grid.
9
+ *
10
+ * @param options - Object containing the faceset configuration
11
+ * @param framesWidth - Number of frames horizontally in the faceset texture
12
+ * @param framesHeight - Number of frames vertically in the faceset texture
13
+ * @param expressions - Object mapping expression names to their frame positions as tuples [frameX, frameY]
14
+ * @returns Faceset configuration with animations for each expression
15
+ *
16
+ * @example
17
+ * ```typescript
18
+ * const faceset = FacesetPreset({
19
+ * id: "facesetId",
20
+ * image: "faceset.png",
21
+ * width: 1024,
22
+ * height: 1024,
23
+ * }, 4, 2, {
24
+ * happy: [0, 0],
25
+ * sad: [1, 0],
26
+ * angry: [2, 0],
27
+ * surprised: [3, 0]
28
+ * });
29
+ * ```
30
+ */
31
+ var FacesetPreset = (options, framesWidth, framesHeight, expressions) => {
32
+ const textures = {};
33
+ Object.keys(expressions).forEach((expressionName) => {
34
+ const [frameX, frameY] = expressions[expressionName];
35
+ textures[expressionName] = { animations: () => [[{
36
+ time: 0,
37
+ frameX,
38
+ frameY
39
+ }]] };
40
+ });
41
+ return {
42
+ ...options,
43
+ framesWidth,
44
+ framesHeight,
45
+ textures
46
+ };
47
+ };
48
+ //#endregion
49
+ export { FacesetPreset };
50
+
51
+ //# sourceMappingURL=faceset.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"faceset.js","names":[],"sources":["../../src/presets/faceset.ts"],"sourcesContent":["/**\n * Creates a faceset preset for character expressions\n * \n * This preset allows you to define multiple facial expressions for a character,\n * where each expression corresponds to a specific frame position (frameX, frameY)\n * within a single faceset texture. Each expression is defined by its position\n * in the faceset grid.\n * \n * @param options - Object containing the faceset configuration\n * @param framesWidth - Number of frames horizontally in the faceset texture\n * @param framesHeight - Number of frames vertically in the faceset texture\n * @param expressions - Object mapping expression names to their frame positions as tuples [frameX, frameY]\n * @returns Faceset configuration with animations for each expression\n * \n * @example\n * ```typescript\n * const faceset = FacesetPreset({\n * id: \"facesetId\",\n * image: \"faceset.png\",\n * width: 1024,\n * height: 1024,\n * }, 4, 2, {\n * happy: [0, 0],\n * sad: [1, 0],\n * angry: [2, 0],\n * surprised: [3, 0]\n * });\n * ```\n */\nexport const FacesetPreset = (\n options: any,\n framesWidth: number, \n framesHeight: number,\n expressions: Record<string, [number, number]>,\n) => {\n \n const textures: Record<string, any> = {};\n \n // Create texture configuration for each expression\n Object.keys(expressions).forEach((expressionName) => {\n const [frameX, frameY] = expressions[expressionName];\n textures[expressionName] = {\n animations: () => [\n [{ \n time: 0, \n frameX: frameX, \n frameY: frameY \n }]\n ],\n };\n });\n \n return {\n ...options,\n framesWidth,\n framesHeight,\n textures\n };\n};\n "],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6BA,IAAa,iBACT,SACA,aACA,cACA,gBACC;CAED,MAAM,WAAgC,EAAE;AAGxC,QAAO,KAAK,YAAY,CAAC,SAAS,mBAAmB;EACjD,MAAM,CAAC,QAAQ,UAAU,YAAY;AACrC,WAAS,kBAAkB,EACvB,kBAAkB,CACd,CAAC;GACG,MAAM;GACE;GACA;GACX,CAAC,CACL,EACJ;GACH;AAEF,QAAO;EACH,GAAG;EACH;EACA;EACA;EACH"}
@@ -0,0 +1,20 @@
1
+ export declare const IconPreset: (options: {
2
+ image: string;
3
+ framesWidth: number;
4
+ framesHeight: number;
5
+ id: string;
6
+ }) => {
7
+ image: string;
8
+ framesWidth: number;
9
+ framesHeight: number;
10
+ id: string;
11
+ textures: {
12
+ default: {
13
+ animations: () => {
14
+ time: number;
15
+ frameX: number;
16
+ frameY: number;
17
+ }[][];
18
+ };
19
+ };
20
+ };
@@ -0,0 +1,15 @@
1
+ //#region src/presets/icon.ts
2
+ var IconPreset = (options) => {
3
+ return {
4
+ textures: { default: { animations: () => [[{
5
+ time: 0,
6
+ frameX: 0,
7
+ frameY: 0
8
+ }]] } },
9
+ ...options
10
+ };
11
+ };
12
+ //#endregion
13
+ export { IconPreset };
14
+
15
+ //# sourceMappingURL=icon.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"icon.js","names":[],"sources":["../../src/presets/icon.ts"],"sourcesContent":["export const IconPreset = (options: {\n image: string;\n framesWidth: number;\n framesHeight: number;\n id: string;\n}) => {\n return {\n textures: {\n default: {\n animations: () => [\n [{ time: 0, frameX: 0, frameY: 0 }]\n ]\n }\n },\n ...options\n }\n}"],"mappings":";AAAA,IAAa,cAAc,YAKrB;AACF,QAAO;EACH,UAAU,EACN,SAAS,EACL,kBAAkB,CACd,CAAC;GAAE,MAAM;GAAG,QAAQ;GAAG,QAAQ;GAAG,CAAC,CACtC,EACJ,EACJ;EACD,GAAG;EACN"}
@@ -19,4 +19,127 @@ export declare const Presets: {
19
19
  framesHeight: number;
20
20
  framesWidth: number;
21
21
  };
22
+ LPCSpritesheetPreset: (options: {
23
+ id: string;
24
+ imageSource: string;
25
+ width: number;
26
+ height: number;
27
+ ratio?: number;
28
+ }) => {
29
+ id: string;
30
+ image: string;
31
+ width: number;
32
+ height: number;
33
+ opacity: number;
34
+ rectWidth: number;
35
+ rectHeight: number;
36
+ framesWidth: number;
37
+ framesHeight: number;
38
+ spriteRealSize: {
39
+ width: number;
40
+ height: number;
41
+ };
42
+ textures: {
43
+ attack3?: {
44
+ offset: {
45
+ x: number;
46
+ y: number;
47
+ };
48
+ rectWidth: number;
49
+ rectHeight: number;
50
+ framesWidth: number;
51
+ framesHeight: number;
52
+ animations: ({ direction }: {
53
+ direction: any;
54
+ }) => any[];
55
+ } | undefined;
56
+ stand: {
57
+ offset: {
58
+ x: number;
59
+ y: number;
60
+ };
61
+ animations: ({ direction }: {
62
+ direction: any;
63
+ }) => {
64
+ time: number;
65
+ frameX: number;
66
+ frameY: number;
67
+ }[][];
68
+ };
69
+ walk: {
70
+ offset: {
71
+ x: number;
72
+ y: number;
73
+ };
74
+ framesWidth: number;
75
+ framesHeight: number;
76
+ animations: ({ direction }: {
77
+ direction: any;
78
+ }) => any[];
79
+ };
80
+ attack: {
81
+ offset: {
82
+ x: number;
83
+ y: number;
84
+ };
85
+ framesWidth: number;
86
+ framesHeight: number;
87
+ animations: ({ direction }: {
88
+ direction: any;
89
+ }) => any[];
90
+ };
91
+ skill: {
92
+ framesWidth: number;
93
+ framesHeight: number;
94
+ animations: ({ direction }: {
95
+ direction: any;
96
+ }) => any[];
97
+ };
98
+ attack2: {
99
+ offset: {
100
+ x: number;
101
+ y: number;
102
+ };
103
+ framesWidth: number;
104
+ framesHeight: number;
105
+ animations: ({ direction }: {
106
+ direction: any;
107
+ }) => any[];
108
+ };
109
+ };
110
+ };
111
+ AnimationSpritesheetPreset: (framesWidth: number, framesHeight: number) => {
112
+ framesWidth: number;
113
+ framesHeight: number;
114
+ textures: {
115
+ default: {
116
+ animations: () => {
117
+ time: number;
118
+ frameX: number;
119
+ frameY: number;
120
+ }[][];
121
+ };
122
+ };
123
+ };
124
+ FacesetPreset: (options: any, framesWidth: number, framesHeight: number, expressions: Record<string, [number, number]>) => any;
125
+ IconPreset: (options: {
126
+ image: string;
127
+ framesWidth: number;
128
+ framesHeight: number;
129
+ id: string;
130
+ }) => {
131
+ image: string;
132
+ framesWidth: number;
133
+ framesHeight: number;
134
+ id: string;
135
+ textures: {
136
+ default: {
137
+ animations: () => {
138
+ time: number;
139
+ frameX: number;
140
+ frameY: number;
141
+ }[][];
142
+ };
143
+ };
144
+ };
22
145
  };
@@ -0,0 +1,17 @@
1
+ import { AnimationSpritesheetPreset } from "./animation.js";
2
+ import { LPCSpritesheetPreset } from "./lpc.js";
3
+ import { RMSpritesheet } from "./rmspritesheet.js";
4
+ import { FacesetPreset } from "./faceset.js";
5
+ import { IconPreset } from "./icon.js";
6
+ //#region src/presets/index.ts
7
+ var Presets = {
8
+ RMSpritesheet,
9
+ LPCSpritesheetPreset,
10
+ AnimationSpritesheetPreset,
11
+ FacesetPreset,
12
+ IconPreset
13
+ };
14
+ //#endregion
15
+ export { Presets };
16
+
17
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../src/presets/index.ts"],"sourcesContent":["import { AnimationSpritesheetPreset } from \"./animation\";\nimport { LPCSpritesheetPreset } from \"./lpc\";\nimport { RMSpritesheet } from \"./rmspritesheet\";\nimport { FacesetPreset } from \"./faceset\";\nimport { IconPreset } from \"./icon\";\n\nexport const Presets = {\n RMSpritesheet,\n LPCSpritesheetPreset,\n AnimationSpritesheetPreset,\n FacesetPreset,\n IconPreset\n}"],"mappings":";;;;;;AAMA,IAAa,UAAU;CACnB;CACA;CACA;CACA;CACA"}
@@ -0,0 +1,89 @@
1
+ export declare const LPCSpritesheetPreset: (options: {
2
+ id: string;
3
+ imageSource: string;
4
+ width: number;
5
+ height: number;
6
+ ratio?: number;
7
+ }) => {
8
+ id: string;
9
+ image: string;
10
+ width: number;
11
+ height: number;
12
+ opacity: number;
13
+ rectWidth: number;
14
+ rectHeight: number;
15
+ framesWidth: number;
16
+ framesHeight: number;
17
+ spriteRealSize: {
18
+ width: number;
19
+ height: number;
20
+ };
21
+ textures: {
22
+ attack3?: {
23
+ offset: {
24
+ x: number;
25
+ y: number;
26
+ };
27
+ rectWidth: number;
28
+ rectHeight: number;
29
+ framesWidth: number;
30
+ framesHeight: number;
31
+ animations: ({ direction }: {
32
+ direction: any;
33
+ }) => any[];
34
+ } | undefined;
35
+ stand: {
36
+ offset: {
37
+ x: number;
38
+ y: number;
39
+ };
40
+ animations: ({ direction }: {
41
+ direction: any;
42
+ }) => {
43
+ time: number;
44
+ frameX: number;
45
+ frameY: number;
46
+ }[][];
47
+ };
48
+ walk: {
49
+ offset: {
50
+ x: number;
51
+ y: number;
52
+ };
53
+ framesWidth: number;
54
+ framesHeight: number;
55
+ animations: ({ direction }: {
56
+ direction: any;
57
+ }) => any[];
58
+ };
59
+ attack: {
60
+ offset: {
61
+ x: number;
62
+ y: number;
63
+ };
64
+ framesWidth: number;
65
+ framesHeight: number;
66
+ animations: ({ direction }: {
67
+ direction: any;
68
+ }) => any[];
69
+ };
70
+ skill: {
71
+ framesWidth: number;
72
+ framesHeight: number;
73
+ animations: ({ direction }: {
74
+ direction: any;
75
+ }) => any[];
76
+ };
77
+ attack2: {
78
+ offset: {
79
+ x: number;
80
+ y: number;
81
+ };
82
+ framesWidth: number;
83
+ framesHeight: number;
84
+ animations: ({ direction }: {
85
+ direction: any;
86
+ }) => any[];
87
+ };
88
+ };
89
+ };
@@ -0,0 +1,98 @@
1
+ import { Animation, Direction } from "@rpgjs/common";
2
+ //#region src/presets/lpc.ts
3
+ var LPCSpritesheetPreset = (options) => {
4
+ const ratio = options.ratio ?? 1;
5
+ const frameY = (direction) => {
6
+ return {
7
+ [Direction.Down]: 2,
8
+ [Direction.Left]: 1,
9
+ [Direction.Right]: 3,
10
+ [Direction.Up]: 0
11
+ }[direction];
12
+ };
13
+ const stand = (direction) => [{
14
+ time: 0,
15
+ frameX: 0,
16
+ frameY: frameY(direction)
17
+ }];
18
+ const anim = (direction, framesWidth, speed = 5) => {
19
+ const array = [];
20
+ for (let i = 0; i < framesWidth; i++) array.push({
21
+ time: i * speed,
22
+ frameX: i,
23
+ frameY: frameY(direction)
24
+ });
25
+ return array;
26
+ };
27
+ return {
28
+ id: options.id,
29
+ image: options.imageSource,
30
+ width: options.width,
31
+ height: options.height,
32
+ opacity: 1,
33
+ rectWidth: 64 * ratio,
34
+ rectHeight: 64 * ratio,
35
+ framesWidth: 6,
36
+ framesHeight: 4,
37
+ spriteRealSize: {
38
+ width: 48 * ratio,
39
+ height: 52 * ratio
40
+ },
41
+ textures: {
42
+ [Animation.Stand]: {
43
+ offset: {
44
+ x: 0,
45
+ y: 512 * ratio
46
+ },
47
+ animations: ({ direction }) => [stand(direction)]
48
+ },
49
+ [Animation.Walk]: {
50
+ offset: {
51
+ x: 0,
52
+ y: 512 * ratio
53
+ },
54
+ framesWidth: 9,
55
+ framesHeight: 4,
56
+ animations: ({ direction }) => [anim(direction, 9)]
57
+ },
58
+ [Animation.Attack]: {
59
+ offset: {
60
+ x: 0,
61
+ y: 768 * ratio
62
+ },
63
+ framesWidth: 6,
64
+ framesHeight: 4,
65
+ animations: ({ direction }) => [anim(direction, 6, 3)]
66
+ },
67
+ [Animation.Skill]: {
68
+ framesWidth: 7,
69
+ framesHeight: 4,
70
+ animations: ({ direction }) => [anim(direction, 7, 3)]
71
+ },
72
+ attack2: {
73
+ offset: {
74
+ x: 0,
75
+ y: 256 * ratio
76
+ },
77
+ framesWidth: 7,
78
+ framesHeight: 8,
79
+ animations: ({ direction }) => [anim(direction, 7, 3)]
80
+ },
81
+ ...options.height > 3e3 ? { attack3: {
82
+ offset: {
83
+ x: 0,
84
+ y: 5568 - 288 * 4
85
+ },
86
+ rectWidth: 288,
87
+ rectHeight: 288,
88
+ framesWidth: 6,
89
+ framesHeight: 4,
90
+ animations: ({ direction }) => [anim(direction, 6, 3)]
91
+ } } : {}
92
+ }
93
+ };
94
+ };
95
+ //#endregion
96
+ export { LPCSpritesheetPreset };
97
+
98
+ //# sourceMappingURL=lpc.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lpc.js","names":[],"sources":["../../src/presets/lpc.ts"],"sourcesContent":["import { Animation, Direction } from \"@rpgjs/common\";\n\nexport const LPCSpritesheetPreset = (options: {\n id: string;\n imageSource: string;\n width: number;\n height: number;\n ratio?: number;\n }) => {\n const ratio = options.ratio ?? 1;\n\n const frameY = (direction: Direction) => {\n return {\n [Direction.Down]: 2,\n [Direction.Left]: 1,\n [Direction.Right]: 3,\n [Direction.Up]: 0,\n }[direction];\n };\n \n const stand = (direction: Direction) => [\n { time: 0, frameX: 0, frameY: frameY(direction) },\n ];\n const anim = (\n direction: Direction,\n framesWidth: number,\n speed: number = 5\n ) => {\n const array: any = [];\n for (let i = 0; i < framesWidth; i++) {\n array.push({ time: i * speed, frameX: i, frameY: frameY(direction) });\n }\n return array;\n };\n \n return {\n id: options.id,\n image: options.imageSource,\n width: options.width,\n height: options.height,\n opacity: 1,\n rectWidth: 64 * ratio,\n rectHeight: 64 * ratio,\n framesWidth: 6,\n framesHeight: 4,\n spriteRealSize: {\n width: 48 * ratio,\n height: 52 * ratio,\n },\n textures: {\n [Animation.Stand]: {\n offset: {\n x: 0,\n y: 512 * ratio,\n },\n animations: ({ direction }) => [stand(direction)],\n },\n [Animation.Walk]: {\n offset: {\n x: 0,\n y: 512 * ratio,\n },\n framesWidth: 9,\n framesHeight: 4,\n animations: ({ direction }) => [anim(direction, 9)],\n },\n [Animation.Attack]: {\n offset: {\n x: 0,\n y: 768 * ratio,\n },\n framesWidth: 6,\n framesHeight: 4,\n animations: ({ direction }) => [anim(direction, 6, 3)],\n },\n [Animation.Skill]: {\n framesWidth: 7,\n framesHeight: 4,\n animations: ({ direction }) => [anim(direction, 7, 3)],\n },\n attack2: {\n offset: {\n x: 0,\n y: 256 * ratio,\n },\n framesWidth: 7,\n framesHeight: 8,\n animations: ({ direction }) => [anim(direction, 7, 3)],\n },\n ...(options.height > 3000\n ? {\n attack3: {\n offset: {\n x: 0,\n y: 5568 - 288 * 4,\n },\n rectWidth: 288,\n rectHeight: 288,\n framesWidth: 6,\n framesHeight: 4,\n animations: ({ direction }) => [anim(direction, 6, 3)],\n },\n }\n : {}),\n },\n };\n };\n "],"mappings":";;AAEA,IAAa,wBAAwB,YAM7B;CACJ,MAAM,QAAQ,QAAQ,SAAS;CAE/B,MAAM,UAAU,cAAyB;AACvC,SAAO;IACJ,UAAU,OAAO;IACjB,UAAU,OAAO;IACjB,UAAU,QAAQ;IAClB,UAAU,KAAK;GACjB,CAAC;;CAGJ,MAAM,SAAS,cAAyB,CACtC;EAAE,MAAM;EAAG,QAAQ;EAAG,QAAQ,OAAO,UAAU;EAAE,CAClD;CACD,MAAM,QACJ,WACA,aACA,QAAgB,MACb;EACH,MAAM,QAAa,EAAE;AACrB,OAAK,IAAI,IAAI,GAAG,IAAI,aAAa,IAC/B,OAAM,KAAK;GAAE,MAAM,IAAI;GAAO,QAAQ;GAAG,QAAQ,OAAO,UAAU;GAAE,CAAC;AAEvE,SAAO;;AAGT,QAAO;EACL,IAAI,QAAQ;EACZ,OAAO,QAAQ;EACf,OAAO,QAAQ;EACf,QAAQ,QAAQ;EAChB,SAAS;EACT,WAAW,KAAK;EAChB,YAAY,KAAK;EACjB,aAAa;EACb,cAAc;EACd,gBAAgB;GACd,OAAO,KAAK;GACZ,QAAQ,KAAK;GACd;EACD,UAAU;IACP,UAAU,QAAQ;IACjB,QAAQ;KACN,GAAG;KACH,GAAG,MAAM;KACV;IACD,aAAa,EAAE,gBAAgB,CAAC,MAAM,UAAU,CAAC;IAClD;IACA,UAAU,OAAO;IAChB,QAAQ;KACN,GAAG;KACH,GAAG,MAAM;KACV;IACD,aAAa;IACb,cAAc;IACd,aAAa,EAAE,gBAAgB,CAAC,KAAK,WAAW,EAAE,CAAC;IACpD;IACA,UAAU,SAAS;IAClB,QAAQ;KACN,GAAG;KACH,GAAG,MAAM;KACV;IACD,aAAa;IACb,cAAc;IACd,aAAa,EAAE,gBAAgB,CAAC,KAAK,WAAW,GAAG,EAAE,CAAC;IACvD;IACA,UAAU,QAAQ;IACjB,aAAa;IACb,cAAc;IACd,aAAa,EAAE,gBAAgB,CAAC,KAAK,WAAW,GAAG,EAAE,CAAC;IACvD;GACD,SAAS;IACP,QAAQ;KACN,GAAG;KACH,GAAG,MAAM;KACV;IACD,aAAa;IACb,cAAc;IACd,aAAa,EAAE,gBAAgB,CAAC,KAAK,WAAW,GAAG,EAAE,CAAC;IACvD;GACD,GAAI,QAAQ,SAAS,MACjB,EACE,SAAS;IACP,QAAQ;KACN,GAAG;KACH,GAAG,OAAO,MAAM;KACjB;IACD,WAAW;IACX,YAAY;IACZ,aAAa;IACb,cAAc;IACd,aAAa,EAAE,gBAAgB,CAAC,KAAK,WAAW,GAAG,EAAE,CAAC;IACvD,EACF,GACD,EAAE;GACP;EACF"}
@@ -0,0 +1,42 @@
1
+ import { Animation, Direction } from "@rpgjs/common";
2
+ //#region src/presets/rmspritesheet.ts
3
+ var RMSpritesheet = (framesWidth, framesHeight, frameStand = 1) => {
4
+ if (framesWidth <= frameStand) frameStand = framesWidth - 1;
5
+ const frameY = (direction) => {
6
+ const gap = Math.max(4 - framesHeight, 0);
7
+ return {
8
+ [Direction.Down]: 0,
9
+ [Direction.Left]: Math.max(0, 1 - gap),
10
+ [Direction.Right]: Math.max(0, 2 - gap),
11
+ [Direction.Up]: Math.max(0, 3 - gap)
12
+ }[direction];
13
+ };
14
+ const stand = (direction) => [{
15
+ time: 0,
16
+ frameX: frameStand,
17
+ frameY: frameY(direction)
18
+ }];
19
+ const walk = (direction) => {
20
+ const array = [];
21
+ const durationFrame = 10;
22
+ for (let i = 0; i < framesWidth; i++) array.push({
23
+ time: i * durationFrame,
24
+ frameX: i,
25
+ frameY: frameY(direction)
26
+ });
27
+ array.push({ time: array[array.length - 1].time + durationFrame });
28
+ return array;
29
+ };
30
+ return {
31
+ textures: {
32
+ [Animation.Stand]: { animations: ({ direction }) => [stand(direction)] },
33
+ [Animation.Walk]: { animations: ({ direction }) => [walk(direction)] }
34
+ },
35
+ framesHeight,
36
+ framesWidth
37
+ };
38
+ };
39
+ //#endregion
40
+ export { RMSpritesheet };
41
+
42
+ //# sourceMappingURL=rmspritesheet.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rmspritesheet.js","names":[],"sources":["../../src/presets/rmspritesheet.ts"],"sourcesContent":["import { Direction, Animation } from '@rpgjs/common'\n\nexport const RMSpritesheet = (framesWidth: number, framesHeight: number, frameStand: number = 1) => {\n\n if (framesWidth <= frameStand) {\n frameStand = framesWidth - 1\n }\n\n const frameY = direction => {\n const gap = Math.max(4 - framesHeight, 0)\n return {\n [Direction.Down]: 0,\n [Direction.Left]: Math.max(0, 1 - gap),\n [Direction.Right]: Math.max(0, 2 - gap),\n [Direction.Up]: Math.max(0, 3 - gap)\n }[direction]\n }\n\n const stand = (direction: number) => [{ time: 0, frameX: frameStand, frameY: frameY(direction) }]\n const walk = direction => {\n const array: any = []\n const durationFrame = 10\n for (let i = 0; i < framesWidth; i++) {\n array.push({ time: i * durationFrame, frameX: i, frameY: frameY(direction) })\n }\n array.push({ time: array[array.length - 1].time + durationFrame })\n return array\n }\n\n return {\n textures: {\n [Animation.Stand]: {\n animations: ({direction}) => [stand(direction)]\n },\n [Animation.Walk]: {\n animations: ({direction}) => [walk(direction)]\n }\n },\n framesHeight,\n framesWidth\n }\n}"],"mappings":";;AAEA,IAAa,iBAAiB,aAAqB,cAAsB,aAAqB,MAAM;AAEhG,KAAI,eAAe,WACf,cAAa,cAAc;CAG/B,MAAM,UAAS,cAAa;EACxB,MAAM,MAAM,KAAK,IAAI,IAAI,cAAc,EAAE;AACzC,SAAO;IACF,UAAU,OAAO;IACjB,UAAU,OAAO,KAAK,IAAI,GAAG,IAAI,IAAI;IACrC,UAAU,QAAQ,KAAK,IAAI,GAAG,IAAI,IAAI;IACtC,UAAU,KAAK,KAAK,IAAI,GAAG,IAAI,IAAI;GACvC,CAAC;;CAGN,MAAM,SAAS,cAAsB,CAAC;EAAE,MAAM;EAAG,QAAQ;EAAY,QAAQ,OAAO,UAAU;EAAE,CAAC;CACjG,MAAM,QAAO,cAAa;EACtB,MAAM,QAAa,EAAE;EACrB,MAAM,gBAAgB;AACtB,OAAK,IAAI,IAAI,GAAG,IAAI,aAAa,IAC7B,OAAM,KAAK;GAAE,MAAM,IAAI;GAAe,QAAQ;GAAG,QAAQ,OAAO,UAAU;GAAE,CAAC;AAEjF,QAAM,KAAK,EAAE,MAAM,MAAM,MAAM,SAAS,GAAG,OAAO,eAAe,CAAC;AAClE,SAAO;;AAGX,QAAO;EACH,UAAU;IACL,UAAU,QAAQ,EACf,aAAa,EAAC,gBAAe,CAAC,MAAM,UAAU,CAAC,EAClD;IACA,UAAU,OAAO,EACd,aAAa,EAAC,gBAAe,CAAC,KAAK,UAAU,CAAC,EACjD;GACJ;EACD;EACA;EACH"}
@@ -1,5 +1,12 @@
1
1
  import { Context } from '@signe/di';
2
2
  export declare const WebSocketToken = "websocket";
3
+ export type SocketQueryValue = string | null | undefined;
4
+ export type SocketQuery = Record<string, SocketQueryValue>;
5
+ export type SocketUpdateProperties = {
6
+ room: string;
7
+ host?: string;
8
+ query?: SocketQuery;
9
+ };
3
10
  export declare abstract class AbstractWebsocket {
4
11
  protected context: Context;
5
12
  constructor(context: Context);
@@ -7,9 +14,6 @@ export declare abstract class AbstractWebsocket {
7
14
  abstract emit(event: string, data: any): void;
8
15
  abstract on(event: string, callback: (data: any) => void): void;
9
16
  abstract off(event: string, callback: (data: any) => void): void;
10
- abstract updateProperties(params: {
11
- room: string;
12
- host?: string;
13
- }): void;
14
- abstract reconnect(listeners?: (data: any) => void): void;
17
+ abstract updateProperties(params: SocketUpdateProperties): void;
18
+ abstract reconnect(listeners?: (data: any) => void): Promise<void>;
15
19
  }
@@ -0,0 +1,11 @@
1
+ //#region src/services/AbstractSocket.ts
2
+ var WebSocketToken = "websocket";
3
+ var AbstractWebsocket = class {
4
+ constructor(context) {
5
+ this.context = context;
6
+ }
7
+ };
8
+ //#endregion
9
+ export { AbstractWebsocket, WebSocketToken };
10
+
11
+ //# sourceMappingURL=AbstractSocket.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AbstractSocket.js","names":[],"sources":["../../src/services/AbstractSocket.ts"],"sourcesContent":["import { Context } from \"@signe/di\";\n\nexport const WebSocketToken = \"websocket\";\n\nexport type SocketQueryValue = string | null | undefined;\nexport type SocketQuery = Record<string, SocketQueryValue>;\nexport type SocketUpdateProperties = {\n room: string;\n host?: string;\n query?: SocketQuery;\n};\n\nexport abstract class AbstractWebsocket {\n constructor(protected context: Context) {}\n\n abstract connection(listeners?: (data: any) => void): Promise<void>;\n abstract emit(event: string, data: any): void;\n abstract on(event: string, callback: (data: any) => void): void;\n abstract off(event: string, callback: (data: any) => void): void;\n abstract updateProperties(params: SocketUpdateProperties): void;\n abstract reconnect(listeners?: (data: any) => void): Promise<void>;\n}\n"],"mappings":";AAEA,IAAa,iBAAiB;AAU9B,IAAsB,oBAAtB,MAAwC;CACtC,YAAY,SAA4B;AAAlB,OAAA,UAAA"}
@@ -0,0 +1,15 @@
1
+ export declare enum Control {
2
+ Action = "action",
3
+ Attack = "attack",
4
+ Defense = "defense",
5
+ Skill = "skill",
6
+ Back = "back",
7
+ Up = 1,
8
+ Down = 3,
9
+ Right = 2,
10
+ Left = 4
11
+ }
12
+ export declare function provideKeyboardControls(): {
13
+ provide: string;
14
+ useValue: null;
15
+ };
@@ -0,0 +1,23 @@
1
+ //#region src/services/keyboardControls.ts
2
+ var Control = /* @__PURE__ */ function(Control) {
3
+ Control["Action"] = "action";
4
+ Control["Attack"] = "attack";
5
+ Control["Defense"] = "defense";
6
+ Control["Skill"] = "skill";
7
+ Control["Back"] = "back";
8
+ Control[Control["Up"] = 1] = "Up";
9
+ Control[Control["Down"] = 3] = "Down";
10
+ Control[Control["Right"] = 2] = "Right";
11
+ Control[Control["Left"] = 4] = "Left";
12
+ return Control;
13
+ }({});
14
+ function provideKeyboardControls() {
15
+ return {
16
+ provide: "KeyboardControls",
17
+ useValue: null
18
+ };
19
+ }
20
+ //#endregion
21
+ export { Control, provideKeyboardControls };
22
+
23
+ //# sourceMappingURL=keyboardControls.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"keyboardControls.js","names":[],"sources":["../../src/services/keyboardControls.ts"],"sourcesContent":["import { KeyboardControls } from \"canvasengine\";\n\nexport enum Control {\n Action = 'action',\n Attack = 'attack',\n Defense = 'defense',\n Skill = 'skill',\n Back = 'back',\n Up = 1,\n Down = 3,\n Right = 2,\n Left = 4\n}\n\nexport function provideKeyboardControls() {\n return {\n provide: 'KeyboardControls',\n useValue: null,\n };\n}"],"mappings":";AAEA,IAAY,UAAL,yBAAA,SAAA;AACL,SAAA,YAAA;AACA,SAAA,YAAA;AACA,SAAA,aAAA;AACA,SAAA,WAAA;AACA,SAAA,UAAA;AACA,SAAA,QAAA,QAAA,KAAA;AACA,SAAA,QAAA,UAAA,KAAA;AACA,SAAA,QAAA,WAAA,KAAA;AACA,SAAA,QAAA,UAAA,KAAA;;KACD;AAED,SAAgB,0BAA0B;AACxC,QAAO;EACL,SAAS;EACT,UAAU;EACX"}