@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,157 +1,39 @@
|
|
|
1
|
-
<Text text={
|
|
1
|
+
<Text text={textValue} color={textColor} size={textSize} fontFamily={textFontFamily} style={textStyle} />
|
|
2
2
|
|
|
3
3
|
<script>
|
|
4
4
|
import { computed } from "canvasengine";
|
|
5
|
-
import {
|
|
5
|
+
import { resolveDynamicValue } from "./parse-value";
|
|
6
6
|
|
|
7
|
-
const { object } = defineProps();
|
|
8
|
-
const
|
|
7
|
+
const { object, value, style } = defineProps();
|
|
8
|
+
const sprite = object();
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
* Parses a numeric style value that can be a number or a string
|
|
12
|
-
*
|
|
13
|
-
* If the value is a string, it may contain dynamic references like {hp}
|
|
14
|
-
* which need to be parsed using parseDynamicValue. If it's a number,
|
|
15
|
-
* it's returned as-is wrapped in a computed.
|
|
16
|
-
*
|
|
17
|
-
* @param value - Numeric value (number or string)
|
|
18
|
-
* @param object - Object to resolve dynamic references from
|
|
19
|
-
* @returns Computed signal with the numeric value
|
|
20
|
-
*/
|
|
21
|
-
const parseNumericStyleValue = (value, object) => {
|
|
22
|
-
if (value === undefined || value === null) {
|
|
23
|
-
return undefined;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
if (typeof value === 'number') {
|
|
27
|
-
return value;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
if (typeof value === 'string') {
|
|
31
|
-
// Check if it contains dynamic references
|
|
32
|
-
if (value.includes('{')) {
|
|
33
|
-
// Parse dynamic value and convert to number
|
|
34
|
-
const parsed = parseDynamicValue(value, object);
|
|
35
|
-
return computed(() => {
|
|
36
|
-
const str = parsed();
|
|
37
|
-
const num = parseFloat(str);
|
|
38
|
-
return isNaN(num) ? 0 : num;
|
|
39
|
-
});
|
|
40
|
-
} else {
|
|
41
|
-
// Simple string number, convert directly
|
|
42
|
-
const num = parseFloat(value);
|
|
43
|
-
return isNaN(num) ? undefined : num;
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
return value;
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* Maps component style properties to Canvas Engine Text component props
|
|
52
|
-
*
|
|
53
|
-
* Converts TextComponentOptions from the server to the format expected
|
|
54
|
-
* by the Canvas Engine Text component. Supports all text styling properties
|
|
55
|
-
* including fill, fontSize, fontFamily, fontStyle, fontWeight, stroke,
|
|
56
|
-
* opacity, wordWrap, and align. Also supports dynamic values (number | string)
|
|
57
|
-
* for numeric properties like fontSize and opacity.
|
|
58
|
-
*
|
|
59
|
-
* @param component - Component definition with style property
|
|
60
|
-
* @returns Object with Text component props
|
|
61
|
-
*
|
|
62
|
-
* @example
|
|
63
|
-
* ```ts
|
|
64
|
-
* // Component with style
|
|
65
|
-
* const component = {
|
|
66
|
-
* style: {
|
|
67
|
-
* fill: '#000000',
|
|
68
|
-
* fontSize: 20,
|
|
69
|
-
* fontFamily: 'Arial',
|
|
70
|
-
* fontWeight: 'bold'
|
|
71
|
-
* }
|
|
72
|
-
* };
|
|
73
|
-
*
|
|
74
|
-
* const props = getComponentStyle(component);
|
|
75
|
-
* // Returns: { color: '#000000', size: 20, fontFamily: 'Arial', style: { fontWeight: 'bold' } }
|
|
76
|
-
*
|
|
77
|
-
* // Component with dynamic fontSize
|
|
78
|
-
* const component2 = {
|
|
79
|
-
* style: {
|
|
80
|
-
* fill: '#000000',
|
|
81
|
-
* fontSize: '{hp}', // Will be resolved from object.hp
|
|
82
|
-
* opacity: '0.8'
|
|
83
|
-
* }
|
|
84
|
-
* };
|
|
85
|
-
* ```
|
|
86
|
-
*/
|
|
87
|
-
const getComponentStyle = (component) => {
|
|
88
|
-
if (!component.style) {
|
|
89
|
-
return {};
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
const style = component.style;
|
|
93
|
-
const result = {};
|
|
94
|
-
|
|
95
|
-
// Map fill to color (shortcut property)
|
|
96
|
-
// fill can be a string (hex color) or a dynamic string
|
|
97
|
-
if (style.fill !== undefined) {
|
|
98
|
-
if (typeof style.fill === 'string' && style.fill.includes('{')) {
|
|
99
|
-
result.color = parseDynamicValue(style.fill, object);
|
|
100
|
-
} else {
|
|
101
|
-
result.color = style.fill;
|
|
102
|
-
}
|
|
103
|
-
}
|
|
10
|
+
const read = (prop, fallback) => prop ? prop() : fallback;
|
|
104
11
|
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
if (
|
|
108
|
-
|
|
109
|
-
if (fontSizeValue !== undefined) {
|
|
110
|
-
result.size = fontSizeValue;
|
|
111
|
-
}
|
|
112
|
-
}
|
|
12
|
+
const parseNumericStyleValue = (value, object) => {
|
|
13
|
+
value = resolveDynamicValue(value, sprite);
|
|
14
|
+
if (value === undefined || value === null) return undefined;
|
|
15
|
+
if (typeof value === 'number') return value;
|
|
113
16
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
result.fontFamily = parseDynamicValue(style.fontFamily, object);
|
|
118
|
-
} else {
|
|
119
|
-
result.fontFamily = style.fontFamily;
|
|
120
|
-
}
|
|
121
|
-
}
|
|
17
|
+
const num = parseFloat(value);
|
|
18
|
+
return isNaN(num) ? undefined : num;
|
|
19
|
+
};
|
|
122
20
|
|
|
123
|
-
|
|
21
|
+
const getTextStyle = (style) => {
|
|
22
|
+
if (!style) return {};
|
|
124
23
|
const textStyle = {};
|
|
125
24
|
|
|
126
|
-
// Font style properties
|
|
127
25
|
if (style.fontStyle !== undefined) {
|
|
128
|
-
|
|
129
|
-
textStyle.fontStyle = parseDynamicValue(style.fontStyle, object);
|
|
130
|
-
} else {
|
|
131
|
-
textStyle.fontStyle = style.fontStyle;
|
|
132
|
-
}
|
|
26
|
+
textStyle.fontStyle = resolveDynamicValue(style.fontStyle, sprite);
|
|
133
27
|
}
|
|
134
28
|
|
|
135
29
|
if (style.fontWeight !== undefined) {
|
|
136
|
-
|
|
137
|
-
textStyle.fontWeight = parseDynamicValue(style.fontWeight, object);
|
|
138
|
-
} else if (typeof style.fontWeight === 'number') {
|
|
139
|
-
textStyle.fontWeight = style.fontWeight;
|
|
140
|
-
} else {
|
|
141
|
-
textStyle.fontWeight = style.fontWeight;
|
|
142
|
-
}
|
|
30
|
+
textStyle.fontWeight = resolveDynamicValue(style.fontWeight, sprite);
|
|
143
31
|
}
|
|
144
32
|
|
|
145
|
-
// Stroke properties
|
|
146
33
|
if (style.stroke !== undefined) {
|
|
147
|
-
|
|
148
|
-
textStyle.stroke = parseDynamicValue(style.stroke, object);
|
|
149
|
-
} else {
|
|
150
|
-
textStyle.stroke = style.stroke;
|
|
151
|
-
}
|
|
34
|
+
textStyle.stroke = resolveDynamicValue(style.stroke, sprite);
|
|
152
35
|
}
|
|
153
36
|
|
|
154
|
-
// Opacity (can be number or string)
|
|
155
37
|
if (style.opacity !== undefined) {
|
|
156
38
|
const opacityValue = parseNumericStyleValue(style.opacity, object);
|
|
157
39
|
if (opacityValue !== undefined) {
|
|
@@ -159,25 +41,29 @@ const getComponentStyle = (component) => {
|
|
|
159
41
|
}
|
|
160
42
|
}
|
|
161
43
|
|
|
162
|
-
// Word wrap
|
|
163
44
|
if (style.wordWrap !== undefined) {
|
|
164
45
|
textStyle.wordWrap = style.wordWrap;
|
|
165
46
|
}
|
|
166
47
|
|
|
167
|
-
// Text alignment
|
|
168
48
|
if (style.align !== undefined) {
|
|
169
|
-
|
|
170
|
-
textStyle.align = parseDynamicValue(style.align, object);
|
|
171
|
-
} else {
|
|
172
|
-
textStyle.align = style.align;
|
|
173
|
-
}
|
|
49
|
+
textStyle.align = resolveDynamicValue(style.align, sprite);
|
|
174
50
|
}
|
|
175
51
|
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
result.style = textStyle;
|
|
179
|
-
}
|
|
52
|
+
return textStyle;
|
|
53
|
+
};
|
|
180
54
|
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
55
|
+
const textValue = computed(() => String(resolveDynamicValue(read(value, ''), sprite) ?? ''));
|
|
56
|
+
const textColor = computed(() => {
|
|
57
|
+
const currentStyle = read(style, {});
|
|
58
|
+
return currentStyle.fill !== undefined ? resolveDynamicValue(currentStyle.fill, sprite) : undefined;
|
|
59
|
+
});
|
|
60
|
+
const textSize = computed(() => {
|
|
61
|
+
const currentStyle = read(style, {});
|
|
62
|
+
return currentStyle.fontSize !== undefined ? parseNumericStyleValue(currentStyle.fontSize, object) : undefined;
|
|
63
|
+
});
|
|
64
|
+
const textFontFamily = computed(() => {
|
|
65
|
+
const currentStyle = read(style, {});
|
|
66
|
+
return currentStyle.fontFamily !== undefined ? resolveDynamicValue(currentStyle.fontFamily, sprite) : undefined;
|
|
67
|
+
});
|
|
68
|
+
const textStyle = computed(() => getTextStyle(read(style, {})));
|
|
69
|
+
</script>
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
@if (hasChoices()) {
|
|
18
18
|
<Navigation tabindex={selectedItem} controls={controls}>
|
|
19
19
|
<div class="rpg-ui-dialog-choices">
|
|
20
|
-
@for ((choice,index) of
|
|
20
|
+
@for ((choice,index) of dialogChoices()) {
|
|
21
21
|
<div
|
|
22
22
|
class="rpg-ui-dialog-choice"
|
|
23
23
|
class={{active: selectedItem() === index}}
|
|
@@ -29,10 +29,15 @@
|
|
|
29
29
|
</div>
|
|
30
30
|
</Navigation>
|
|
31
31
|
}
|
|
32
|
-
|
|
32
|
+
</div>
|
|
33
33
|
@if (hasFace()) {
|
|
34
34
|
<div class="rpg-ui-dialog-face">
|
|
35
|
-
<DOMSprite
|
|
35
|
+
<DOMSprite
|
|
36
|
+
sheet={faceSheet(dialogFace())}
|
|
37
|
+
width="100%"
|
|
38
|
+
height="100%"
|
|
39
|
+
objectFit="contain"
|
|
40
|
+
/>
|
|
36
41
|
</div>
|
|
37
42
|
}
|
|
38
43
|
</div>
|
|
@@ -48,6 +53,7 @@
|
|
|
48
53
|
import { inject } from "../../../core/inject";
|
|
49
54
|
import { RpgClientEngine } from "../../../RpgClientEngine";
|
|
50
55
|
import { delay } from "@rpgjs/common";
|
|
56
|
+
import { getKeyboardControlBind } from "../../../services/actionInput";
|
|
51
57
|
|
|
52
58
|
const engine = inject(RpgClientEngine);
|
|
53
59
|
const currentPlayer = engine.scene.currentPlayer
|
|
@@ -56,27 +62,42 @@
|
|
|
56
62
|
engine.stopProcessingInput = true;
|
|
57
63
|
|
|
58
64
|
const selectedItem = signal(0)
|
|
59
|
-
|
|
65
|
+
const ACTION_OPEN_GUARD_MS = 150;
|
|
66
|
+
const openedAt = Date.now();
|
|
60
67
|
|
|
61
68
|
const {
|
|
62
69
|
data,
|
|
63
70
|
onFinish,
|
|
64
|
-
onInteraction
|
|
71
|
+
onInteraction,
|
|
72
|
+
guiOpenId
|
|
65
73
|
} = defineProps();
|
|
66
74
|
|
|
67
|
-
const
|
|
68
|
-
const
|
|
75
|
+
const dialogData = computed(() => data() || {});
|
|
76
|
+
const dialogChoices = computed(() => Array.isArray(dialogData().choices) ? dialogData().choices : []);
|
|
77
|
+
const message = computed(() => dialogData().message);
|
|
78
|
+
const speaker = computed(() => dialogData().speaker);
|
|
79
|
+
const position = computed(() => dialogData().position);
|
|
80
|
+
const typewriterEffect = computed(() => dialogData().typewriterEffect);
|
|
81
|
+
const fullWidth = computed(() => dialogData().fullWidth || false);
|
|
69
82
|
|
|
70
83
|
const resolveProp = (value) => typeof value === "function" ? value() : value;
|
|
84
|
+
const normalizeOpenId = (value) => {
|
|
85
|
+
const resolved = resolveProp(value);
|
|
86
|
+
return typeof resolved === "string" && resolved.length > 0 ? resolved : undefined;
|
|
87
|
+
};
|
|
71
88
|
|
|
72
89
|
const speakerName = computed(() => {
|
|
73
|
-
const value = resolveProp(speaker);
|
|
90
|
+
const value = resolveProp(speaker());
|
|
74
91
|
return value ? String(value) : "";
|
|
75
92
|
});
|
|
76
93
|
|
|
77
|
-
const dialogPosition = computed(() => resolveProp(position) || "bottom");
|
|
94
|
+
const dialogPosition = computed(() => resolveProp(position()) || "bottom");
|
|
78
95
|
const isFullWidth = computed(() => resolveProp(fullWidth) !== false);
|
|
79
|
-
const
|
|
96
|
+
const dialogFace = computed(() => resolveProp(dialogData().face));
|
|
97
|
+
const hasFace = computed(() => {
|
|
98
|
+
const value = dialogFace();
|
|
99
|
+
return !!(value && value.id);
|
|
100
|
+
});
|
|
80
101
|
|
|
81
102
|
const displayMessage = signal("");
|
|
82
103
|
const fullMessage = signal("");
|
|
@@ -113,9 +134,9 @@
|
|
|
113
134
|
};
|
|
114
135
|
|
|
115
136
|
effect(() => {
|
|
116
|
-
const text = resolveProp(message) || "";
|
|
137
|
+
const text = resolveProp(message()) || "";
|
|
117
138
|
fullMessage.set(text);
|
|
118
|
-
const useTypewriter = resolveProp(typewriterEffect) !== false;
|
|
139
|
+
const useTypewriter = resolveProp(typewriterEffect()) !== false;
|
|
119
140
|
if (!useTypewriter) {
|
|
120
141
|
finishTyping();
|
|
121
142
|
return;
|
|
@@ -124,9 +145,9 @@
|
|
|
124
145
|
});
|
|
125
146
|
|
|
126
147
|
|
|
127
|
-
const hasChoices = computed(() =>
|
|
148
|
+
const hasChoices = computed(() => dialogChoices().length > 0);
|
|
128
149
|
const showIndicator = computed(() => !hasChoices() && !isTyping());
|
|
129
|
-
const nav = createTabindexNavigator(selectedItem, { count: () =>
|
|
150
|
+
const nav = createTabindexNavigator(selectedItem, { count: () => dialogChoices().length }, 'wrap');
|
|
130
151
|
|
|
131
152
|
function selectChoice(index) {
|
|
132
153
|
return function() {
|
|
@@ -136,13 +157,15 @@
|
|
|
136
157
|
}
|
|
137
158
|
|
|
138
159
|
function _onFinish(value) {
|
|
139
|
-
if (onFinish) onFinish(value);
|
|
160
|
+
if (onFinish) onFinish(value, normalizeOpenId(guiOpenId));
|
|
140
161
|
}
|
|
141
162
|
|
|
142
163
|
const onSelect = (index) => {
|
|
143
164
|
_onFinish(index);
|
|
144
165
|
};
|
|
145
166
|
|
|
167
|
+
const canAcceptAction = () => Date.now() - openedAt >= ACTION_OPEN_GUARD_MS;
|
|
168
|
+
|
|
146
169
|
const controls = signal({
|
|
147
170
|
up: {
|
|
148
171
|
repeat: true,
|
|
@@ -163,8 +186,11 @@
|
|
|
163
186
|
}
|
|
164
187
|
},
|
|
165
188
|
action: {
|
|
166
|
-
bind: keyboardControls.action,
|
|
189
|
+
bind: getKeyboardControlBind(keyboardControls.action),
|
|
167
190
|
keyDown() {
|
|
191
|
+
if (!canAcceptAction()) {
|
|
192
|
+
return;
|
|
193
|
+
}
|
|
168
194
|
if (isTyping()) {
|
|
169
195
|
finishTyping();
|
|
170
196
|
return;
|
|
@@ -180,8 +206,11 @@
|
|
|
180
206
|
|
|
181
207
|
const dialogControls = signal({
|
|
182
208
|
action: {
|
|
183
|
-
bind: keyboardControls.action,
|
|
209
|
+
bind: getKeyboardControlBind(keyboardControls.action),
|
|
184
210
|
keyDown() {
|
|
211
|
+
if (!canAcceptAction()) {
|
|
212
|
+
return;
|
|
213
|
+
}
|
|
185
214
|
if (isTyping()) {
|
|
186
215
|
finishTyping();
|
|
187
216
|
return;
|
|
@@ -192,16 +221,18 @@
|
|
|
192
221
|
},
|
|
193
222
|
})
|
|
194
223
|
|
|
195
|
-
const faceSheet = (
|
|
224
|
+
const faceSheet = (faceValue) => {
|
|
225
|
+
if (!faceValue || !faceValue.id) {
|
|
226
|
+
return undefined;
|
|
227
|
+
}
|
|
196
228
|
return {
|
|
197
|
-
definition: engine.getSpriteSheet(
|
|
198
|
-
playing:
|
|
229
|
+
definition: engine.getSpriteSheet(faceValue.id),
|
|
230
|
+
playing: faceValue.expression || "default",
|
|
199
231
|
};
|
|
200
232
|
}
|
|
201
233
|
|
|
202
234
|
mount((element) => {
|
|
203
235
|
return () => {
|
|
204
|
-
isDestroyed = true;
|
|
205
236
|
// Wait destroy is finished before start processing input
|
|
206
237
|
delay(() => {
|
|
207
238
|
engine.stopProcessingInput = false;
|
|
@@ -31,8 +31,10 @@
|
|
|
31
31
|
import { inject } from "../../core/inject";
|
|
32
32
|
import { RpgClientEngine } from "../../RpgClientEngine";
|
|
33
33
|
import { RpgGui } from "../../Gui/Gui";
|
|
34
|
+
import { getKeyboardControlBind } from "../../services/actionInput";
|
|
34
35
|
|
|
35
36
|
const engine = inject(RpgClientEngine);
|
|
37
|
+
const { t } = engine.i18n();
|
|
36
38
|
const guiService = inject(RpgGui);
|
|
37
39
|
const keyboardControls = engine.globalConfig.keyboardControls;
|
|
38
40
|
|
|
@@ -49,12 +51,12 @@
|
|
|
49
51
|
});
|
|
50
52
|
|
|
51
53
|
const defaultEntries = [
|
|
52
|
-
{ id: "title", label: "
|
|
53
|
-
{ id: "load", label: "
|
|
54
|
+
{ id: "title", label: t("rpg.gameover.title-screen") },
|
|
55
|
+
{ id: "load", label: t("rpg.gameover.load-game") }
|
|
54
56
|
];
|
|
55
57
|
|
|
56
58
|
const resolveProp = (value) => typeof value === "function" ? value() : value;
|
|
57
|
-
const titleText = computed(() => resolveProp(title) || "
|
|
59
|
+
const titleText = computed(() => resolveProp(title) || t("rpg.gameover.title"));
|
|
58
60
|
const subtitleText = computed(() => resolveProp(subtitle) || "");
|
|
59
61
|
const localActionsEnabled = computed(() => resolveProp(localActions) === true);
|
|
60
62
|
|
|
@@ -146,7 +148,7 @@
|
|
|
146
148
|
}
|
|
147
149
|
},
|
|
148
150
|
action: {
|
|
149
|
-
bind: keyboardControls.action,
|
|
151
|
+
bind: getKeyboardControlBind(keyboardControls.action),
|
|
150
152
|
keyDown() {
|
|
151
153
|
triggerSelect(selectedEntry());
|
|
152
154
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<DOMContainer width="100%" height="100%">
|
|
2
2
|
<div class="rpg-ui-menu-panel rpg-ui-panel">
|
|
3
|
-
<div class="rpg-ui-menu-panel-header">
|
|
3
|
+
<div class="rpg-ui-menu-panel-header">{t("rpg.menu.equip")}</div>
|
|
4
4
|
<div class="rpg-ui-menu-panel-body rpg-ui-menu-panel-body-stacked">
|
|
5
5
|
<div>
|
|
6
6
|
<div class="rpg-ui-menu-panel-details rpg-ui-panel">
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
</div>
|
|
17
17
|
<div>
|
|
18
18
|
<div class="rpg-ui-menu-panel-details-title">
|
|
19
|
-
{detailsItem()?.name || currentSlot()?.label || "
|
|
19
|
+
{detailsItem()?.name || currentSlot()?.label || t("rpg.menu.equip")}
|
|
20
20
|
</div>
|
|
21
21
|
<div class="rpg-ui-menu-panel-details-desc">
|
|
22
22
|
{detailsItem()?.description || ""}
|
|
@@ -90,8 +90,10 @@
|
|
|
90
90
|
import { signal, computed, createTabindexNavigator, effect } from "canvasengine";
|
|
91
91
|
import { inject } from "../../../core/inject";
|
|
92
92
|
import { RpgClientEngine } from "../../../RpgClientEngine";
|
|
93
|
+
import { getKeyboardControlBind } from "../../../services/actionInput";
|
|
93
94
|
|
|
94
95
|
const engine = inject(RpgClientEngine);
|
|
96
|
+
const { t } = engine.i18n();
|
|
95
97
|
const keyboardControls = engine.globalConfig.keyboardControls;
|
|
96
98
|
const currentPlayer = engine.scene.currentPlayer;
|
|
97
99
|
|
|
@@ -103,8 +105,8 @@
|
|
|
103
105
|
const slots = computed(() => data().slots);
|
|
104
106
|
|
|
105
107
|
const defaultSlots = [
|
|
106
|
-
{ id: "weapon", label: "
|
|
107
|
-
{ id: "armor", label: "
|
|
108
|
+
{ id: "weapon", label: t("rpg.menu.weapons"), types: ["weapon"] },
|
|
109
|
+
{ id: "armor", label: t("rpg.menu.armor"), types: ["armor"] }
|
|
108
110
|
];
|
|
109
111
|
const resolveProp = (value) => typeof value === "function" ? value() : value;
|
|
110
112
|
const safeEquips = computed(() => {
|
|
@@ -169,15 +171,15 @@
|
|
|
169
171
|
const items = slotItems().map((item) => ({
|
|
170
172
|
...item,
|
|
171
173
|
kind: "item",
|
|
172
|
-
tag: itemEquipped(item) ? "
|
|
174
|
+
tag: itemEquipped(item) ? t("rpg.shop.equipped") : ""
|
|
173
175
|
}));
|
|
174
176
|
const equipped = currentEquippedItem();
|
|
175
177
|
if (!equipped) return items;
|
|
176
178
|
return [
|
|
177
179
|
{
|
|
178
180
|
id: "__unequip__",
|
|
179
|
-
name: "
|
|
180
|
-
description: "
|
|
181
|
+
name: t("rpg.menu.unequip"),
|
|
182
|
+
description: t("rpg.menu.remove-equipment"),
|
|
181
183
|
kind: "unequip",
|
|
182
184
|
tag: ""
|
|
183
185
|
},
|
|
@@ -196,7 +198,7 @@
|
|
|
196
198
|
const slot = currentSlot();
|
|
197
199
|
if (!slot) return "";
|
|
198
200
|
const equipped = currentEquippedItem();
|
|
199
|
-
return equipped ? `${slot.label}: ${equipped.name}` : `${slot.label}:
|
|
201
|
+
return equipped ? `${slot.label}: ${equipped.name}` : `${slot.label}: ${t("rpg.menu.empty")}`;
|
|
200
202
|
});
|
|
201
203
|
const listEmpty = computed(() => listEntries().length === 0);
|
|
202
204
|
|
|
@@ -380,7 +382,7 @@
|
|
|
380
382
|
}
|
|
381
383
|
},
|
|
382
384
|
action: {
|
|
383
|
-
bind: keyboardControls.action,
|
|
385
|
+
bind: getKeyboardControlBind(keyboardControls.action),
|
|
384
386
|
keyDown() {
|
|
385
387
|
if (!listEntries().length) return;
|
|
386
388
|
commitSelection(selectedItem());
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
<DOMContainer width="100%" height="100%" controls={controls}>
|
|
2
2
|
<div class="rpg-ui-menu-panel rpg-ui-panel">
|
|
3
|
-
<div class="rpg-ui-menu-panel-header">
|
|
3
|
+
<div class="rpg-ui-menu-panel-header">{t("rpg.menu.exit")}</div>
|
|
4
4
|
<div class="rpg-ui-menu-panel-body">
|
|
5
5
|
<div class="rpg-ui-menu-panel-details">
|
|
6
|
-
<div class="rpg-ui-menu-panel-details-title">
|
|
6
|
+
<div class="rpg-ui-menu-panel-details-title">{t("rpg.menu.leave-game")}</div>
|
|
7
7
|
<div class="rpg-ui-menu-panel-details-desc">
|
|
8
|
-
|
|
8
|
+
{t("rpg.menu.exit-help")}
|
|
9
9
|
</div>
|
|
10
10
|
</div>
|
|
11
11
|
</div>
|
|
@@ -16,14 +16,16 @@
|
|
|
16
16
|
import { signal } from "canvasengine";
|
|
17
17
|
import { inject } from "../../../core/inject";
|
|
18
18
|
import { RpgClientEngine } from "../../../RpgClientEngine";
|
|
19
|
+
import { getKeyboardControlBind } from "../../../services/actionInput";
|
|
19
20
|
|
|
20
21
|
const engine = inject(RpgClientEngine);
|
|
22
|
+
const { t } = engine.i18n();
|
|
21
23
|
const keyboardControls = engine.globalConfig.keyboardControls;
|
|
22
24
|
const { onConfirm, onBack } = defineProps();
|
|
23
25
|
|
|
24
26
|
const controls = signal({
|
|
25
27
|
action: {
|
|
26
|
-
bind: keyboardControls.action,
|
|
28
|
+
bind: getKeyboardControlBind(keyboardControls.action),
|
|
27
29
|
keyDown() {
|
|
28
30
|
if (onConfirm) onConfirm();
|
|
29
31
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<DOMContainer width="100%" height="100%">
|
|
2
2
|
<div class="rpg-ui-menu-panel rpg-ui-panel">
|
|
3
|
-
<div class="rpg-ui-menu-panel-header">
|
|
3
|
+
<div class="rpg-ui-menu-panel-header">{t("rpg.menu.items")}</div>
|
|
4
4
|
<div class="rpg-ui-menu-panel-body rpg-ui-menu-panel-body-stacked">
|
|
5
5
|
<div>
|
|
6
6
|
@if (currentItem) {
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
@if (confirmOpen) {
|
|
66
66
|
<div class="rpg-ui-menu-confirm">
|
|
67
67
|
<div class="rpg-ui-menu-confirm-card">
|
|
68
|
-
<div class="rpg-ui-menu-confirm-title">
|
|
68
|
+
<div class="rpg-ui-menu-confirm-title">{t("rpg.menu.use")} {confirmItem()?.name}?</div>
|
|
69
69
|
<Navigation tabindex={selectedConfirm} controls={confirmControls}>
|
|
70
70
|
<div class="rpg-ui-menu-confirm-actions">
|
|
71
71
|
@for ((option,index) of confirmOptions) {
|
|
@@ -90,8 +90,10 @@
|
|
|
90
90
|
import { inject } from "../../../core/inject";
|
|
91
91
|
import { RpgClientEngine } from "../../../RpgClientEngine";
|
|
92
92
|
import { delay } from "@rpgjs/common";
|
|
93
|
+
import { getKeyboardControlBind } from "../../../services/actionInput";
|
|
93
94
|
|
|
94
95
|
const engine = inject(RpgClientEngine);
|
|
96
|
+
const { t } = engine.i18n();
|
|
95
97
|
const keyboardControls = engine.globalConfig.keyboardControls;
|
|
96
98
|
|
|
97
99
|
const selectedItem = signal(0);
|
|
@@ -105,9 +107,9 @@
|
|
|
105
107
|
const items = computed(() => data().items);
|
|
106
108
|
|
|
107
109
|
const tabs = [
|
|
108
|
-
{ id: "item", label: "
|
|
109
|
-
{ id: "weapon", label: "
|
|
110
|
-
{ id: "armor", label: "
|
|
110
|
+
{ id: "item", label: t("rpg.menu.items") },
|
|
111
|
+
{ id: "weapon", label: t("rpg.menu.weapons") },
|
|
112
|
+
{ id: "armor", label: t("rpg.menu.armor") }
|
|
111
113
|
];
|
|
112
114
|
|
|
113
115
|
const resolveProp = (value) => typeof value === "function" ? value() : value;
|
|
@@ -124,8 +126,8 @@
|
|
|
124
126
|
});
|
|
125
127
|
|
|
126
128
|
const confirmOptions = [
|
|
127
|
-
{ id: "use", label: "
|
|
128
|
-
{ id: "cancel", label: "
|
|
129
|
+
{ id: "use", label: t("rpg.menu.use") },
|
|
130
|
+
{ id: "cancel", label: t("rpg.menu.cancel") }
|
|
129
131
|
];
|
|
130
132
|
|
|
131
133
|
const nav = createTabindexNavigator(selectedItem, { count: () => filteredItems().length }, "wrap");
|
|
@@ -226,7 +228,7 @@
|
|
|
226
228
|
}
|
|
227
229
|
},
|
|
228
230
|
action: {
|
|
229
|
-
bind: keyboardControls.action,
|
|
231
|
+
bind: getKeyboardControlBind(keyboardControls.action),
|
|
230
232
|
keyDown() {
|
|
231
233
|
if (!confirmOpen()) return;
|
|
232
234
|
confirmSelect(selectedConfirm())();
|
|
@@ -289,7 +291,7 @@
|
|
|
289
291
|
}
|
|
290
292
|
},
|
|
291
293
|
action: {
|
|
292
|
-
bind: keyboardControls.action,
|
|
294
|
+
bind: getKeyboardControlBind(keyboardControls.action),
|
|
293
295
|
keyDown() {
|
|
294
296
|
if (confirmOpen()) {
|
|
295
297
|
confirmSelect(selectedConfirm())();
|