@rpgjs/client 5.0.0-beta.2 → 5.0.0-beta.4

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 (80) hide show
  1. package/dist/Game/Map.js +2 -2
  2. package/dist/Game/Object.d.ts +10 -2
  3. package/dist/Game/Object.js +56 -26
  4. package/dist/Game/Object.js.map +1 -1
  5. package/dist/Gui/Gui.js.map +1 -1
  6. package/dist/Gui/NotificationManager.js.map +1 -1
  7. package/dist/RpgClientEngine.d.ts +16 -0
  8. package/dist/RpgClientEngine.js +53 -6
  9. package/dist/RpgClientEngine.js.map +1 -1
  10. package/dist/Sound.js.map +1 -1
  11. package/dist/_virtual/{_@oxc-project_runtime@0.122.0 → _@oxc-project_runtime@0.127.0}/helpers/decorate.js +1 -1
  12. package/dist/_virtual/{_@oxc-project_runtime@0.122.0 → _@oxc-project_runtime@0.127.0}/helpers/decorateMetadata.js +1 -1
  13. package/dist/components/animations/animation.ce.js +2 -4
  14. package/dist/components/animations/animation.ce.js.map +1 -1
  15. package/dist/components/animations/hit.ce.js +17 -24
  16. package/dist/components/animations/hit.ce.js.map +1 -1
  17. package/dist/components/character.ce.js +75 -222
  18. package/dist/components/character.ce.js.map +1 -1
  19. package/dist/components/dynamics/text.ce.js +14 -25
  20. package/dist/components/dynamics/text.ce.js.map +1 -1
  21. package/dist/components/gui/box.ce.js +4 -7
  22. package/dist/components/gui/box.ce.js.map +1 -1
  23. package/dist/components/gui/dialogbox/index.ce.js +37 -54
  24. package/dist/components/gui/dialogbox/index.ce.js.map +1 -1
  25. package/dist/components/gui/gameover.ce.js +36 -61
  26. package/dist/components/gui/gameover.ce.js.map +1 -1
  27. package/dist/components/gui/hud/hud.ce.js +18 -28
  28. package/dist/components/gui/hud/hud.ce.js.map +1 -1
  29. package/dist/components/gui/menu/equip-menu.ce.js +108 -163
  30. package/dist/components/gui/menu/equip-menu.ce.js.map +1 -1
  31. package/dist/components/gui/menu/exit-menu.ce.js +4 -4
  32. package/dist/components/gui/menu/exit-menu.ce.js.map +1 -1
  33. package/dist/components/gui/menu/items-menu.ce.js +47 -66
  34. package/dist/components/gui/menu/items-menu.ce.js.map +1 -1
  35. package/dist/components/gui/menu/main-menu.ce.js +58 -77
  36. package/dist/components/gui/menu/main-menu.ce.js.map +1 -1
  37. package/dist/components/gui/menu/options-menu.ce.js +3 -3
  38. package/dist/components/gui/menu/options-menu.ce.js.map +1 -1
  39. package/dist/components/gui/menu/skills-menu.ce.js +10 -16
  40. package/dist/components/gui/menu/skills-menu.ce.js.map +1 -1
  41. package/dist/components/gui/mobile/mobile.ce.js +3 -3
  42. package/dist/components/gui/mobile/mobile.ce.js.map +1 -1
  43. package/dist/components/gui/notification/notification.ce.js +13 -19
  44. package/dist/components/gui/notification/notification.ce.js.map +1 -1
  45. package/dist/components/gui/save-load.ce.js +68 -247
  46. package/dist/components/gui/save-load.ce.js.map +1 -1
  47. package/dist/components/gui/shop/shop.ce.js +84 -123
  48. package/dist/components/gui/shop/shop.ce.js.map +1 -1
  49. package/dist/components/gui/title-screen.ce.js +38 -65
  50. package/dist/components/gui/title-screen.ce.js.map +1 -1
  51. package/dist/components/prebuilt/hp-bar.ce.js +39 -43
  52. package/dist/components/prebuilt/hp-bar.ce.js.map +1 -1
  53. package/dist/components/prebuilt/light-halo.ce.js +33 -58
  54. package/dist/components/prebuilt/light-halo.ce.js.map +1 -1
  55. package/dist/components/scenes/canvas.ce.js +11 -19
  56. package/dist/components/scenes/canvas.ce.js.map +1 -1
  57. package/dist/components/scenes/draw-map.ce.js +20 -25
  58. package/dist/components/scenes/draw-map.ce.js.map +1 -1
  59. package/dist/components/scenes/event-layer.ce.js +4 -4
  60. package/dist/components/scenes/event-layer.ce.js.map +1 -1
  61. package/dist/core/setup.js.map +1 -1
  62. package/dist/module.js.map +1 -1
  63. package/dist/node_modules/.pnpm/@signe_di@2.9.0/node_modules/@signe/di/dist/index.js.map +1 -1
  64. package/dist/node_modules/.pnpm/@signe_reactive@2.9.0/node_modules/@signe/reactive/dist/index.js +1 -1
  65. package/dist/node_modules/.pnpm/@signe_reactive@2.9.0/node_modules/@signe/reactive/dist/index.js.map +1 -1
  66. package/dist/node_modules/.pnpm/@signe_room@2.9.0/node_modules/@signe/room/dist/index.js +1 -1
  67. package/dist/node_modules/.pnpm/@signe_room@2.9.0/node_modules/@signe/room/dist/index.js.map +1 -1
  68. package/dist/node_modules/.pnpm/@signe_sync@2.9.0/node_modules/@signe/sync/dist/client/index.js.map +1 -1
  69. package/dist/node_modules/.pnpm/@signe_sync@2.9.0/node_modules/@signe/sync/dist/index.js.map +1 -1
  70. package/dist/node_modules/.pnpm/partysocket@1.1.3/node_modules/partysocket/dist/chunk-S74YV6PU.js.map +1 -1
  71. package/dist/node_modules/.pnpm/zod@3.24.2/node_modules/zod/lib/index.js +27 -27
  72. package/dist/node_modules/.pnpm/zod@3.24.2/node_modules/zod/lib/index.js.map +1 -1
  73. package/dist/services/keyboardControls.js.map +1 -1
  74. package/dist/services/mmorpg.js +2 -1
  75. package/dist/services/mmorpg.js.map +1 -1
  76. package/package.json +7 -7
  77. package/src/Game/Object.ts +86 -32
  78. package/src/RpgClientEngine.ts +83 -12
  79. package/dist/node_modules/.pnpm/@signe_reactive@2.8.3/node_modules/@signe/reactive/dist/index.js +0 -457
  80. package/dist/node_modules/.pnpm/@signe_reactive@2.8.3/node_modules/@signe/reactive/dist/index.js.map +0 -1
@@ -5,15 +5,15 @@ import { DOMContainer, DOMElement, h, signal, useDefineProps, useProps } from "c
5
5
  function component($$props) {
6
6
  useProps($$props);
7
7
  const defineProps = useDefineProps($$props);
8
- var keyboardControls = inject(RpgClientEngine).globalConfig.keyboardControls;
9
- var onBack = defineProps().onBack;
8
+ const keyboardControls = inject(RpgClientEngine).globalConfig.keyboardControls;
9
+ const { onBack } = defineProps();
10
10
  return h(DOMContainer, {
11
11
  width: "100%",
12
12
  height: "100%",
13
13
  controls: signal({
14
14
  escape: {
15
15
  bind: keyboardControls.escape,
16
- keyDown: function() {
16
+ keyDown() {
17
17
  if (onBack) onBack();
18
18
  }
19
19
  },
@@ -1 +1 @@
1
- {"version":3,"file":"options-menu.ce.js","names":[],"sources":["../../../../src/components/gui/menu/options-menu.ce"],"sourcesContent":["<DOMContainer width=\"100%\" height=\"100%\" controls={controls}>\n <div class=\"rpg-ui-menu-panel rpg-ui-panel\">\n <div class=\"rpg-ui-menu-panel-header\">Options</div>\n <div class=\"rpg-ui-menu-panel-body\">\n <div class=\"rpg-ui-menu-panel-details\">\n <div class=\"rpg-ui-menu-panel-details-title\">Options</div>\n <div class=\"rpg-ui-menu-panel-details-desc\">\n Configure your preferences here.\n </div>\n </div>\n </div>\n </div>\n</DOMContainer>\n\n<script>\n import { signal } from \"canvasengine\";\n import { inject } from \"../../../core/inject\";\n import { RpgClientEngine } from \"../../../RpgClientEngine\";\n\n const engine = inject(RpgClientEngine);\n const keyboardControls = engine.globalConfig.keyboardControls;\n const { onBack } = defineProps();\n\n const controls = signal({\n escape: {\n bind: keyboardControls.escape,\n keyDown() {\n if (onBack) onBack();\n }\n },\n gamepad: {\n enabled: true\n }\n });\n</script>\n"],"mappings":";;;;AASM,SAAW,UAAA,SAAA;AACJ,UAAA,QAAA;CACP,MAAG,cAAA,eAAA,QAAA;wBACK,OAAA,gBAAA,CAAA,aAAA;CAEd,IAAC,SAAM,aAAA,CAAA;AAcC,QADY,EAAA,cAAgB;EAAA,OAAA;EAAA,QAAA;EAAA,UAZvB,OAAS;GAClB,QAAQ;IACR,MAAS,iBAAkB;;AAErB,SAAM,OACN,SAAA;;;GAGN,SAAM,EACF,SAAQ,MACX;GACJ,CAAC;EACkC,EAAA,EAAA,YAAA;EAAA,SAAA;EAAA,OAAA,EAAA,OAAA,kCAAA;EAAA,EAAA,CAAA,EAAA,YAAA;EAAA,SAAA;EAAA,OAAA,EAAA,OAAA,4BAAA;EAAA,aAAA;EAAA,CAAA,EAAA,EAAA,YAAA;EAAA,SAAA;EAAA,OAAA,EAAA,OAAA,0BAAA;EAAA,EAAA,EAAA,YAAA;EAAA,SAAA;EAAA,OAAA,EAAA,OAAA,6BAAA;EAAA,EAAA,CAAA,EAAA,YAAA;EAAA,SAAA;EAAA,OAAA,EAAA,OAAA,mCAAA;EAAA,aAAA;EAAA,CAAA,EAAA,EAAA,YAAA;EAAA,SAAA;EAAA,OAAA,EAAA,OAAA,kCAAA;EAAA,aAAA;EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA"}
1
+ {"version":3,"file":"options-menu.ce.js","names":[],"sources":["../../../../src/components/gui/menu/options-menu.ce"],"sourcesContent":["<DOMContainer width=\"100%\" height=\"100%\" controls={controls}>\n <div class=\"rpg-ui-menu-panel rpg-ui-panel\">\n <div class=\"rpg-ui-menu-panel-header\">Options</div>\n <div class=\"rpg-ui-menu-panel-body\">\n <div class=\"rpg-ui-menu-panel-details\">\n <div class=\"rpg-ui-menu-panel-details-title\">Options</div>\n <div class=\"rpg-ui-menu-panel-details-desc\">\n Configure your preferences here.\n </div>\n </div>\n </div>\n </div>\n</DOMContainer>\n\n<script>\n import { signal } from \"canvasengine\";\n import { inject } from \"../../../core/inject\";\n import { RpgClientEngine } from \"../../../RpgClientEngine\";\n\n const engine = inject(RpgClientEngine);\n const keyboardControls = engine.globalConfig.keyboardControls;\n const { onBack } = defineProps();\n\n const controls = signal({\n escape: {\n bind: keyboardControls.escape,\n keyDown() {\n if (onBack) onBack();\n }\n },\n gamepad: {\n enabled: true\n }\n });\n</script>\n"],"mappings":";;;;AASM,SAAW,UAAA,SAAA;AACJ,UAAA,QAAA;CACP,MAAG,cAAA,eAAA,QAAA;0BACK,OAAA,gBAAA,CAAA,aAAA;CAEd,MAAC,EAAM,WAAA,aAAA;AAcC,QADY,EAAA,cAAgB;EAAA,OAAA;EAAA,QAAA;EAAA,UAZvB,OAAS;GAClB,QAAQ;IACR,MAAS,iBAAkB;;AAErB,SAAM,OACN,SAAA;;;GAGN,SAAM,EACF,SAAQ,MACX;GACJ,CACmC;EAAA,EAAA,EAAA,YAAA;EAAA,SAAA;EAAA,OAAA,EAAA,OAAA,kCAAA;EAAA,EAAA,CAAA,EAAA,YAAA;EAAA,SAAA;EAAA,OAAA,EAAA,OAAA,4BAAA;EAAA,aAAA;EAAA,CAAA,EAAA,EAAA,YAAA;EAAA,SAAA;EAAA,OAAA,EAAA,OAAA,0BAAA;EAAA,EAAA,EAAA,YAAA;EAAA,SAAA;EAAA,OAAA,EAAA,OAAA,6BAAA;EAAA,EAAA,CAAA,EAAA,YAAA;EAAA,SAAA;EAAA,OAAA,EAAA,OAAA,mCAAA;EAAA,aAAA;EAAA,CAAA,EAAA,EAAA,YAAA;EAAA,SAAA;EAAA,OAAA,EAAA,OAAA,kCAAA;EAAA,aAAA;EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CACxB"}
@@ -5,29 +5,23 @@ import { DOMContainer, DOMElement, Navigation, computed, cond, createTabindexNav
5
5
  function component($$props) {
6
6
  useProps($$props);
7
7
  const defineProps = useDefineProps($$props);
8
- var keyboardControls = inject(RpgClientEngine).globalConfig.keyboardControls;
9
- var selectedSkill = signal(0);
10
- var _a = defineProps(), data = _a.data, onBack = _a.onBack;
11
- var skills = computed(function() {
12
- return data().skills;
13
- });
14
- var nav = createTabindexNavigator(selectedSkill, { count: function() {
15
- return skills().length;
16
- } }, "wrap");
17
- var currentSkill = computed(function() {
18
- return skills()[selectedSkill()];
19
- });
8
+ const keyboardControls = inject(RpgClientEngine).globalConfig.keyboardControls;
9
+ const selectedSkill = signal(0);
10
+ const { data, onBack } = defineProps();
11
+ const skills = computed(() => data().skills);
12
+ const nav = createTabindexNavigator(selectedSkill, { count: () => skills().length }, "wrap");
13
+ const currentSkill = computed(() => skills()[selectedSkill()]);
20
14
  function selectSkill(index) {
21
15
  return function() {
22
16
  selectedSkill.set(index);
23
17
  };
24
18
  }
25
- var controls = signal({
19
+ const controls = signal({
26
20
  up: {
27
21
  repeat: true,
28
22
  bind: keyboardControls.up,
29
23
  throttle: 150,
30
- keyDown: function() {
24
+ keyDown() {
31
25
  nav.next(-1);
32
26
  }
33
27
  },
@@ -35,13 +29,13 @@ function component($$props) {
35
29
  repeat: true,
36
30
  bind: keyboardControls.down,
37
31
  throttle: 150,
38
- keyDown: function() {
32
+ keyDown() {
39
33
  nav.next(1);
40
34
  }
41
35
  },
42
36
  escape: {
43
37
  bind: keyboardControls.escape,
44
- keyDown: function() {
38
+ keyDown() {
45
39
  if (onBack) onBack();
46
40
  }
47
41
  },
@@ -1 +1 @@
1
- {"version":3,"file":"skills-menu.ce.js","names":[],"sources":["../../../../src/components/gui/menu/skills-menu.ce"],"sourcesContent":["<DOMContainer width=\"100%\" height=\"100%\">\n <div class=\"rpg-ui-menu-panel rpg-ui-panel\">\n <div class=\"rpg-ui-menu-panel-header\">Skills</div>\n <div class=\"rpg-ui-menu-panel-body rpg-ui-menu-panel-body-stacked\">\n <div class=\"rpg-ui-menu-panel-details rpg-ui-panel\">\n @if (currentSkill) {\n <div class=\"rpg-ui-menu-panel-hero\">\n <div class=\"rpg-ui-menu-panel-hero-icon\">✨</div>\n <div>\n <div class=\"rpg-ui-menu-panel-details-title\">{currentSkill()?.name}</div>\n <div class=\"rpg-ui-menu-panel-details-desc\">{currentSkill()?.description || \"\"}</div>\n </div>\n </div>\n }\n </div>\n <div class=\"rpg-ui-menu-panel-list rpg-ui-menu rpg-ui-menu-panel-list-full\">\n <Navigation tabindex={selectedSkill} controls={controls}>\n @for ((skill,index) of skills) {\n <div\n class=\"rpg-ui-menu-item rpg-ui-menu-row\"\n data-selected={selectedSkill() === index ? \"true\" : \"false\"}\n tabindex={index}\n click={selectSkill(index)}\n >\n <span>{skill.name}</span>\n <span class=\"rpg-ui-menu-row-end\">SP {skill.spCost ?? 0}</span>\n </div>\n }\n </Navigation>\n </div>\n </div>\n </div>\n</DOMContainer>\n\n<script>\n import { signal, computed, createTabindexNavigator } from \"canvasengine\";\n import { inject } from \"../../../core/inject\";\n import { RpgClientEngine } from \"../../../RpgClientEngine\";\n\n const engine = inject(RpgClientEngine);\n const keyboardControls = engine.globalConfig.keyboardControls;\n\n const selectedSkill = signal(0);\n const { data, onBack } = defineProps();\n const skills = computed(() => data().skills);\n\n const nav = createTabindexNavigator(selectedSkill, { count: () => skills().length }, \"wrap\");\n const currentSkill = computed(() => skills()[selectedSkill()]);\n\n function selectSkill(index) {\n return function() {\n selectedSkill.set(index);\n }\n }\n\n const controls = signal({\n up: {\n repeat: true,\n bind: keyboardControls.up,\n throttle: 150,\n keyDown() {\n nav.next(-1);\n }\n },\n down: {\n repeat: true,\n bind: keyboardControls.down,\n throttle: 150,\n keyDown() {\n nav.next(1);\n }\n },\n escape: {\n bind: keyboardControls.escape,\n keyDown() {\n if (onBack) onBack();\n }\n },\n gamepad: {\n enabled: true\n }\n });\n</script>\n"],"mappings":";;;;AAUM,SAAuB,UAAW,SAAO;AACxB,UAAM,QAAA;CACrB,MAAM,cAAW,eAAA,QAAA;CAEzB,IAAI,mBADY,OAAA,gBAAA,CACC,aAAA;CACjB,IAAI,gBAAa,OAAU,EAAC;CAC5B,IAAI,KAAK,aAAQ,EAAA,OAAW,GAAA,MAAU,SAAA,GAAc;CACpD,IAAI,SAAS,SAAQ,WAAY;AAAA,SAAU,MAAM,CAAC;GAAC;CACnD,IAAI,MAAM,wBAAe,eAAA,EAAA,OAAA,WAAA;AAAA,SAAA,QAAA,CAAA;IAAA,EAAA,OAAA;CACzB,IAAI,eAAe,SAAS,WAAW;AAAG,SAAK,QAAS,CAAE,eAAS;GAAA;CACnE,SAAS,YAAY,OAAO;AACxB,SAAO,WAAY;AACf,iBAAc,IAAI,MAAE;;;CAG5B,IAAI,WAAW,OAAO;EAClB,IAAI;GACA,QAAQ;GACR,MAAM,iBAAc;GACpB,UAAS;GACT,SAAK,WAAA;AACJ,QAAA,KAAA,GAAA;;;EAGR,MAAM;GACH,QAAS;GACT,MAAS,iBAAkB;GAC3B,UAAS;;AAEH,QAAM,KAAG,EAAA;;;EAGf,QAAM;GACN,MAAQ,iBAAiB;GACzB,SAAa,WAAY;eAEb,SAAA;;;EAGZ,SAAS,EACL,SAAO,MACV;EACJ,CAAC;QACE,EAAA,cAAA;EAAA,OAAA;EAAA,QAAA;EAAA,EAAA,EAAA,YAAA;EAAA,SAAA;EAAA,OAAA,EAAA,OAAA,kCAAA;EAAA,EAAA,CAAA,EAAA,YAAA;EAAA,SAAA;EAAA,OAAA,EAAA,OAAA,4BAAA;EAAA,aAAA;EAAA,CAAA,EAAA,EAAA,YAAA;EAAA,SAAA;EAAA,OAAA,EAAA,OAAA,yDAAA;EAAA,EAAA,CAAA,EAAA,YAAA;EAAA,SAAA;EAAA,OAAA,EAAA,OAAA,0CAAA;EAAA,EAAA,KAAA,oBAAA,EAAA,YAAA;EAAA,SAAA;EAAA,OAAA,EAAA,OAAA,0BAAA;EAAA,EAAA,CAAA,EAAA,YAAA;EAAA,SAAA;EAAA,OAAA,EAAA,OAAA,+BAAA;EAAA,aAAA;EAAA,CAAA,EAAA,EAAA,YAAA,EAAA,SAAA,OAAA,EAAA,CAAA,EAAA,YAAA;EAAA,SAAA;EAAA,OAAA,EAAA,OAAA,mCAAA;EAAA,aAAA,eAAA,cAAA,EAAA,KAAA;EAAA,CAAA,EAAA,EAAA,YAAA;EAAA,SAAA;EAAA,OAAA,EAAA,OAAA,kCAAA;EAAA,aAAA,eAAA,cAAA,EAAA,eAAA,GAAA;EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,EAAA,YAAA;EAAA,SAAA;EAAA,OAAA,EAAA,OAAA,kEAAA;EAAA,EAAA,EAAA,YAAA;EAAA,UAAA;EAAA;EAAA,EAAA,KAAA,SAAA,OAAA,UAAA,EAAA,YAAA;EAAA,SAAA;EAAA,OAAA;GAAA,OAAA;GAAA,iBAAA,eAAA,eAAA,KAAA,QAAA,SAAA,QAAA;GAAA,UAAA;GAAA,OAAA,YAAA,MAAA;GAAA;EAAA,EAAA,CAAA,EAAA,YAAA;EAAA,SAAA;EAAA,aAAA,MAAA;EAAA,CAAA,EAAA,EAAA,YAAA;EAAA,SAAA;EAAA,OAAA,EAAA,OAAA,uBAAA;EAAA,aAAA,QAAA,MAAA;EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA"}
1
+ {"version":3,"file":"skills-menu.ce.js","names":[],"sources":["../../../../src/components/gui/menu/skills-menu.ce"],"sourcesContent":["<DOMContainer width=\"100%\" height=\"100%\">\n <div class=\"rpg-ui-menu-panel rpg-ui-panel\">\n <div class=\"rpg-ui-menu-panel-header\">Skills</div>\n <div class=\"rpg-ui-menu-panel-body rpg-ui-menu-panel-body-stacked\">\n <div class=\"rpg-ui-menu-panel-details rpg-ui-panel\">\n @if (currentSkill) {\n <div class=\"rpg-ui-menu-panel-hero\">\n <div class=\"rpg-ui-menu-panel-hero-icon\">✨</div>\n <div>\n <div class=\"rpg-ui-menu-panel-details-title\">{currentSkill()?.name}</div>\n <div class=\"rpg-ui-menu-panel-details-desc\">{currentSkill()?.description || \"\"}</div>\n </div>\n </div>\n }\n </div>\n <div class=\"rpg-ui-menu-panel-list rpg-ui-menu rpg-ui-menu-panel-list-full\">\n <Navigation tabindex={selectedSkill} controls={controls}>\n @for ((skill,index) of skills) {\n <div\n class=\"rpg-ui-menu-item rpg-ui-menu-row\"\n data-selected={selectedSkill() === index ? \"true\" : \"false\"}\n tabindex={index}\n click={selectSkill(index)}\n >\n <span>{skill.name}</span>\n <span class=\"rpg-ui-menu-row-end\">SP {skill.spCost ?? 0}</span>\n </div>\n }\n </Navigation>\n </div>\n </div>\n </div>\n</DOMContainer>\n\n<script>\n import { signal, computed, createTabindexNavigator } from \"canvasengine\";\n import { inject } from \"../../../core/inject\";\n import { RpgClientEngine } from \"../../../RpgClientEngine\";\n\n const engine = inject(RpgClientEngine);\n const keyboardControls = engine.globalConfig.keyboardControls;\n\n const selectedSkill = signal(0);\n const { data, onBack } = defineProps();\n const skills = computed(() => data().skills);\n\n const nav = createTabindexNavigator(selectedSkill, { count: () => skills().length }, \"wrap\");\n const currentSkill = computed(() => skills()[selectedSkill()]);\n\n function selectSkill(index) {\n return function() {\n selectedSkill.set(index);\n }\n }\n\n const controls = signal({\n up: {\n repeat: true,\n bind: keyboardControls.up,\n throttle: 150,\n keyDown() {\n nav.next(-1);\n }\n },\n down: {\n repeat: true,\n bind: keyboardControls.down,\n throttle: 150,\n keyDown() {\n nav.next(1);\n }\n },\n escape: {\n bind: keyboardControls.escape,\n keyDown() {\n if (onBack) onBack();\n }\n },\n gamepad: {\n enabled: true\n }\n });\n</script>\n"],"mappings":";;;;AAUM,SAAuB,UAAW,SAAO;AACxB,UAAM,QAAA;CACrB,MAAM,cAAW,eAAA,QAAA;CAEzB,MAAM,mBADU,OAAA,gBACC,CAAA,aAAA;CACjB,MAAM,gBAAgB,OAAM,EAAG;CAC/B,MAAM,EAAE,MAAM,WAAG,aAAqB;CACtC,MAAM,SAAS,eAAY,MAAM,CAAA,OAAU;CAC3C,MAAM,MAAM,wBAAa,eAAA,EAAA,aAAA,QAAA,CAAA,QAAA,EAAA,OAAA;CACzB,MAAM,eAAe,eAAc,QAAO,CAAA,eAAiB,EAAA;CAC3D,SAAS,YAAY,OAAO;AACxB,SAAO,WAAY;AACf,iBAAc,IAAI,MAAE;;;CAG5B,MAAM,WAAW,OAAO;EACpB,IAAI;GACA,QAAQ;GACR,MAAM,iBAAc;GACpB,UAAS;GACT,UAAK;AACJ,QAAA,KAAA,GAAA;;;EAGR,MAAM;GACH,QAAS;GACT,MAAS,iBAAkB;GAC3B,UAAS;;AAEH,QAAM,KAAG,EAAA;;;EAGf,QAAM;GACN,MAAQ,iBAAiB;GACzB,UAAc;eAEF,SAAA;;;EAGZ,SAAS,EACL,SAAO,MACV;EACJ,CAAC;QACE,EAAA,cAAA;EAAA,OAAA;EAAA,QAAA;EAAA,EAAA,EAAA,YAAA;EAAA,SAAA;EAAA,OAAA,EAAA,OAAA,kCAAA;EAAA,EAAA,CAAA,EAAA,YAAA;EAAA,SAAA;EAAA,OAAA,EAAA,OAAA,4BAAA;EAAA,aAAA;EAAA,CAAA,EAAA,EAAA,YAAA;EAAA,SAAA;EAAA,OAAA,EAAA,OAAA,yDAAA;EAAA,EAAA,CAAA,EAAA,YAAA;EAAA,SAAA;EAAA,OAAA,EAAA,OAAA,0CAAA;EAAA,EAAA,KAAA,oBAAA,EAAA,YAAA;EAAA,SAAA;EAAA,OAAA,EAAA,OAAA,0BAAA;EAAA,EAAA,CAAA,EAAA,YAAA;EAAA,SAAA;EAAA,OAAA,EAAA,OAAA,+BAAA;EAAA,aAAA;EAAA,CAAA,EAAA,EAAA,YAAA,EAAA,SAAA,OAAA,EAAA,CAAA,EAAA,YAAA;EAAA,SAAA;EAAA,OAAA,EAAA,OAAA,mCAAA;EAAA,aAAA,eAAA,cAAA,EAAA,KAAA;EAAA,CAAA,EAAA,EAAA,YAAA;EAAA,SAAA;EAAA,OAAA,EAAA,OAAA,kCAAA;EAAA,aAAA,eAAA,cAAA,EAAA,eAAA,GAAA;EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,EAAA,YAAA;EAAA,SAAA;EAAA,OAAA,EAAA,OAAA,kEAAA;EAAA,EAAA,EAAA,YAAA;EAAA,UAAA;EAAA;EAAA,EAAA,KAAA,SAAA,OAAA,UAAA,EAAA,YAAA;EAAA,SAAA;EAAA,OAAA;GAAA,OAAA;GAAA,iBAAA,eAAA,eAAA,KAAA,QAAA,SAAA,QAAA;GAAA,UAAA;GAAA,OAAA,YAAA,MAAA;GAAA;EAAA,EAAA,CAAA,EAAA,YAAA;EAAA,SAAA;EAAA,aAAA,MAAA;EAAA,CAAA,EAAA,EAAA,YAAA;EAAA,SAAA;EAAA,OAAA,EAAA,OAAA,uBAAA;EAAA,aAAA,QAAA,MAAA;EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA"}
@@ -4,9 +4,9 @@ import { Button, Container, Joystick, h, mount, signal, useDefineProps, useProps
4
4
  function component($$props) {
5
5
  useProps($$props);
6
6
  useDefineProps($$props);
7
- var controlsInstance = signal(null);
8
- mount(function(element) {
9
- var control = inject("KeyboardControls");
7
+ const controlsInstance = signal(null);
8
+ mount((element) => {
9
+ const control = inject("KeyboardControls");
10
10
  controlsInstance.set(control);
11
11
  });
12
12
  return h(Container, {
@@ -1 +1 @@
1
- {"version":3,"file":"mobile.ce.js","names":[],"sources":["../../../../src/components/gui/mobile/mobile.ce"],"sourcesContent":["<Container justifyContent=\"space-between\" alignItems=\"flex-end\" width=\"100%\" height=\"100%\">\n <!-- Gamepad buttons A and B (left side) -->\n <Container justifyContent=\"flex-start\" alignItems=\"flex-end\" gap={20}>\n <Container display=\"flex\" direction=\"column\" gap={20} margin={50}>\n <!-- Button B (top) -->\n \n <!-- Button A (bottom) -->\n <Button \n text=\"A\"\n shape=\"circle\"\n width={70}\n height={70}\n controls={controlsInstance}\n controlName=\"action\"\n style={{\n backgroundColor: {\n normal: \"#2ecc71\",\n hover: \"#27ae60\",\n pressed: \"#229954\",\n disabled: \"#7f8c8d\"\n },\n text: {\n fontSize: 24,\n fontFamily: \"Arial Bold\",\n color: \"#ffffff\"\n }\n }}\n />\n\n <Button \n text=\"B\"\n shape=\"circle\"\n width={70}\n height={70}\n controls={controlsInstance}\n controlName=\"back\"\n style={{\n backgroundColor: {\n normal: \"#e74c3c\",\n hover: \"#c0392b\",\n pressed: \"#a93226\",\n disabled: \"#7f8c8d\"\n },\n text: {\n fontSize: 24,\n fontFamily: \"Arial Bold\",\n color: \"#ffffff\"\n }\n }}\n />\n\n </Container>\n </Container>\n \n <Container margin={100} alignItems=\"flex-end\">\n <Container>\n <Joystick \n controls={controlsInstance}\n outerColor=\"#34495e\"\n innerColor=\"#3498db\"\n />\n </Container>\n </Container>\n</Container>\n\n<script>\n import { signal, mount } from 'canvasengine'\n import { Button } from 'canvasengine'\n import { inject } from '../../../core/inject'\n import { RpgClientEngine } from '../../../RpgClientEngine'\n import { Direction } from '@rpgjs/common'\n\n\n const controlsInstance = signal(null)\n\n mount((element) => {\n const control = inject('KeyboardControls')\n controlsInstance.set(control)\n })\n</script>"],"mappings":";;;AASM,SAAuB,UAAA,SAAA;AACN,UAAE,QAAA;AACC,gBAAA,QAAA;CAClB,IAAI,mBAAc,OAAA,KAAgB;AAC1C,OAAM,SAAU,SAAA;EACZ,IAAI,UAAQ,OAAO,mBAAA;AACnB,mBAAgB,IAAA,QAAA;GAClB;AAEM,QADY,EAAE,WAAW;EAAA,gBAAO;EAAA,YAAA;EAAA,OAAA;EAAA,QAAA;EAAA,EAAA,CAAA,EAAA,WAAA;EAAA,gBAAA;EAAA,YAAA;EAAA,KAAA;EAAA,EAAA,EAAA,WAAA;EAAA,SAAA;EAAA,WAAA;EAAA,KAAA;EAAA,QAAA;EAAA,EAAA,CAAA,EAAA,QAAA;EAAA,MAAA;EAAA,OAAA;EAAA,OAAA;EAAA,QAAA;EAAA,UAAA;EAAA,aAAA;EAAA,OAAA;GAAA,iBAAA;IAAA,QAAA;IAAA,OAAA;IAAA,SAAA;IAAA,UAAA;IAAA;GAAA,MAAA;IAAA,UAAA;IAAA,YAAA;IAAA,OAAA;IAAA;GAAA;EAAA,CAAA,EAAA,EAAA,QAAA;EAAA,MAAA;EAAA,OAAA;EAAA,OAAA;EAAA,QAAA;EAAA,UAAA;EAAA,aAAA;EAAA,OAAA;GAAA,iBAAA;IAAA,QAAA;IAAA,OAAA;IAAA,SAAA;IAAA,UAAA;IAAA;GAAA,MAAA;IAAA,UAAA;IAAA,YAAA;IAAA,OAAA;IAAA;GAAA;EAAA,CAAA,CAAA,CAAA,CAAA,EAAA,EAAA,WAAA;EAAA,QAAA;EAAA,YAAA;EAAA,EAAA,EAAA,WAAA,MAAA,EAAA,UAAA;EAAA,UAAA;EAAA,YAAA;EAAA,YAAA;EAAA,CAAA,CAAA,CAAA,CAAA,CAAA"}
1
+ {"version":3,"file":"mobile.ce.js","names":[],"sources":["../../../../src/components/gui/mobile/mobile.ce"],"sourcesContent":["<Container justifyContent=\"space-between\" alignItems=\"flex-end\" width=\"100%\" height=\"100%\">\n <!-- Gamepad buttons A and B (left side) -->\n <Container justifyContent=\"flex-start\" alignItems=\"flex-end\" gap={20}>\n <Container display=\"flex\" direction=\"column\" gap={20} margin={50}>\n <!-- Button B (top) -->\n \n <!-- Button A (bottom) -->\n <Button \n text=\"A\"\n shape=\"circle\"\n width={70}\n height={70}\n controls={controlsInstance}\n controlName=\"action\"\n style={{\n backgroundColor: {\n normal: \"#2ecc71\",\n hover: \"#27ae60\",\n pressed: \"#229954\",\n disabled: \"#7f8c8d\"\n },\n text: {\n fontSize: 24,\n fontFamily: \"Arial Bold\",\n color: \"#ffffff\"\n }\n }}\n />\n\n <Button \n text=\"B\"\n shape=\"circle\"\n width={70}\n height={70}\n controls={controlsInstance}\n controlName=\"back\"\n style={{\n backgroundColor: {\n normal: \"#e74c3c\",\n hover: \"#c0392b\",\n pressed: \"#a93226\",\n disabled: \"#7f8c8d\"\n },\n text: {\n fontSize: 24,\n fontFamily: \"Arial Bold\",\n color: \"#ffffff\"\n }\n }}\n />\n\n </Container>\n </Container>\n \n <Container margin={100} alignItems=\"flex-end\">\n <Container>\n <Joystick \n controls={controlsInstance}\n outerColor=\"#34495e\"\n innerColor=\"#3498db\"\n />\n </Container>\n </Container>\n</Container>\n\n<script>\n import { signal, mount } from 'canvasengine'\n import { Button } from 'canvasengine'\n import { inject } from '../../../core/inject'\n import { RpgClientEngine } from '../../../RpgClientEngine'\n import { Direction } from '@rpgjs/common'\n\n\n const controlsInstance = signal(null)\n\n mount((element) => {\n const control = inject('KeyboardControls')\n controlsInstance.set(control)\n })\n</script>"],"mappings":";;;AASM,SAAuB,UAAA,SAAA;AACN,UAAE,QAAA;AACC,gBAAA,QAAA;CAClB,MAAM,mBAAY,OAAA,KAAgB;AAC1C,QAAO,YAAS;EACZ,MAAM,UAAM,OAAO,mBAAA;AACnB,mBAAgB,IAAA,QAAA;GAClB;AAEM,QADY,EAAE,WAAW;EAAA,gBAAO;EAAA,YAAA;EAAA,OAAA;EAAA,QAAA;EAAA,EAAA,CAAA,EAAA,WAAA;EAAA,gBAAA;EAAA,YAAA;EAAA,KAAA;EAAA,EAAA,EAAA,WAAA;EAAA,SAAA;EAAA,WAAA;EAAA,KAAA;EAAA,QAAA;EAAA,EAAA,CAAA,EAAA,QAAA;EAAA,MAAA;EAAA,OAAA;EAAA,OAAA;EAAA,QAAA;EAAA,UAAA;EAAA,aAAA;EAAA,OAAA;GAAA,iBAAA;IAAA,QAAA;IAAA,OAAA;IAAA,SAAA;IAAA,UAAA;IAAA;GAAA,MAAA;IAAA,UAAA;IAAA,YAAA;IAAA,OAAA;IAAA;GAAA;EAAA,CAAA,EAAA,EAAA,QAAA;EAAA,MAAA;EAAA,OAAA;EAAA,OAAA;EAAA,QAAA;EAAA,UAAA;EAAA,aAAA;EAAA,OAAA;GAAA,iBAAA;IAAA,QAAA;IAAA,OAAA;IAAA,SAAA;IAAA,UAAA;IAAA;GAAA,MAAA;IAAA,UAAA;IAAA,YAAA;IAAA,OAAA;IAAA;GAAA;EAAA,CAAA,CAAA,CAAA,CAAA,EAAA,EAAA,WAAA;EAAA,QAAA;EAAA,YAAA;EAAA,EAAA,EAAA,WAAA,MAAA,EAAA,UAAA;EAAA,UAAA;EAAA,YAAA;EAAA,YAAA;EAAA,CAAA,CAAA,CAAA,CAAA,CACpB"}
@@ -11,29 +11,23 @@ if (typeof document !== "undefined" && !document.getElementById("ce-style--home-
11
11
  function component($$props) {
12
12
  useProps($$props);
13
13
  useDefineProps($$props);
14
- var engine = inject(RpgClientEngine);
15
- var notifications = computed(function() {
16
- return engine.notificationManager.stack();
14
+ const engine = inject(RpgClientEngine);
15
+ const notifications = computed(() => engine.notificationManager.stack());
16
+ const iconSheet = (iconId) => ({
17
+ definition: engine.getSpriteSheet(iconId),
18
+ playing: "default"
17
19
  });
18
- var iconSheet = function(iconId) {
19
- return {
20
- definition: engine.getSpriteSheet(iconId),
21
- playing: "default"
22
- };
23
- };
24
- effect(function() {
25
- var list = notifications();
26
- var rowHeight = 68;
27
- list.forEach(function(notif, index) {
20
+ effect(() => {
21
+ const list = notifications();
22
+ const rowHeight = 68;
23
+ list.forEach((notif, index) => {
28
24
  notif.layoutY.set(index * rowHeight);
29
25
  });
30
26
  });
31
- var notificationStyle = function(notif) {
32
- return {
33
- opacity: notif.opacity(),
34
- transform: "translateY(".concat(notif.layoutY() + notif.offset(), "px)")
35
- };
36
- };
27
+ const notificationStyle = (notif) => ({
28
+ opacity: notif.opacity(),
29
+ transform: `translateY(${notif.layoutY() + notif.offset()}px)`
30
+ });
37
31
  return h(DOMContainer, {
38
32
  width: "100%",
39
33
  height: "100%",
@@ -1 +1 @@
1
- {"version":3,"file":"notification.ce.js","names":[],"sources":["../../../../src/components/gui/notification/notification.ce"],"sourcesContent":["<DOMContainer width=\"100%\" height=\"100%\" zIndex={100} class=\"notification\">\n <div class=\"rpg-ui-notifications\">\n @for ((notif,index) of notifications) {\n <div\n class=\"rpg-ui-notification\"\n data-type={notif.type || \"info\"}\n style={notificationStyle(notif)}\n >\n @if (notif.icon) {\n <div class=\"rpg-ui-notification-icon\">\n <DOMSprite sheet={iconSheet(notif.icon)} />\n </div>\n }\n <div class=\"rpg-ui-notification-message\">{notif.message}</div>\n </div>\n }\n </div>\n</DOMContainer>\n\n<style>\n .notification {\n pointer-events: none !important;\n }\n</style>\n\n<script>\n import { effect, computed } from \"canvasengine\";\n import { inject } from \"../../../core/inject\";\n import { RpgClientEngine } from \"../../../RpgClientEngine\";\n\n const engine = inject(RpgClientEngine);\n const notifications = computed(() => engine.notificationManager.stack());\n\n const iconSheet = (iconId) => ({\n definition: engine.getSpriteSheet(iconId),\n playing: \"default\"\n });\n\n effect(() => {\n const list = notifications();\n const rowHeight = 68;\n list.forEach((notif, index) => {\n notif.layoutY.set(index * rowHeight);\n });\n });\n\n const notificationStyle = (notif) => ({\n opacity: notif.opacity(),\n transform: `translateY(${notif.layoutY() + notif.offset()}px)`\n });\n</script>\n"],"mappings":";;;;AAUA,IAAI,OAAO,aAAa,eAAW,CAAK,SAAE,eAAsB,2GAAE,EAAA;CAChE,MAAM,eAAc,SAAG,cAAA,QAAA;AACvB,cAAa,KAAC;AACd,cAAa,cAAa;AAC1B,UAAS,KAAG,YAAG,aAAA;;AAGf,SAAY,UAAA,SAAA;;AAER,gBAAA,QAAA;CACD,IAAA,SAAa,OAAA,gBAAA;CAClB,IAAI,gBAAY,SAAa,WAAU;AAAA,SAAA,OAAA,oBAAA,OAAA;GAAA;CACvC,IAAI,YAAA,SAAA,QAAA;AAAA,SAAA;GACF,YAAK,OAAA,eAAA,OAAA;;GAEN;;AACD,QAAI,WAAe;EACf,IAAA,OAAS,eAAiB;EAC1B,IAAA,YAAS;;AAET,SAAM,QAAS,IAAO,QAAA,UAAgB;IACtC;;CAEJ,IAAI,oBAAmB,SAAW,OAAC;AAAA,SAAA;GAC/B,SAAI,MAAW,SAAQ;GACvB,WAAW,cAAU,OAAA,MAAA,SAAA,GAAA,MAAA,QAAA,EAAA,MAAA;GACxB;;AAEG,QAAA,EAAA,cAAA"}
1
+ {"version":3,"file":"notification.ce.js","names":[],"sources":["../../../../src/components/gui/notification/notification.ce"],"sourcesContent":["<DOMContainer width=\"100%\" height=\"100%\" zIndex={100} class=\"notification\">\n <div class=\"rpg-ui-notifications\">\n @for ((notif,index) of notifications) {\n <div\n class=\"rpg-ui-notification\"\n data-type={notif.type || \"info\"}\n style={notificationStyle(notif)}\n >\n @if (notif.icon) {\n <div class=\"rpg-ui-notification-icon\">\n <DOMSprite sheet={iconSheet(notif.icon)} />\n </div>\n }\n <div class=\"rpg-ui-notification-message\">{notif.message}</div>\n </div>\n }\n </div>\n</DOMContainer>\n\n<style>\n .notification {\n pointer-events: none !important;\n }\n</style>\n\n<script>\n import { effect, computed } from \"canvasengine\";\n import { inject } from \"../../../core/inject\";\n import { RpgClientEngine } from \"../../../RpgClientEngine\";\n\n const engine = inject(RpgClientEngine);\n const notifications = computed(() => engine.notificationManager.stack());\n\n const iconSheet = (iconId) => ({\n definition: engine.getSpriteSheet(iconId),\n playing: \"default\"\n });\n\n effect(() => {\n const list = notifications();\n const rowHeight = 68;\n list.forEach((notif, index) => {\n notif.layoutY.set(index * rowHeight);\n });\n });\n\n const notificationStyle = (notif) => ({\n opacity: notif.opacity(),\n transform: `translateY(${notif.layoutY() + notif.offset()}px)`\n });\n</script>\n"],"mappings":";;;;AAUA,IAAI,OAAO,aAAa,eAAW,CAAK,SAAE,eAAsB,2GAAE,EAAA;CAChE,MAAM,eAAc,SAAG,cAAA,QAAA;AACvB,cAAa,KAAC;AACd,cAAa,cAAa;AAC1B,UAAS,KAAG,YAAG,aAAA;;AAGf,SAAY,UAAA,SAAA;;AAER,gBAAA,QAAA;CACD,MAAA,SAAa,OAAA,gBAAA;CAClB,MAAM,gBAAgB,eAAQ,OAAS,oBAAA,OAAA,CAAA;CACvC,MAAI,aAAA,YAAA;EACF,YAAK,OAAA,eAAA,OAAA;;EAEN;AACD,cAAa;EACT,MAAM,OAAG,eAAmB;EAC5B,MAAM,YAAG;;AAET,SAAM,QAAS,IAAO,QAAA,UAAgB;IACtC;;CAEJ,MAAI,qBAAmB,WAAY;EAC/B,SAAI,MAAW,SAAQ;EACvB,WAAW,cAAU,MAAA,SAAA,GAAA,MAAA,QAAA,CAAA;EACxB;AAEG,QAAA,EAAA,cAAA;;;;;;;;;;;;;;;;;;;;;;QAAa"}
@@ -8,274 +8,95 @@ import { PrebuiltGui } from "@rpgjs/common";
8
8
  function component($$props) {
9
9
  useProps($$props);
10
10
  const defineProps = useDefineProps($$props);
11
- var __awaiter = this && this.__awaiter || function(thisArg, _arguments, P, generator) {
12
- function adopt(value) {
13
- return value instanceof P ? value : new P(function(resolve) {
14
- resolve(value);
15
- });
16
- }
17
- return new (P || (P = Promise))(function(resolve, reject) {
18
- function fulfilled(value) {
19
- try {
20
- step(generator.next(value));
21
- } catch (e) {
22
- reject(e);
23
- }
24
- }
25
- function rejected(value) {
26
- try {
27
- step(generator["throw"](value));
28
- } catch (e) {
29
- reject(e);
30
- }
31
- }
32
- function step(result) {
33
- result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
34
- }
35
- step((generator = generator.apply(thisArg, _arguments || [])).next());
36
- });
37
- };
38
- var __generator = this && this.__generator || function(thisArg, body) {
39
- var _ = {
40
- label: 0,
41
- sent: function() {
42
- if (t[0] & 1) throw t[1];
43
- return t[1];
44
- },
45
- trys: [],
46
- ops: []
47
- }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
48
- return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() {
49
- return this;
50
- }), g;
51
- function verb(n) {
52
- return function(v) {
53
- return step([n, v]);
54
- };
55
- }
56
- function step(op) {
57
- if (f) throw new TypeError("Generator is already executing.");
58
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
59
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
60
- if (y = 0, t) op = [op[0] & 2, t.value];
61
- switch (op[0]) {
62
- case 0:
63
- case 1:
64
- t = op;
65
- break;
66
- case 4:
67
- _.label++;
68
- return {
69
- value: op[1],
70
- done: false
71
- };
72
- case 5:
73
- _.label++;
74
- y = op[1];
75
- op = [0];
76
- continue;
77
- case 7:
78
- op = _.ops.pop();
79
- _.trys.pop();
80
- continue;
81
- default:
82
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
83
- _ = 0;
84
- continue;
85
- }
86
- if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
87
- _.label = op[1];
88
- break;
89
- }
90
- if (op[0] === 6 && _.label < t[1]) {
91
- _.label = t[1];
92
- t = op;
93
- break;
94
- }
95
- if (t && _.label < t[2]) {
96
- _.label = t[2];
97
- _.ops.push(op);
98
- break;
99
- }
100
- if (t[2]) _.ops.pop();
101
- _.trys.pop();
102
- continue;
103
- }
104
- op = body.call(thisArg, _);
105
- } catch (e) {
106
- op = [6, e];
107
- y = 0;
108
- } finally {
109
- f = t = 0;
110
- }
111
- if (op[0] & 5) throw op[1];
112
- return {
113
- value: op[0] ? op[1] : void 0,
114
- done: true
115
- };
116
- }
117
- };
118
- var __spreadArray = this && this.__spreadArray || function(to, from, pack) {
119
- if (pack || arguments.length === 2) {
120
- for (var i = 0, l = from.length, ar; i < l; i++) if (ar || !(i in from)) {
121
- if (!ar) ar = Array.prototype.slice.call(from, 0, i);
122
- ar[i] = from[i];
123
- }
124
- }
125
- return to.concat(ar || Array.prototype.slice.call(from));
126
- };
127
- var engine = inject(RpgClientEngine);
128
- var saveClient = inject(SaveClientService);
129
- var gui = inject(RpgGui);
130
- var keyboardControls = engine.globalConfig.keyboardControls;
131
- var selectedSlot = signal(0);
132
- var DEFAULT_SLOTS = 4;
133
- var defaultSlots = function() {
134
- return Array.from({ length: DEFAULT_SLOTS }, function() {
135
- return null;
136
- });
137
- };
138
- var localSlots = signal(defaultSlots());
139
- var _a = defineProps(), data = _a.data, onFinish = _a.onFinish;
140
- var title = computed(function() {
141
- return data().mode === "save" ? "Save Game" : "Load Game";
142
- });
143
- var subtitle = computed(function() {
144
- return data().mode === "save" ? "Choose a slot to overwrite or create." : "Select a slot to load your progress.";
145
- });
146
- var slotsValue = computed(function() {
147
- return localSlots();
148
- });
149
- var displaySlots = computed(function() {
150
- var _a;
151
- var slots = slotsValue();
152
- var items = slots.map(function(slot, index) {
153
- return {
154
- kind: "slot",
155
- slot,
156
- slotIndex: index,
157
- label: "Slot ".concat(index + 1),
158
- readonly: false
159
- };
160
- });
11
+ const engine = inject(RpgClientEngine);
12
+ const saveClient = inject(SaveClientService);
13
+ const gui = inject(RpgGui);
14
+ const keyboardControls = engine.globalConfig.keyboardControls;
15
+ const selectedSlot = signal(0);
16
+ const DEFAULT_SLOTS = 4;
17
+ const defaultSlots = () => Array.from({ length: DEFAULT_SLOTS }, () => null);
18
+ const localSlots = signal(defaultSlots());
19
+ const { data, onFinish } = defineProps();
20
+ const title = computed(() => data().mode === "save" ? "Save Game" : "Load Game");
21
+ const subtitle = computed(() => data().mode === "save" ? "Choose a slot to overwrite or create." : "Select a slot to load your progress.");
22
+ const slotsValue = computed(() => localSlots());
23
+ const displaySlots = computed(() => {
24
+ const slots = slotsValue();
25
+ const items = slots.map((slot, index) => ({
26
+ kind: "slot",
27
+ slot,
28
+ slotIndex: index,
29
+ label: `Slot ${index + 1}`,
30
+ readonly: false
31
+ }));
161
32
  if (!data().showAutoSlot) return items;
162
- var index = typeof data().autoSlotIndex === "number" ? data().autoSlotIndex : 0;
163
- var autoSlot = (_a = slots[index]) !== null && _a !== void 0 ? _a : null;
164
- var readonly = data().mode === "save";
165
- return __spreadArray([{
33
+ const index = typeof data().autoSlotIndex === "number" ? data().autoSlotIndex : 0;
34
+ const autoSlot = slots[index] ?? null;
35
+ const readonly = data().mode === "save";
36
+ return [{
166
37
  kind: "auto",
167
38
  slot: autoSlot,
168
39
  slotIndex: index,
169
40
  label: data().autoSlotLabel || "Auto Save",
170
41
  readonly
171
- }], items, true);
42
+ }, ...items];
172
43
  });
173
- var nav = createTabindexNavigator(selectedSlot, { count: function() {
174
- return displaySlots().length;
175
- } }, "wrap");
176
- var canSelect = function(item) {
44
+ const nav = createTabindexNavigator(selectedSlot, { count: () => displaySlots().length }, "wrap");
45
+ const canSelect = (item) => {
177
46
  if (item.readonly) return false;
178
47
  if (data().mode === "load" && !item.slot) return false;
179
48
  return true;
180
49
  };
181
- var normalizeSlotValue = function(value) {
50
+ const normalizeSlotValue = (value) => {
182
51
  if (!value) return null;
183
52
  if (typeof value === "string") try {
184
53
  return JSON.parse(value);
185
- } catch (_a) {
54
+ } catch {
186
55
  return null;
187
56
  }
188
57
  return value;
189
58
  };
190
- var normalizeSlots = function(list) {
59
+ const normalizeSlots = (list) => {
191
60
  if (Array.isArray(list)) {
192
- var length_1 = Math.max(list.length, DEFAULT_SLOTS);
193
- return Array.from({ length: length_1 }, function(_, index) {
194
- return normalizeSlotValue(list[index]);
195
- });
61
+ const length = Math.max(list.length, DEFAULT_SLOTS);
62
+ return Array.from({ length }, (_, index) => normalizeSlotValue(list[index]));
196
63
  }
197
64
  if (!list || typeof list !== "object") return defaultSlots();
198
- var keys = Object.keys(list).filter(function(key) {
199
- return /^\d+$/.test(key);
200
- });
201
- var indices = keys.map(function(key) {
202
- return Number(key);
203
- }).filter(function(index) {
204
- return index >= 0;
205
- });
206
- var maxIndex = indices.length ? Math.max.apply(Math, indices) : -1;
207
- var length = Math.max(maxIndex + 1, DEFAULT_SLOTS);
208
- var slots = Array.from({ length }, function() {
209
- return null;
210
- });
211
- keys.forEach(function(key) {
212
- var index = Number(key);
65
+ const keys = Object.keys(list).filter((key) => /^\d+$/.test(key));
66
+ const indices = keys.map((key) => Number(key)).filter((index) => index >= 0);
67
+ const maxIndex = indices.length ? Math.max(...indices) : -1;
68
+ const length = Math.max(maxIndex + 1, DEFAULT_SLOTS);
69
+ const slots = Array.from({ length }, () => null);
70
+ keys.forEach((key) => {
71
+ const index = Number(key);
213
72
  if (index < 0 || index >= length) return;
214
73
  slots[index] = normalizeSlotValue(list[key]);
215
74
  });
216
75
  return slots;
217
76
  };
218
- var refreshSlots = function() {
219
- return __awaiter(void 0, void 0, void 0, function() {
220
- var list;
221
- return __generator(this, function(_a) {
222
- switch (_a.label) {
223
- case 0:
224
- _a.trys.push([
225
- 0,
226
- 2,
227
- ,
228
- 3
229
- ]);
230
- return [4, saveClient.listSlots()];
231
- case 1:
232
- list = _a.sent();
233
- localSlots.set(normalizeSlots(list));
234
- return [3, 3];
235
- case 2:
236
- _a.sent();
237
- localSlots.set(defaultSlots());
238
- return [3, 3];
239
- case 3: return [2];
240
- }
241
- });
242
- });
77
+ const refreshSlots = async () => {
78
+ try {
79
+ const list = await saveClient.listSlots();
80
+ localSlots.set(normalizeSlots(list));
81
+ } catch (err) {
82
+ localSlots.set(defaultSlots());
83
+ }
243
84
  };
244
- var triggerSelect = function(displayIndex) {
245
- return __awaiter(void 0, void 0, void 0, function() {
246
- var list, item, action;
247
- return __generator(this, function(_a) {
248
- switch (_a.label) {
249
- case 0:
250
- list = displaySlots();
251
- item = list[displayIndex];
252
- if (!item) return [2];
253
- if (!canSelect(item)) return [2];
254
- action = data().mode === "save" ? "save" : "load";
255
- if (!(action === "save")) return [3, 3];
256
- return [4, saveClient.saveSlot(item.slotIndex)];
257
- case 1:
258
- _a.sent();
259
- return [4, refreshSlots()];
260
- case 2:
261
- _a.sent();
262
- _a.label = 3;
263
- case 3:
264
- if (!(action === "load")) return [3, 5];
265
- return [4, saveClient.loadSlot(item.slotIndex)];
266
- case 4:
267
- _a.sent();
268
- _a.label = 5;
269
- case 5:
270
- setTimeout(function() {
271
- if (onFinish) onFinish();
272
- gui.hide(PrebuiltGui.Save);
273
- gui.hide(PrebuiltGui.TitleScreen);
274
- }, 50);
275
- return [2];
276
- }
277
- });
278
- });
85
+ const triggerSelect = async (displayIndex) => {
86
+ const item = displaySlots()[displayIndex];
87
+ if (!item) return;
88
+ if (!canSelect(item)) return;
89
+ const action = data().mode === "save" ? "save" : "load";
90
+ if (action === "save") {
91
+ await saveClient.saveSlot(item.slotIndex);
92
+ await refreshSlots();
93
+ }
94
+ if (action === "load") await saveClient.loadSlot(item.slotIndex);
95
+ setTimeout(() => {
96
+ if (onFinish) onFinish();
97
+ gui.hide(PrebuiltGui.Save);
98
+ gui.hide(PrebuiltGui.TitleScreen);
99
+ }, 50);
279
100
  };
280
101
  function selectSlot(index) {
281
102
  return function() {
@@ -283,12 +104,12 @@ function component($$props) {
283
104
  triggerSelect(index);
284
105
  };
285
106
  }
286
- var controls = signal({
107
+ const controls = signal({
287
108
  up: {
288
109
  repeat: true,
289
110
  bind: keyboardControls.up,
290
111
  throttle: 150,
291
- keyDown: function() {
112
+ keyDown() {
292
113
  nav.next(-1);
293
114
  }
294
115
  },
@@ -296,26 +117,26 @@ function component($$props) {
296
117
  repeat: true,
297
118
  bind: keyboardControls.down,
298
119
  throttle: 150,
299
- keyDown: function() {
120
+ keyDown() {
300
121
  nav.next(1);
301
122
  }
302
123
  },
303
124
  action: {
304
125
  bind: keyboardControls.action,
305
- keyDown: function() {
126
+ keyDown() {
306
127
  triggerSelect(selectedSlot());
307
128
  }
308
129
  },
309
130
  escape: {
310
131
  bind: keyboardControls.escape,
311
- keyDown: function() {
132
+ keyDown() {
312
133
  if (onFinish) onFinish();
313
134
  gui.hide(PrebuiltGui.Save);
314
135
  }
315
136
  },
316
137
  gamepad: { enabled: true }
317
138
  });
318
- mount(function(element) {
139
+ mount((element) => {
319
140
  refreshSlots();
320
141
  });
321
142
  return h(DOMContainer, {