@rpgjs/client 5.0.0-beta.2 → 5.0.0-beta.22
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/CHANGELOG.md +130 -0
- package/dist/Game/AnimationManager.d.ts +2 -1
- package/dist/Game/AnimationManager.js +21 -9
- package/dist/Game/AnimationManager.js.map +1 -1
- package/dist/Game/AnimationManager.spec.d.ts +1 -0
- package/dist/Game/ClientVisuals.d.ts +61 -0
- package/dist/Game/ClientVisuals.js +96 -0
- package/dist/Game/ClientVisuals.js.map +1 -0
- package/dist/Game/ClientVisuals.spec.d.ts +1 -0
- package/dist/Game/Event.js.map +1 -1
- package/dist/Game/EventComponentResolver.d.ts +16 -0
- package/dist/Game/EventComponentResolver.js +52 -0
- package/dist/Game/EventComponentResolver.js.map +1 -0
- package/dist/Game/EventComponentResolver.spec.d.ts +1 -0
- package/dist/Game/Map.d.ts +9 -1
- package/dist/Game/Map.js +83 -5
- package/dist/Game/Map.js.map +1 -1
- package/dist/Game/Object.d.ts +49 -15
- package/dist/Game/Object.js +101 -42
- package/dist/Game/Object.js.map +1 -1
- package/dist/Game/Object.spec.d.ts +1 -0
- package/dist/Game/Player.js.map +1 -1
- package/dist/Game/ProjectileManager.d.ts +98 -0
- package/dist/Game/ProjectileManager.js +196 -0
- package/dist/Game/ProjectileManager.js.map +1 -0
- package/dist/Game/ProjectileManager.spec.d.ts +1 -0
- package/dist/Gui/Gui.d.ts +20 -6
- package/dist/Gui/Gui.js +132 -57
- package/dist/Gui/Gui.js.map +1 -1
- package/dist/Gui/Gui.spec.d.ts +1 -0
- package/dist/Gui/NotificationManager.js.map +1 -1
- package/dist/Resource.js +1 -1
- package/dist/Resource.js.map +1 -1
- package/dist/RpgClient.d.ts +194 -15
- package/dist/RpgClientEngine.d.ts +191 -19
- package/dist/RpgClientEngine.js +693 -74
- package/dist/RpgClientEngine.js.map +1 -1
- package/dist/Sound.js.map +1 -1
- package/dist/_virtual/{_@oxc-project_runtime@0.122.0/helpers → _@oxc-project_runtime@0.133.0/helpers/esm}/decorate.js +1 -1
- package/dist/_virtual/{_@oxc-project_runtime@0.122.0/helpers → _@oxc-project_runtime@0.133.0/helpers/esm}/decorateMetadata.js +1 -1
- package/dist/_virtual/_rolldown/runtime.js +13 -0
- package/dist/components/animations/animation.ce.js +6 -5
- package/dist/components/animations/animation.ce.js.map +1 -1
- package/dist/components/animations/fx.ce.js +60 -0
- package/dist/components/animations/fx.ce.js.map +1 -0
- package/dist/components/animations/hit.ce.js +24 -28
- package/dist/components/animations/hit.ce.js.map +1 -1
- package/dist/components/animations/index.d.ts +1 -0
- package/dist/components/animations/index.js +6 -4
- package/dist/components/animations/index.js.map +1 -1
- package/dist/components/character.ce.js +748 -249
- package/dist/components/character.ce.js.map +1 -1
- package/dist/components/dynamics/bar.ce.js +99 -0
- package/dist/components/dynamics/bar.ce.js.map +1 -0
- package/dist/components/dynamics/image.ce.js +26 -0
- package/dist/components/dynamics/image.ce.js.map +1 -0
- package/dist/components/dynamics/parse-value.d.ts +3 -0
- package/dist/components/dynamics/parse-value.js +54 -35
- package/dist/components/dynamics/parse-value.js.map +1 -1
- package/dist/components/dynamics/parse-value.spec.d.ts +1 -0
- package/dist/components/dynamics/shape-utils.d.ts +16 -0
- package/dist/components/dynamics/shape-utils.js +73 -0
- package/dist/components/dynamics/shape-utils.js.map +1 -0
- package/dist/components/dynamics/shape-utils.spec.d.ts +1 -0
- package/dist/components/dynamics/shape.ce.js +86 -0
- package/dist/components/dynamics/shape.ce.js.map +1 -0
- package/dist/components/dynamics/text.ce.js +36 -56
- package/dist/components/dynamics/text.ce.js.map +1 -1
- package/dist/components/gui/box.ce.js +9 -9
- package/dist/components/gui/box.ce.js.map +1 -1
- package/dist/components/gui/dialogbox/index.ce.js +75 -65
- package/dist/components/gui/dialogbox/index.ce.js.map +1 -1
- package/dist/components/gui/gameover.ce.js +47 -68
- package/dist/components/gui/gameover.ce.js.map +1 -1
- package/dist/components/gui/hud/hud.ce.js +23 -31
- package/dist/components/gui/hud/hud.ce.js.map +1 -1
- package/dist/components/gui/menu/equip-menu.ce.js +121 -172
- package/dist/components/gui/menu/equip-menu.ce.js.map +1 -1
- package/dist/components/gui/menu/exit-menu.ce.js +15 -10
- package/dist/components/gui/menu/exit-menu.ce.js.map +1 -1
- package/dist/components/gui/menu/items-menu.ce.js +62 -77
- package/dist/components/gui/menu/items-menu.ce.js.map +1 -1
- package/dist/components/gui/menu/main-menu.ce.js +89 -104
- package/dist/components/gui/menu/main-menu.ce.js.map +1 -1
- package/dist/components/gui/menu/options-menu.ce.js +12 -8
- package/dist/components/gui/menu/options-menu.ce.js.map +1 -1
- package/dist/components/gui/menu/skills-menu.ce.js +17 -19
- package/dist/components/gui/menu/skills-menu.ce.js.map +1 -1
- package/dist/components/gui/mobile/index.d.ts +51 -2
- package/dist/components/gui/mobile/index.js +14 -6
- package/dist/components/gui/mobile/index.js.map +1 -1
- package/dist/components/gui/mobile/index.spec.d.ts +1 -0
- package/dist/components/gui/mobile/mobile.ce.js +309 -59
- package/dist/components/gui/mobile/mobile.ce.js.map +1 -1
- package/dist/components/gui/notification/notification.ce.js +28 -26
- package/dist/components/gui/notification/notification.ce.js.map +1 -1
- package/dist/components/gui/save-load.ce.js +81 -256
- package/dist/components/gui/save-load.ce.js.map +1 -1
- package/dist/components/gui/shop/shop.ce.js +107 -142
- package/dist/components/gui/shop/shop.ce.js.map +1 -1
- package/dist/components/gui/title-screen.ce.js +50 -73
- package/dist/components/gui/title-screen.ce.js.map +1 -1
- package/dist/components/index.d.ts +2 -1
- package/dist/components/index.js +1 -0
- package/dist/components/interaction-components.ce.js +22 -0
- package/dist/components/interaction-components.ce.js.map +1 -0
- package/dist/components/player-components-utils.d.ts +67 -0
- package/dist/components/player-components-utils.js +162 -0
- package/dist/components/player-components-utils.js.map +1 -0
- package/dist/components/player-components-utils.spec.d.ts +1 -0
- package/dist/components/player-components.ce.js +191 -0
- package/dist/components/player-components.ce.js.map +1 -0
- package/dist/components/prebuilt/hp-bar.ce.js +45 -45
- package/dist/components/prebuilt/hp-bar.ce.js.map +1 -1
- package/dist/components/prebuilt/light-halo.ce.js +39 -60
- package/dist/components/prebuilt/light-halo.ce.js.map +1 -1
- package/dist/components/scenes/canvas.ce.js +205 -27
- package/dist/components/scenes/canvas.ce.js.map +1 -1
- package/dist/components/scenes/draw-map.ce.js +39 -39
- package/dist/components/scenes/draw-map.ce.js.map +1 -1
- package/dist/components/scenes/event-layer.ce.js +51 -10
- package/dist/components/scenes/event-layer.ce.js.map +1 -1
- package/dist/core/inject.js +1 -1
- package/dist/core/inject.js.map +1 -1
- package/dist/core/setup.js +1 -1
- package/dist/core/setup.js.map +1 -1
- package/dist/decorators/spritesheet.d.ts +1 -0
- package/dist/decorators/spritesheet.js +11 -0
- package/dist/decorators/spritesheet.js.map +1 -0
- package/dist/i18n.d.ts +55 -0
- package/dist/i18n.js +60 -0
- package/dist/i18n.js.map +1 -0
- package/dist/i18n.spec.d.ts +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +29 -21
- package/dist/module.js +45 -4
- package/dist/module.js.map +1 -1
- package/dist/node_modules/.pnpm/{@signe_di@2.9.0 → @signe_di@3.1.0}/node_modules/@signe/di/dist/index.js +7 -117
- package/dist/node_modules/.pnpm/@signe_di@3.1.0/node_modules/@signe/di/dist/index.js.map +1 -0
- package/dist/node_modules/.pnpm/@signe_reactive@3.1.0/node_modules/@signe/reactive/dist/index.js +239 -0
- package/dist/node_modules/.pnpm/@signe_reactive@3.1.0/node_modules/@signe/reactive/dist/index.js.map +1 -0
- package/dist/node_modules/.pnpm/@signe_room@3.1.0_react@19.2.7/node_modules/@signe/room/dist/chunk-EUXUH3YW.js +13 -0
- package/dist/node_modules/.pnpm/@signe_room@3.1.0_react@19.2.7/node_modules/@signe/room/dist/chunk-EUXUH3YW.js.map +1 -0
- package/dist/node_modules/.pnpm/@signe_room@3.1.0_react@19.2.7/node_modules/@signe/room/dist/index.js +698 -0
- package/dist/node_modules/.pnpm/@signe_room@3.1.0_react@19.2.7/node_modules/@signe/room/dist/index.js.map +1 -0
- package/dist/node_modules/.pnpm/@signe_sync@3.1.0_react@19.2.7/node_modules/@signe/sync/dist/client/index.js +43 -0
- package/dist/node_modules/.pnpm/@signe_sync@3.1.0_react@19.2.7/node_modules/@signe/sync/dist/client/index.js.map +1 -0
- package/dist/node_modules/.pnpm/{@signe_sync@2.9.0 → @signe_sync@3.1.0_react@19.2.7}/node_modules/@signe/sync/dist/index.js +57 -141
- package/dist/node_modules/.pnpm/@signe_sync@3.1.0_react@19.2.7/node_modules/@signe/sync/dist/index.js.map +1 -0
- package/dist/node_modules/.pnpm/{partysocket@1.1.3/node_modules/partysocket/dist/chunk-HAC622V3.js → partysocket@1.2.0_react@19.2.7/node_modules/partysocket/dist/index.js} +30 -17
- package/dist/node_modules/.pnpm/partysocket@1.2.0_react@19.2.7/node_modules/partysocket/dist/index.js.map +1 -0
- package/dist/node_modules/.pnpm/{partysocket@1.1.3/node_modules/partysocket/dist/chunk-S74YV6PU.js → partysocket@1.2.0_react@19.2.7/node_modules/partysocket/dist/ws.js} +65 -34
- package/dist/node_modules/.pnpm/partysocket@1.2.0_react@19.2.7/node_modules/partysocket/dist/ws.js.map +1 -0
- package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/index.js +13 -0
- package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/index.js.map +1 -0
- package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/ZodError.js +106 -0
- package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/ZodError.js.map +1 -0
- package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/errors.js +13 -0
- package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/errors.js.map +1 -0
- package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/external.js +121 -0
- package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/external.js.map +1 -0
- package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/errorUtil.js +10 -0
- package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/errorUtil.js.map +1 -0
- package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/parseUtil.js +110 -0
- package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/parseUtil.js.map +1 -0
- package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/util.js +99 -0
- package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/util.js.map +1 -0
- package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/locales/en.js +82 -0
- package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/locales/en.js.map +1 -0
- package/dist/node_modules/.pnpm/{zod@3.24.2/node_modules/zod/lib/index.js → zod@3.25.76/node_modules/zod/v3/types.js} +74 -611
- package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/types.js.map +1 -0
- package/dist/presets/animation.js.map +1 -1
- package/dist/presets/faceset.js.map +1 -1
- package/dist/presets/icon.js.map +1 -1
- package/dist/presets/index.js.map +1 -1
- package/dist/presets/lpc.js.map +1 -1
- package/dist/presets/rmspritesheet.js.map +1 -1
- package/dist/services/AbstractSocket.d.ts +2 -0
- package/dist/services/AbstractSocket.js.map +1 -1
- package/dist/services/actionInput.d.ts +14 -0
- package/dist/services/actionInput.js +59 -0
- package/dist/services/actionInput.js.map +1 -0
- package/dist/services/actionInput.spec.d.ts +1 -0
- package/dist/services/cameraFollow.d.ts +51 -0
- package/dist/services/cameraFollow.js +134 -0
- package/dist/services/cameraFollow.js.map +1 -0
- package/dist/services/cameraFollow.spec.d.ts +1 -0
- package/dist/services/interactions.d.ts +159 -0
- package/dist/services/interactions.js +460 -0
- package/dist/services/interactions.js.map +1 -0
- package/dist/services/interactions.spec.d.ts +1 -0
- package/dist/services/keyboardControls.d.ts +1 -0
- package/dist/services/keyboardControls.js +1 -0
- package/dist/services/keyboardControls.js.map +1 -1
- package/dist/services/loadMap.d.ts +9 -0
- package/dist/services/loadMap.js +1 -1
- package/dist/services/loadMap.js.map +1 -1
- package/dist/services/mmorpg-connection.d.ts +5 -0
- package/dist/services/mmorpg-connection.js +50 -0
- package/dist/services/mmorpg-connection.js.map +1 -0
- package/dist/services/mmorpg-connection.spec.d.ts +1 -0
- package/dist/services/mmorpg.d.ts +11 -4
- package/dist/services/mmorpg.js +57 -33
- package/dist/services/mmorpg.js.map +1 -1
- package/dist/services/pointerContext.d.ts +11 -0
- package/dist/services/pointerContext.js +48 -0
- package/dist/services/pointerContext.js.map +1 -0
- package/dist/services/pointerContext.spec.d.ts +1 -0
- package/dist/services/save.js.map +1 -1
- package/dist/services/save.spec.d.ts +1 -0
- package/dist/services/standalone-message.d.ts +1 -0
- package/dist/services/standalone-message.js +9 -0
- package/dist/services/standalone-message.js.map +1 -0
- package/dist/services/standalone.d.ts +4 -1
- package/dist/services/standalone.js +36 -16
- package/dist/services/standalone.js.map +1 -1
- package/dist/services/standalone.spec.d.ts +1 -0
- package/dist/utils/getEntityProp.js +4 -3
- package/dist/utils/getEntityProp.js.map +1 -1
- package/dist/utils/getEntityProp.spec.d.ts +1 -0
- package/dist/utils/mapId.d.ts +1 -0
- package/dist/utils/mapId.js +6 -0
- package/dist/utils/mapId.js.map +1 -0
- package/dist/utils/readPropValue.d.ts +2 -0
- package/dist/utils/readPropValue.js +13 -0
- package/dist/utils/readPropValue.js.map +1 -0
- package/package.json +13 -13
- package/src/Game/AnimationManager.spec.ts +30 -0
- package/src/Game/AnimationManager.ts +26 -10
- package/src/Game/ClientVisuals.spec.ts +56 -0
- package/src/Game/ClientVisuals.ts +184 -0
- package/src/Game/EventComponentResolver.spec.ts +84 -0
- package/src/Game/EventComponentResolver.ts +74 -0
- package/src/Game/Map.ts +134 -2
- package/src/Game/Object.spec.ts +59 -0
- package/src/Game/Object.ts +181 -77
- package/src/Game/ProjectileManager.spec.ts +449 -0
- package/src/Game/ProjectileManager.ts +346 -0
- package/src/Gui/Gui.spec.ts +359 -0
- package/src/Gui/Gui.ts +178 -67
- package/src/Resource.ts +1 -2
- package/src/RpgClient.ts +220 -17
- package/src/RpgClientEngine.ts +995 -133
- package/src/components/animations/fx.ce +101 -0
- package/src/components/animations/index.ts +4 -2
- package/src/components/character.ce +839 -45
- package/src/components/dynamics/bar.ce +88 -0
- package/src/components/dynamics/image.ce +21 -0
- package/src/components/dynamics/parse-value.spec.ts +83 -0
- package/src/components/dynamics/parse-value.ts +111 -37
- package/src/components/dynamics/shape-utils.spec.ts +46 -0
- package/src/components/dynamics/shape-utils.ts +61 -0
- package/src/components/dynamics/shape.ce +90 -0
- package/src/components/dynamics/text.ce +35 -149
- package/src/components/gui/dialogbox/index.ce +52 -21
- package/src/components/gui/gameover.ce +6 -4
- package/src/components/gui/menu/equip-menu.ce +11 -9
- package/src/components/gui/menu/exit-menu.ce +6 -4
- package/src/components/gui/menu/items-menu.ce +11 -9
- package/src/components/gui/menu/main-menu.ce +14 -12
- package/src/components/gui/menu/options-menu.ce +4 -3
- package/src/components/gui/menu/skills-menu.ce +2 -1
- package/src/components/gui/mobile/index.spec.ts +94 -0
- package/src/components/gui/mobile/index.ts +74 -6
- package/src/components/gui/mobile/mobile.ce +347 -65
- package/src/components/gui/notification/notification.ce +7 -1
- package/src/components/gui/save-load.ce +13 -11
- package/src/components/gui/shop/shop.ce +20 -18
- package/src/components/gui/title-screen.ce +6 -4
- package/src/components/index.ts +2 -1
- package/src/components/interaction-components.ce +23 -0
- package/src/components/player-components-utils.spec.ts +109 -0
- package/src/components/player-components-utils.ts +205 -0
- package/src/components/player-components.ce +222 -0
- package/src/components/prebuilt/hp-bar.ce +4 -3
- package/src/components/prebuilt/light-halo.ce +2 -2
- package/src/components/scenes/canvas.ce +219 -15
- package/src/components/scenes/draw-map.ce +34 -22
- package/src/components/scenes/event-layer.ce +55 -4
- package/src/core/setup.ts +2 -2
- package/src/decorators/spritesheet.ts +8 -0
- package/src/i18n.spec.ts +39 -0
- package/src/i18n.ts +59 -0
- package/src/index.ts +19 -0
- package/src/module.ts +61 -11
- package/src/services/AbstractSocket.ts +3 -0
- package/src/services/actionInput.spec.ts +155 -0
- package/src/services/actionInput.ts +120 -0
- package/src/services/cameraFollow.spec.ts +220 -0
- package/src/services/cameraFollow.ts +222 -0
- package/src/services/interactions.spec.ts +175 -0
- package/src/services/interactions.ts +722 -0
- package/src/services/keyboardControls.ts +2 -1
- package/src/services/loadMap.ts +5 -1
- package/src/services/mmorpg-connection.spec.ts +99 -0
- package/src/services/mmorpg-connection.ts +69 -0
- package/src/services/mmorpg.ts +70 -36
- package/src/services/pointerContext.spec.ts +36 -0
- package/src/services/pointerContext.ts +84 -0
- package/src/services/save.spec.ts +127 -0
- package/src/services/standalone-message.ts +7 -0
- package/src/services/standalone.spec.ts +54 -0
- package/src/services/standalone.ts +44 -12
- package/src/utils/getEntityProp.spec.ts +96 -0
- package/src/utils/getEntityProp.ts +4 -3
- package/src/utils/mapId.ts +2 -0
- package/src/utils/readPropValue.ts +16 -0
- package/dist/node_modules/.pnpm/@signe_di@2.9.0/node_modules/@signe/di/dist/index.js.map +0 -1
- 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
- package/dist/node_modules/.pnpm/@signe_reactive@2.9.0/node_modules/@signe/reactive/dist/index.js +0 -463
- package/dist/node_modules/.pnpm/@signe_reactive@2.9.0/node_modules/@signe/reactive/dist/index.js.map +0 -1
- package/dist/node_modules/.pnpm/@signe_room@2.9.0/node_modules/@signe/room/dist/index.js +0 -2191
- package/dist/node_modules/.pnpm/@signe_room@2.9.0/node_modules/@signe/room/dist/index.js.map +0 -1
- package/dist/node_modules/.pnpm/@signe_sync@2.9.0/node_modules/@signe/sync/dist/chunk-7QVYU63E.js +0 -10
- package/dist/node_modules/.pnpm/@signe_sync@2.9.0/node_modules/@signe/sync/dist/chunk-7QVYU63E.js.map +0 -1
- package/dist/node_modules/.pnpm/@signe_sync@2.9.0/node_modules/@signe/sync/dist/client/index.js +0 -91
- package/dist/node_modules/.pnpm/@signe_sync@2.9.0/node_modules/@signe/sync/dist/client/index.js.map +0 -1
- package/dist/node_modules/.pnpm/@signe_sync@2.9.0/node_modules/@signe/sync/dist/index.js.map +0 -1
- package/dist/node_modules/.pnpm/dset@3.1.4/node_modules/dset/dist/index.js +0 -14
- package/dist/node_modules/.pnpm/dset@3.1.4/node_modules/dset/dist/index.js.map +0 -1
- package/dist/node_modules/.pnpm/partysocket@1.1.3/node_modules/partysocket/dist/chunk-HAC622V3.js.map +0 -1
- package/dist/node_modules/.pnpm/partysocket@1.1.3/node_modules/partysocket/dist/chunk-S74YV6PU.js.map +0 -1
- package/dist/node_modules/.pnpm/partysocket@1.1.3/node_modules/partysocket/dist/index.js +0 -2
- package/dist/node_modules/.pnpm/zod@3.24.2/node_modules/zod/lib/index.js.map +0 -1
|
@@ -1,80 +1,362 @@
|
|
|
1
|
-
<Container justifyContent="space-between" alignItems="flex-end" width="100%" height="100%">
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
},
|
|
22
|
-
text: {
|
|
23
|
-
fontSize: 24,
|
|
24
|
-
fontFamily: "Arial Bold",
|
|
25
|
-
color: "#ffffff"
|
|
26
|
-
}
|
|
27
|
-
}}
|
|
28
|
-
/>
|
|
29
|
-
|
|
30
|
-
<Button
|
|
31
|
-
text="B"
|
|
32
|
-
shape="circle"
|
|
33
|
-
width={70}
|
|
34
|
-
height={70}
|
|
35
|
-
controls={controlsInstance}
|
|
36
|
-
controlName="back"
|
|
37
|
-
style={{
|
|
38
|
-
backgroundColor: {
|
|
39
|
-
normal: "#e74c3c",
|
|
40
|
-
hover: "#c0392b",
|
|
41
|
-
pressed: "#a93226",
|
|
42
|
-
disabled: "#7f8c8d"
|
|
43
|
-
},
|
|
44
|
-
text: {
|
|
45
|
-
fontSize: 24,
|
|
46
|
-
fontFamily: "Arial Bold",
|
|
47
|
-
color: "#ffffff"
|
|
48
|
-
}
|
|
49
|
-
}}
|
|
50
|
-
/>
|
|
1
|
+
<Container flexDirection={rootDirection()} justifyContent="space-between" alignItems="flex-end" width="100%" height="100%" onBeforeDestroy={releaseJoystickControl}>
|
|
2
|
+
<Container justifyContent="flex-end" alignItems="flex-end" gap={layoutGap()} margin={buttonsMargin()}>
|
|
3
|
+
<Container display="flex" flexDirection="row" alignItems="flex-end" gap={layoutGap()}>
|
|
4
|
+
@if (showDashButton()) {
|
|
5
|
+
<Container ...buttonContainerProps("dash")>
|
|
6
|
+
<dashButtonComponent() ...buttonProps("dash") />
|
|
7
|
+
</Container>
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
@if (showActionButton()) {
|
|
11
|
+
<Container ...buttonContainerProps("action")>
|
|
12
|
+
<actionButtonComponent() ...buttonProps("action") />
|
|
13
|
+
</Container>
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
@if (showBackButton()) {
|
|
17
|
+
<Container ...buttonContainerProps("back")>
|
|
18
|
+
<backButtonComponent() ...buttonProps("back") />
|
|
19
|
+
</Container>
|
|
20
|
+
}
|
|
51
21
|
|
|
52
22
|
</Container>
|
|
53
23
|
</Container>
|
|
54
|
-
|
|
55
|
-
<Container margin={
|
|
56
|
-
|
|
57
|
-
<
|
|
58
|
-
|
|
59
|
-
outerColor="#34495e"
|
|
60
|
-
innerColor="#3498db"
|
|
61
|
-
/>
|
|
62
|
-
</Container>
|
|
24
|
+
|
|
25
|
+
<Container margin={joystickMargin()} alignItems="flex-end">
|
|
26
|
+
@if (showJoystick()) {
|
|
27
|
+
<joystickComponent() ...joystickProps() />
|
|
28
|
+
}
|
|
63
29
|
</Container>
|
|
64
30
|
</Container>
|
|
65
31
|
|
|
66
32
|
<script>
|
|
67
|
-
import { signal, mount } from 'canvasengine'
|
|
68
|
-
import { Button } from 'canvasengine'
|
|
33
|
+
import { Button, Joystick, signal, mount, computed } from 'canvasengine'
|
|
69
34
|
import { inject } from '../../../core/inject'
|
|
70
|
-
import { RpgClientEngine } from '../../../RpgClientEngine'
|
|
71
|
-
import { Direction } from '@rpgjs/common'
|
|
72
|
-
|
|
73
35
|
|
|
36
|
+
const { data } = defineProps()
|
|
74
37
|
const controlsInstance = signal(null)
|
|
38
|
+
const options = computed(() => data?.() || {})
|
|
39
|
+
const layout = computed(() => options().layout || {})
|
|
40
|
+
const components = computed(() => options().components || {})
|
|
41
|
+
const buttons = computed(() => options().buttons || {})
|
|
42
|
+
const joystick = computed(() => options().joystick)
|
|
43
|
+
|
|
44
|
+
const readButtonOption = (name) => buttons()[name]
|
|
45
|
+
const buttonEnabled = (name, defaultValue) => {
|
|
46
|
+
const option = readButtonOption(name)
|
|
47
|
+
if (typeof option === "boolean") return option
|
|
48
|
+
return option?.enabled ?? defaultValue
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const showActionButton = computed(() => buttonEnabled("action", true))
|
|
52
|
+
const showBackButton = computed(() => buttonEnabled("back", true))
|
|
53
|
+
const showDashButton = computed(() => buttonEnabled("dash", false))
|
|
54
|
+
const showJoystick = computed(() => joystick() !== false)
|
|
55
|
+
const joystickSide = computed(() => layout().joystickSide || "right")
|
|
56
|
+
const rootDirection = computed(() => joystickSide() === "left" ? "row-reverse" : "row")
|
|
57
|
+
const layoutGap = computed(() => layout().gap ?? 14)
|
|
58
|
+
const buttonsMargin = computed(() => layout().buttonsMargin ?? layout().margin ?? 50)
|
|
59
|
+
const joystickMargin = computed(() => (
|
|
60
|
+
layout().joystickMargin
|
|
61
|
+
?? layout().margin
|
|
62
|
+
?? (joystickSide() === "right" ? [30, 54, 30, 30] : [30, 30, 30, 54])
|
|
63
|
+
))
|
|
64
|
+
|
|
65
|
+
function readObjectOption(option) {
|
|
66
|
+
return typeof option === "object" && option ? option : {}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
function resolveButtonComponent(name) {
|
|
70
|
+
const option = readObjectOption(readButtonOption(name))
|
|
71
|
+
return option.component || components().buttons?.[name] || Button
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
const joystickComponent = computed(() => joystick()?.component || components().joystick || Joystick)
|
|
75
|
+
const actionButtonComponent = computed(() => resolveButtonComponent("action"))
|
|
76
|
+
const backButtonComponent = computed(() => resolveButtonComponent("back"))
|
|
77
|
+
const dashButtonComponent = computed(() => resolveButtonComponent("dash"))
|
|
78
|
+
let activeJoystickControl = null
|
|
79
|
+
let activeJoystickPower = 0
|
|
80
|
+
let joystickRepeatTimer = null
|
|
81
|
+
|
|
82
|
+
const baseButtonTextStyle = {
|
|
83
|
+
fontSize: 24,
|
|
84
|
+
fontFamily: "Arial Bold",
|
|
85
|
+
color: "#ffffff"
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
const actionButtonStyle = {
|
|
89
|
+
backgroundColor: {
|
|
90
|
+
normal: "#f7fbff",
|
|
91
|
+
hover: "#ffffff",
|
|
92
|
+
pressed: "#8fd4ff",
|
|
93
|
+
disabled: "#7f8c8d"
|
|
94
|
+
},
|
|
95
|
+
text: {
|
|
96
|
+
...baseButtonTextStyle,
|
|
97
|
+
color: "#14253a"
|
|
98
|
+
},
|
|
99
|
+
border: {
|
|
100
|
+
color: "#ffffff",
|
|
101
|
+
width: 2
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
const backButtonStyle = {
|
|
106
|
+
backgroundColor: {
|
|
107
|
+
normal: "#243041",
|
|
108
|
+
hover: "#2f4059",
|
|
109
|
+
pressed: "#152132",
|
|
110
|
+
disabled: "#7f8c8d"
|
|
111
|
+
},
|
|
112
|
+
text: baseButtonTextStyle,
|
|
113
|
+
border: {
|
|
114
|
+
color: "#ffffff",
|
|
115
|
+
width: 1
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
const dashButtonStyle = {
|
|
120
|
+
backgroundColor: {
|
|
121
|
+
normal: "#243041",
|
|
122
|
+
hover: "#2f4059",
|
|
123
|
+
pressed: "#152132",
|
|
124
|
+
disabled: "#7f8c8d"
|
|
125
|
+
},
|
|
126
|
+
text: {
|
|
127
|
+
...baseButtonTextStyle,
|
|
128
|
+
fontSize: 20
|
|
129
|
+
},
|
|
130
|
+
border: {
|
|
131
|
+
color: "#ffffff",
|
|
132
|
+
width: 1
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
const defaultButtonProps = {
|
|
137
|
+
action: {
|
|
138
|
+
shape: "circle",
|
|
139
|
+
text: "A",
|
|
140
|
+
width: 68,
|
|
141
|
+
height: 68,
|
|
142
|
+
controls: controlsInstance,
|
|
143
|
+
controlName: "action",
|
|
144
|
+
style: actionButtonStyle,
|
|
145
|
+
alpha: 0.84
|
|
146
|
+
},
|
|
147
|
+
back: {
|
|
148
|
+
shape: "circle",
|
|
149
|
+
text: "B",
|
|
150
|
+
width: 56,
|
|
151
|
+
height: 56,
|
|
152
|
+
controls: controlsInstance,
|
|
153
|
+
controlName: "back",
|
|
154
|
+
style: backButtonStyle,
|
|
155
|
+
alpha: 0.78
|
|
156
|
+
},
|
|
157
|
+
dash: {
|
|
158
|
+
shape: "circle",
|
|
159
|
+
text: "R",
|
|
160
|
+
width: 56,
|
|
161
|
+
height: 56,
|
|
162
|
+
controls: controlsInstance,
|
|
163
|
+
controlName: "dash",
|
|
164
|
+
style: dashButtonStyle,
|
|
165
|
+
alpha: 0.78
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
const buttonProps = (name) => {
|
|
170
|
+
const option = readObjectOption(readButtonOption(name))
|
|
171
|
+
const { enabled, component, container, ...props } = option
|
|
172
|
+
const defaultProps = defaultButtonProps[name]
|
|
173
|
+
return {
|
|
174
|
+
...defaultProps,
|
|
175
|
+
...props,
|
|
176
|
+
defaultProps
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
const buttonContainerProps = (name) => {
|
|
181
|
+
const props = buttonProps(name)
|
|
182
|
+
return {
|
|
183
|
+
width: props.width,
|
|
184
|
+
height: props.height,
|
|
185
|
+
...readObjectOption(readButtonOption(name)).container
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
const joystickProps = () => {
|
|
190
|
+
const joystickOptions = readObjectOption(joystick())
|
|
191
|
+
const { component, moveInterval, threshold, ...props } = joystickOptions
|
|
192
|
+
const defaultProps = {
|
|
193
|
+
outerColor: "#d7e7ff",
|
|
194
|
+
innerColor: "#ffffff",
|
|
195
|
+
scale: 0.82,
|
|
196
|
+
outerScale: { x: 0.86, y: 0.86 },
|
|
197
|
+
innerScale: { x: 0.88, y: 0.88 },
|
|
198
|
+
onStart: onJoystickStart,
|
|
199
|
+
onChange: onJoystickChange,
|
|
200
|
+
onEnd: onJoystickEnd
|
|
201
|
+
}
|
|
202
|
+
return {
|
|
203
|
+
...defaultProps,
|
|
204
|
+
...props,
|
|
205
|
+
defaultProps
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
const applyJoystickOptions = (control) => {
|
|
210
|
+
const joystickOptions = joystick()
|
|
211
|
+
if (!control || !joystickOptions || joystickOptions === false) return
|
|
212
|
+
control.joystick?.updateJoystickConfig?.({
|
|
213
|
+
...control.joystick?.getJoystickConfig?.(),
|
|
214
|
+
...(typeof joystickOptions.moveInterval === "number" ? { moveInterval: joystickOptions.moveInterval } : {}),
|
|
215
|
+
...(typeof joystickOptions.threshold === "number" ? { threshold: joystickOptions.threshold } : {})
|
|
216
|
+
})
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
const getJoystickThreshold = () => {
|
|
220
|
+
const joystickOptions = joystick()
|
|
221
|
+
if (joystickOptions && joystickOptions !== false && typeof joystickOptions.threshold === "number") {
|
|
222
|
+
return joystickOptions.threshold
|
|
223
|
+
}
|
|
224
|
+
return controlsInstance()?.joystick?.getJoystickConfig?.()?.threshold ?? 0.1
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
const getJoystickMoveInterval = () => {
|
|
228
|
+
const joystickOptions = joystick()
|
|
229
|
+
if (joystickOptions && joystickOptions !== false && typeof joystickOptions.moveInterval === "number") {
|
|
230
|
+
return joystickOptions.moveInterval
|
|
231
|
+
}
|
|
232
|
+
return controlsInstance()?.joystick?.getJoystickConfig?.()?.moveInterval ?? 50
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
const controlForAxis = (negativeControl, positiveControl, negativeAngle, positiveAngle, angle) => {
|
|
236
|
+
const distanceToNegative = Math.abs(angle - negativeAngle)
|
|
237
|
+
const distanceToPositive = Math.abs(angle - positiveAngle)
|
|
238
|
+
return distanceToNegative <= distanceToPositive ? negativeControl : positiveControl
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
const resolveJoystickControl = (event) => {
|
|
242
|
+
const direction = event?.direction
|
|
243
|
+
if (direction === "top") return "up"
|
|
244
|
+
if (direction === "bottom") return "down"
|
|
245
|
+
if (direction === "left") return "left"
|
|
246
|
+
if (direction === "right") return "right"
|
|
247
|
+
|
|
248
|
+
const angle = Number(event?.angle)
|
|
249
|
+
if (!Number.isFinite(angle)) {
|
|
250
|
+
if (direction === "top_left") return "left"
|
|
251
|
+
if (direction === "top_right") return "right"
|
|
252
|
+
if (direction === "bottom_left") return "left"
|
|
253
|
+
if (direction === "bottom_right") return "right"
|
|
254
|
+
return null
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
if (direction === "top_left") return controlForAxis("up", "left", 90, 180, angle)
|
|
258
|
+
if (direction === "top_right") return controlForAxis("right", "up", 0, 90, angle)
|
|
259
|
+
if (direction === "bottom_left") return controlForAxis("left", "down", 180, 270, angle)
|
|
260
|
+
if (direction === "bottom_right") return controlForAxis("right", "down", 360, 270, angle)
|
|
261
|
+
return null
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
const applyJoystickControl = (name, isDown, power = activeJoystickPower) => {
|
|
265
|
+
const control = controlsInstance()
|
|
266
|
+
const joystickControls = control?.joystick
|
|
267
|
+
if (joystickControls?.applyControl) {
|
|
268
|
+
return joystickControls.applyControl(name, isDown, { power })
|
|
269
|
+
}
|
|
270
|
+
const keyboard = control?.keyboard
|
|
271
|
+
if (keyboard?.applyControl) return keyboard.applyControl(name, isDown)
|
|
272
|
+
return control?.applyControl?.(name, isDown, { power })
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
const stopJoystickRepeat = () => {
|
|
276
|
+
if (!joystickRepeatTimer) return
|
|
277
|
+
clearInterval(joystickRepeatTimer)
|
|
278
|
+
joystickRepeatTimer = null
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
const startJoystickRepeat = () => {
|
|
282
|
+
if (!activeJoystickControl || joystickRepeatTimer) return
|
|
283
|
+
joystickRepeatTimer = setInterval(() => {
|
|
284
|
+
if (!activeJoystickControl) return
|
|
285
|
+
applyJoystickControl(activeJoystickControl, true)
|
|
286
|
+
}, getJoystickMoveInterval())
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
const releaseJoystickControl = () => {
|
|
290
|
+
stopJoystickRepeat()
|
|
291
|
+
if (!activeJoystickControl) return
|
|
292
|
+
const previous = activeJoystickControl
|
|
293
|
+
activeJoystickControl = null
|
|
294
|
+
activeJoystickPower = 0
|
|
295
|
+
applyJoystickControl(previous, false, 0)
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
const activateJoystickControl = (controlName, power = 0) => {
|
|
299
|
+
if (!controlName) {
|
|
300
|
+
releaseJoystickControl()
|
|
301
|
+
return
|
|
302
|
+
}
|
|
303
|
+
activeJoystickPower = power
|
|
304
|
+
if (activeJoystickControl === controlName) {
|
|
305
|
+
startJoystickRepeat()
|
|
306
|
+
return
|
|
307
|
+
}
|
|
308
|
+
releaseJoystickControl()
|
|
309
|
+
activeJoystickControl = controlName
|
|
310
|
+
applyJoystickControl(controlName, true, power)
|
|
311
|
+
startJoystickRepeat()
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
const publishMobileDebug = (type, payload = {}) => {
|
|
315
|
+
const target = typeof window !== "undefined" ? window : globalThis
|
|
316
|
+
if (!target.__RPGJS_MOBILE_DEBUG__) return
|
|
317
|
+
const event = {
|
|
318
|
+
source: "mobile-gui",
|
|
319
|
+
type,
|
|
320
|
+
time: Date.now(),
|
|
321
|
+
...payload
|
|
322
|
+
}
|
|
323
|
+
target.__RPGJS_MOBILE_DEBUG_EVENTS__ = [
|
|
324
|
+
...(target.__RPGJS_MOBILE_DEBUG_EVENTS__ || []).slice(-199),
|
|
325
|
+
event
|
|
326
|
+
]
|
|
327
|
+
target.__RPGJS_MOBILE_DEBUG_LAST__ = event
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
const onJoystickStart = () => {
|
|
331
|
+
publishMobileDebug("joystick:start", {
|
|
332
|
+
config: controlsInstance()?.joystick?.getJoystickConfig?.()
|
|
333
|
+
})
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
const onJoystickChange = (event) => {
|
|
337
|
+
const threshold = getJoystickThreshold()
|
|
338
|
+
const controlName = event?.power >= threshold ? resolveJoystickControl(event) : null
|
|
339
|
+
publishMobileDebug("joystick:change", {
|
|
340
|
+
direction: event?.direction,
|
|
341
|
+
power: event?.power,
|
|
342
|
+
angle: event?.angle,
|
|
343
|
+
threshold,
|
|
344
|
+
controlName,
|
|
345
|
+
config: controlsInstance()?.joystick?.getJoystickConfig?.()
|
|
346
|
+
})
|
|
347
|
+
activateJoystickControl(controlName, event?.power ?? 0)
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
const onJoystickEnd = () => {
|
|
351
|
+
publishMobileDebug("joystick:end", {
|
|
352
|
+
controlName: activeJoystickControl
|
|
353
|
+
})
|
|
354
|
+
releaseJoystickControl()
|
|
355
|
+
}
|
|
75
356
|
|
|
76
357
|
mount((element) => {
|
|
77
358
|
const control = inject('KeyboardControls')
|
|
78
359
|
controlsInstance.set(control)
|
|
360
|
+
applyJoystickOptions(control)
|
|
79
361
|
})
|
|
80
|
-
</script>
|
|
362
|
+
</script>
|
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
<DOMContainer
|
|
1
|
+
<DOMContainer
|
|
2
|
+
width="100%"
|
|
3
|
+
height="100%"
|
|
4
|
+
zIndex={100}
|
|
5
|
+
class="notification"
|
|
6
|
+
style="pointer-events: none !important;"
|
|
7
|
+
>
|
|
2
8
|
<div class="rpg-ui-notifications">
|
|
3
9
|
@for ((notif,index) of notifications) {
|
|
4
10
|
<div
|
|
@@ -17,14 +17,14 @@
|
|
|
17
17
|
<div class="rpg-ui-save-load-slot-index">{item.label}</div>
|
|
18
18
|
@if (item.slot) {
|
|
19
19
|
<div class="rpg-ui-save-load-slot-meta">
|
|
20
|
-
<div class="rpg-ui-save-load-slot-line">
|
|
21
|
-
<div class="rpg-ui-save-load-slot-line">
|
|
22
|
-
<div class="rpg-ui-save-load-slot-line">
|
|
23
|
-
<div class="rpg-ui-save-load-slot-line">
|
|
20
|
+
<div class="rpg-ui-save-load-slot-line">{t("rpg.save.level")}: {item.slot.level ?? "-"}</div>
|
|
21
|
+
<div class="rpg-ui-save-load-slot-line">{t("rpg.save.exp")}: {item.slot.exp ?? "-"}</div>
|
|
22
|
+
<div class="rpg-ui-save-load-slot-line">{t("rpg.save.map")}: {item.slot.map ?? "-"}</div>
|
|
23
|
+
<div class="rpg-ui-save-load-slot-line">{t("rpg.save.date")}: {item.slot.date ?? "-"}</div>
|
|
24
24
|
</div>
|
|
25
25
|
}
|
|
26
26
|
@else {
|
|
27
|
-
<div class="rpg-ui-save-load-slot-empty">
|
|
27
|
+
<div class="rpg-ui-save-load-slot-empty">{t("rpg.save.empty-slot")}</div>
|
|
28
28
|
}
|
|
29
29
|
</div>
|
|
30
30
|
}
|
|
@@ -40,8 +40,10 @@
|
|
|
40
40
|
import { SaveClientService } from "../../services/save";
|
|
41
41
|
import { PrebuiltGui } from "@rpgjs/common";
|
|
42
42
|
import { RpgGui } from "../../Gui/Gui";
|
|
43
|
+
import { getKeyboardControlBind } from "../../services/actionInput";
|
|
43
44
|
|
|
44
45
|
const engine = inject(RpgClientEngine);
|
|
46
|
+
const { t } = engine.i18n();
|
|
45
47
|
const saveClient = inject(SaveClientService);
|
|
46
48
|
const gui = inject(RpgGui);
|
|
47
49
|
const keyboardControls = engine.globalConfig.keyboardControls;
|
|
@@ -53,10 +55,10 @@
|
|
|
53
55
|
|
|
54
56
|
const { data, onFinish } = defineProps();
|
|
55
57
|
|
|
56
|
-
const title = computed(() => data().mode === "save" ? "
|
|
58
|
+
const title = computed(() => data().mode === "save" ? t("rpg.save.title") : t("rpg.load.title"));
|
|
57
59
|
const subtitle = computed(() => data().mode === "save"
|
|
58
|
-
? "
|
|
59
|
-
: "
|
|
60
|
+
? t("rpg.save.subtitle")
|
|
61
|
+
: t("rpg.load.subtitle")
|
|
60
62
|
);
|
|
61
63
|
|
|
62
64
|
const slotsValue = computed(() => localSlots());
|
|
@@ -66,7 +68,7 @@
|
|
|
66
68
|
kind: "slot",
|
|
67
69
|
slot,
|
|
68
70
|
slotIndex: index,
|
|
69
|
-
label:
|
|
71
|
+
label: t("rpg.save.slot", { index: index + 1 }),
|
|
70
72
|
readonly: false
|
|
71
73
|
}));
|
|
72
74
|
if (!data().showAutoSlot) return items;
|
|
@@ -78,7 +80,7 @@
|
|
|
78
80
|
kind: "auto",
|
|
79
81
|
slot: autoSlot,
|
|
80
82
|
slotIndex: index,
|
|
81
|
-
label: data().autoSlotLabel || "
|
|
83
|
+
label: data().autoSlotLabel || t("rpg.save.auto"),
|
|
82
84
|
readonly
|
|
83
85
|
},
|
|
84
86
|
...items
|
|
@@ -185,7 +187,7 @@
|
|
|
185
187
|
}
|
|
186
188
|
},
|
|
187
189
|
action: {
|
|
188
|
-
bind: keyboardControls.action,
|
|
190
|
+
bind: getKeyboardControlBind(keyboardControls.action),
|
|
189
191
|
keyDown() {
|
|
190
192
|
triggerSelect(selectedSlot());
|
|
191
193
|
}
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
<div class="rpg-shop-details rpg-shop-details-mode">
|
|
31
31
|
<div class="rpg-shop-details-header">
|
|
32
32
|
<div class="rpg-shop-details-icon">🛒</div>
|
|
33
|
-
<h2 style="margin: 0;">
|
|
33
|
+
<h2 style="margin: 0;">{t("rpg.shop.choose-action")}</h2>
|
|
34
34
|
</div>
|
|
35
35
|
<div class="rpg-shop-trade">
|
|
36
36
|
<Navigation tabindex={selectedModeIndex} controls={modeControls}>
|
|
@@ -39,12 +39,12 @@
|
|
|
39
39
|
class="rpg-shop-tab"
|
|
40
40
|
class={{active: selectedModeIndex() === 0}}
|
|
41
41
|
click={selectMode('buy')}
|
|
42
|
-
>
|
|
42
|
+
>{t("rpg.shop.buy")}</div>
|
|
43
43
|
<div
|
|
44
44
|
class="rpg-shop-tab"
|
|
45
45
|
class={{active: selectedModeIndex() === 1}}
|
|
46
46
|
click={selectMode('sell')}
|
|
47
|
-
>
|
|
47
|
+
>{t("rpg.shop.sell")}</div>
|
|
48
48
|
</div>
|
|
49
49
|
</Navigation>
|
|
50
50
|
</div>
|
|
@@ -88,7 +88,7 @@
|
|
|
88
88
|
<div class="rpg-shop-card-qty">x{{ item.quantity }}</div>
|
|
89
89
|
}
|
|
90
90
|
@if (item.equipped) {
|
|
91
|
-
<div class="rpg-shop-card-tag">
|
|
91
|
+
<div class="rpg-shop-card-tag">{t("rpg.shop.equipped")}</div>
|
|
92
92
|
}
|
|
93
93
|
</div>
|
|
94
94
|
}
|
|
@@ -109,12 +109,12 @@
|
|
|
109
109
|
<h2 style="margin: 0;">{{ currentItem()?.name || "" }}</h2>
|
|
110
110
|
<p style="color: #ffd700; font-weight: bold; margin: 8px 0;">{{ currentItem()?.price ?? 0 }} {{ goldTerm }}</p>
|
|
111
111
|
@if (currentItem()?.quantity !== undefined) {
|
|
112
|
-
<div class="rpg-shop-details-qty">
|
|
112
|
+
<div class="rpg-shop-details-qty">{t("rpg.shop.qty")}: x{{ currentItem()?.quantity }}</div>
|
|
113
113
|
}
|
|
114
114
|
</div>
|
|
115
115
|
<div>
|
|
116
116
|
@if (currentItem()?.equipped) {
|
|
117
|
-
<div class="rpg-shop-equipped">
|
|
117
|
+
<div class="rpg-shop-equipped">{t("rpg.shop.already-equipped")}</div>
|
|
118
118
|
}
|
|
119
119
|
</div>
|
|
120
120
|
<div class="rpg-shop-details-desc">
|
|
@@ -137,7 +137,7 @@
|
|
|
137
137
|
</div>
|
|
138
138
|
}
|
|
139
139
|
</div>
|
|
140
|
-
<button class="rpg-shop-btn" click={backToMode()}>
|
|
140
|
+
<button class="rpg-shop-btn" click={backToMode()}>{t("rpg.shop.back")}</button>
|
|
141
141
|
</div>
|
|
142
142
|
</div>
|
|
143
143
|
</div>
|
|
@@ -148,10 +148,10 @@
|
|
|
148
148
|
<div class="rpg-shop-modal-title">{{ actionLabel }}</div>
|
|
149
149
|
<div class="rpg-shop-modal-item">{{ currentItem()?.name || "" }}</div>
|
|
150
150
|
@if (currentItem()?.quantity !== undefined) {
|
|
151
|
-
<div class="rpg-shop-modal-qty">
|
|
151
|
+
<div class="rpg-shop-modal-qty">{t("rpg.shop.available")}: x{{ currentItem()?.quantity }}</div>
|
|
152
152
|
}
|
|
153
153
|
<div class="rpg-shop-quantity">
|
|
154
|
-
<div class="rpg-shop-quantity-label">
|
|
154
|
+
<div class="rpg-shop-quantity-label">{t("rpg.shop.quantity")}</div>
|
|
155
155
|
<div class="rpg-shop-quantity-controls">
|
|
156
156
|
<button class="rpg-shop-btn" click={changeQuantity(-1)}>-</button>
|
|
157
157
|
<div class="rpg-shop-quantity-value">{{ quantity }}</div>
|
|
@@ -159,11 +159,11 @@
|
|
|
159
159
|
</div>
|
|
160
160
|
</div>
|
|
161
161
|
<div class="rpg-shop-modal-total">
|
|
162
|
-
<span>
|
|
162
|
+
<span>{t("rpg.shop.total")}</span>
|
|
163
163
|
<span>{{ totalPrice() }} {{ goldTerm }}</span>
|
|
164
164
|
</div>
|
|
165
165
|
<div class="rpg-shop-modal-actions">
|
|
166
|
-
<button class="rpg-shop-btn rpg-shop-btn-secondary" click={closeQuantityDialog()}>
|
|
166
|
+
<button class="rpg-shop-btn rpg-shop-btn-secondary" click={closeQuantityDialog()}>{t("rpg.menu.cancel")}</button>
|
|
167
167
|
<button class="rpg-shop-btn" click={confirmTrade()}>
|
|
168
168
|
{{ actionLabel() }} x{{ quantity() }}
|
|
169
169
|
</button>
|
|
@@ -180,8 +180,10 @@
|
|
|
180
180
|
import { mount, signal, computed, createTabindexNavigator, effect } from "canvasengine";
|
|
181
181
|
import { inject } from "../../../core/inject";
|
|
182
182
|
import { RpgClientEngine } from "../../../RpgClientEngine";
|
|
183
|
+
import { getKeyboardControlBind } from "../../../services/actionInput";
|
|
183
184
|
|
|
184
185
|
const engine = inject(RpgClientEngine)
|
|
186
|
+
const { t } = engine.i18n()
|
|
185
187
|
const currentPlayer = engine.scene.currentPlayer
|
|
186
188
|
const keyboardControls = engine.globalConfig.keyboardControls
|
|
187
189
|
const iconSheet = (iconId) => ({
|
|
@@ -197,11 +199,11 @@
|
|
|
197
199
|
const selectedModeIndex = signal(0)
|
|
198
200
|
const quantity = signal(1)
|
|
199
201
|
const quantityDialogOpen = signal(false)
|
|
200
|
-
const defaultMessage =
|
|
202
|
+
const defaultMessage = t("rpg.shop.default-message")
|
|
201
203
|
const tabs = [
|
|
202
|
-
{ id: 'item', label:
|
|
203
|
-
{ id: 'weapon', label:
|
|
204
|
-
{ id: 'armor', label:
|
|
204
|
+
{ id: 'item', label: t("rpg.menu.items") },
|
|
205
|
+
{ id: 'weapon', label: t("rpg.menu.weapons") },
|
|
206
|
+
{ id: 'armor', label: t("rpg.menu.armor") }
|
|
205
207
|
]
|
|
206
208
|
|
|
207
209
|
const { data, onInteraction , onFinish } = defineProps()
|
|
@@ -228,7 +230,7 @@
|
|
|
228
230
|
})
|
|
229
231
|
const currentItem = computed(() => filteredItems()[selectedItem()])
|
|
230
232
|
const gold = computed(() => currentPlayer()._gold())
|
|
231
|
-
const actionLabel = computed(() => tradeMode() === 'buy' ?
|
|
233
|
+
const actionLabel = computed(() => tradeMode() === 'buy' ? t("rpg.shop.buy") : t("rpg.shop.sell"))
|
|
232
234
|
const faceSheet = (graphicId, animationName) => ({
|
|
233
235
|
definition: engine.getSpriteSheet(graphicId),
|
|
234
236
|
playing: animationName || "default"
|
|
@@ -387,7 +389,7 @@
|
|
|
387
389
|
}
|
|
388
390
|
},
|
|
389
391
|
action: {
|
|
390
|
-
bind: keyboardControls.action,
|
|
392
|
+
bind: getKeyboardControlBind(keyboardControls.action),
|
|
391
393
|
keyDown() {
|
|
392
394
|
const mode = selectedModeIndex() === 0 ? 'buy' : 'sell'
|
|
393
395
|
tradeMode.set(mode)
|
|
@@ -433,7 +435,7 @@
|
|
|
433
435
|
}
|
|
434
436
|
},
|
|
435
437
|
action: {
|
|
436
|
-
bind: keyboardControls.action,
|
|
438
|
+
bind: getKeyboardControlBind(keyboardControls.action),
|
|
437
439
|
keyDown() {
|
|
438
440
|
if (quantityDialogOpen()) {
|
|
439
441
|
const item = currentItem()
|