@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.
- package/dist/Game/Map.js +2 -2
- package/dist/Game/Object.d.ts +10 -2
- package/dist/Game/Object.js +56 -26
- package/dist/Game/Object.js.map +1 -1
- package/dist/Gui/Gui.js.map +1 -1
- package/dist/Gui/NotificationManager.js.map +1 -1
- package/dist/RpgClientEngine.d.ts +16 -0
- package/dist/RpgClientEngine.js +53 -6
- package/dist/RpgClientEngine.js.map +1 -1
- package/dist/Sound.js.map +1 -1
- package/dist/_virtual/{_@oxc-project_runtime@0.122.0 → _@oxc-project_runtime@0.127.0}/helpers/decorate.js +1 -1
- package/dist/_virtual/{_@oxc-project_runtime@0.122.0 → _@oxc-project_runtime@0.127.0}/helpers/decorateMetadata.js +1 -1
- package/dist/components/animations/animation.ce.js +2 -4
- package/dist/components/animations/animation.ce.js.map +1 -1
- package/dist/components/animations/hit.ce.js +17 -24
- package/dist/components/animations/hit.ce.js.map +1 -1
- package/dist/components/character.ce.js +75 -222
- package/dist/components/character.ce.js.map +1 -1
- package/dist/components/dynamics/text.ce.js +14 -25
- package/dist/components/dynamics/text.ce.js.map +1 -1
- package/dist/components/gui/box.ce.js +4 -7
- package/dist/components/gui/box.ce.js.map +1 -1
- package/dist/components/gui/dialogbox/index.ce.js +37 -54
- package/dist/components/gui/dialogbox/index.ce.js.map +1 -1
- package/dist/components/gui/gameover.ce.js +36 -61
- package/dist/components/gui/gameover.ce.js.map +1 -1
- package/dist/components/gui/hud/hud.ce.js +18 -28
- package/dist/components/gui/hud/hud.ce.js.map +1 -1
- package/dist/components/gui/menu/equip-menu.ce.js +108 -163
- package/dist/components/gui/menu/equip-menu.ce.js.map +1 -1
- package/dist/components/gui/menu/exit-menu.ce.js +4 -4
- package/dist/components/gui/menu/exit-menu.ce.js.map +1 -1
- package/dist/components/gui/menu/items-menu.ce.js +47 -66
- package/dist/components/gui/menu/items-menu.ce.js.map +1 -1
- package/dist/components/gui/menu/main-menu.ce.js +58 -77
- package/dist/components/gui/menu/main-menu.ce.js.map +1 -1
- package/dist/components/gui/menu/options-menu.ce.js +3 -3
- package/dist/components/gui/menu/options-menu.ce.js.map +1 -1
- package/dist/components/gui/menu/skills-menu.ce.js +10 -16
- package/dist/components/gui/menu/skills-menu.ce.js.map +1 -1
- package/dist/components/gui/mobile/mobile.ce.js +3 -3
- package/dist/components/gui/mobile/mobile.ce.js.map +1 -1
- package/dist/components/gui/notification/notification.ce.js +13 -19
- package/dist/components/gui/notification/notification.ce.js.map +1 -1
- package/dist/components/gui/save-load.ce.js +68 -247
- package/dist/components/gui/save-load.ce.js.map +1 -1
- package/dist/components/gui/shop/shop.ce.js +84 -123
- package/dist/components/gui/shop/shop.ce.js.map +1 -1
- package/dist/components/gui/title-screen.ce.js +38 -65
- package/dist/components/gui/title-screen.ce.js.map +1 -1
- package/dist/components/prebuilt/hp-bar.ce.js +39 -43
- package/dist/components/prebuilt/hp-bar.ce.js.map +1 -1
- package/dist/components/prebuilt/light-halo.ce.js +33 -58
- package/dist/components/prebuilt/light-halo.ce.js.map +1 -1
- package/dist/components/scenes/canvas.ce.js +11 -19
- package/dist/components/scenes/canvas.ce.js.map +1 -1
- package/dist/components/scenes/draw-map.ce.js +20 -25
- package/dist/components/scenes/draw-map.ce.js.map +1 -1
- package/dist/components/scenes/event-layer.ce.js +4 -4
- package/dist/components/scenes/event-layer.ce.js.map +1 -1
- package/dist/core/setup.js.map +1 -1
- package/dist/module.js.map +1 -1
- package/dist/node_modules/.pnpm/@signe_di@2.9.0/node_modules/@signe/di/dist/index.js.map +1 -1
- package/dist/node_modules/.pnpm/@signe_reactive@2.9.0/node_modules/@signe/reactive/dist/index.js +1 -1
- package/dist/node_modules/.pnpm/@signe_reactive@2.9.0/node_modules/@signe/reactive/dist/index.js.map +1 -1
- package/dist/node_modules/.pnpm/@signe_room@2.9.0/node_modules/@signe/room/dist/index.js +1 -1
- package/dist/node_modules/.pnpm/@signe_room@2.9.0/node_modules/@signe/room/dist/index.js.map +1 -1
- package/dist/node_modules/.pnpm/@signe_sync@2.9.0/node_modules/@signe/sync/dist/client/index.js.map +1 -1
- package/dist/node_modules/.pnpm/@signe_sync@2.9.0/node_modules/@signe/sync/dist/index.js.map +1 -1
- package/dist/node_modules/.pnpm/partysocket@1.1.3/node_modules/partysocket/dist/chunk-S74YV6PU.js.map +1 -1
- package/dist/node_modules/.pnpm/zod@3.24.2/node_modules/zod/lib/index.js +27 -27
- package/dist/node_modules/.pnpm/zod@3.24.2/node_modules/zod/lib/index.js.map +1 -1
- package/dist/services/keyboardControls.js.map +1 -1
- package/dist/services/mmorpg.js +2 -1
- package/dist/services/mmorpg.js.map +1 -1
- package/package.json +7 -7
- package/src/Game/Object.ts +86 -32
- package/src/RpgClientEngine.ts +83 -12
- package/dist/node_modules/.pnpm/@signe_reactive@2.8.3/node_modules/@signe/reactive/dist/index.js +0 -457
- 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
|
-
|
|
9
|
-
|
|
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
|
|
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;
|
|
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
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
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
|
-
|
|
19
|
+
const controls = signal({
|
|
26
20
|
up: {
|
|
27
21
|
repeat: true,
|
|
28
22
|
bind: keyboardControls.up,
|
|
29
23
|
throttle: 150,
|
|
30
|
-
keyDown
|
|
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
|
|
32
|
+
keyDown() {
|
|
39
33
|
nav.next(1);
|
|
40
34
|
}
|
|
41
35
|
},
|
|
42
36
|
escape: {
|
|
43
37
|
bind: keyboardControls.escape,
|
|
44
|
-
keyDown
|
|
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,
|
|
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
|
-
|
|
8
|
-
mount(
|
|
9
|
-
|
|
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,
|
|
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
|
-
|
|
15
|
-
|
|
16
|
-
|
|
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
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
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
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
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,
|
|
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
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
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
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
return
|
|
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
|
-
}
|
|
42
|
+
}, ...items];
|
|
172
43
|
});
|
|
173
|
-
|
|
174
|
-
|
|
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
|
-
|
|
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
|
|
54
|
+
} catch {
|
|
186
55
|
return null;
|
|
187
56
|
}
|
|
188
57
|
return value;
|
|
189
58
|
};
|
|
190
|
-
|
|
59
|
+
const normalizeSlots = (list) => {
|
|
191
60
|
if (Array.isArray(list)) {
|
|
192
|
-
|
|
193
|
-
return Array.from({ length
|
|
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
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
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
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
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
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
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
|
-
|
|
107
|
+
const controls = signal({
|
|
287
108
|
up: {
|
|
288
109
|
repeat: true,
|
|
289
110
|
bind: keyboardControls.up,
|
|
290
111
|
throttle: 150,
|
|
291
|
-
keyDown
|
|
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
|
|
120
|
+
keyDown() {
|
|
300
121
|
nav.next(1);
|
|
301
122
|
}
|
|
302
123
|
},
|
|
303
124
|
action: {
|
|
304
125
|
bind: keyboardControls.action,
|
|
305
|
-
keyDown
|
|
126
|
+
keyDown() {
|
|
306
127
|
triggerSelect(selectedSlot());
|
|
307
128
|
}
|
|
308
129
|
},
|
|
309
130
|
escape: {
|
|
310
131
|
bind: keyboardControls.escape,
|
|
311
|
-
keyDown
|
|
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(
|
|
139
|
+
mount((element) => {
|
|
319
140
|
refreshSlots();
|
|
320
141
|
});
|
|
321
142
|
return h(DOMContainer, {
|