@rpgjs/client 5.0.0-beta.2 → 5.0.0-beta.20
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 +123 -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 +96 -54
- 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 +176 -11
- package/dist/RpgClientEngine.js +669 -68
- 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 +606 -248
- 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.js +2 -2
- package/dist/components/gui/mobile/index.js.map +1 -1
- package/dist/components/gui/mobile/mobile.ce.js +7 -5
- 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 +7 -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/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 +340 -0
- package/src/Gui/Gui.ts +129 -57
- package/src/Resource.ts +1 -2
- package/src/RpgClient.ts +220 -17
- package/src/RpgClientEngine.ts +959 -116
- package/src/components/animations/fx.ce +101 -0
- package/src/components/animations/index.ts +4 -2
- package/src/components/character.ce +681 -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/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 +7 -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/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
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
<div class="rpg-ui-main-menu rpg-anim-fade-in">
|
|
3
3
|
<div class="rpg-ui-main-menu-layout">
|
|
4
4
|
<div class="rpg-ui-main-menu-left rpg-ui-menu rpg-ui-panel">
|
|
5
|
-
<div class="rpg-ui-menu-header">
|
|
5
|
+
<div class="rpg-ui-menu-header">{t("rpg.menu.title")}</div>
|
|
6
6
|
<div class="rpg-ui-main-menu-list">
|
|
7
7
|
@for ((entry,index) of menuEntries()) {
|
|
8
8
|
<div
|
|
@@ -18,14 +18,14 @@
|
|
|
18
18
|
<div class="rpg-ui-main-menu-right">
|
|
19
19
|
@if (view() === "menu") {
|
|
20
20
|
<div class="rpg-ui-panel">
|
|
21
|
-
<div class="rpg-ui-main-menu-section-title">
|
|
21
|
+
<div class="rpg-ui-main-menu-section-title">{t("rpg.menu.status")}</div>
|
|
22
22
|
<div class="rpg-ui-main-menu-status-card">
|
|
23
23
|
<div class="rpg-ui-main-menu-status-block">
|
|
24
|
-
<div class="rpg-ui-main-menu-status-label">
|
|
24
|
+
<div class="rpg-ui-main-menu-status-label">{t("rpg.menu.level")}</div>
|
|
25
25
|
<div class="rpg-ui-main-menu-status-value">{level()}</div>
|
|
26
26
|
</div>
|
|
27
27
|
<div class="rpg-ui-main-menu-status-block">
|
|
28
|
-
<div class="rpg-ui-main-menu-status-label">
|
|
28
|
+
<div class="rpg-ui-main-menu-status-label">{t("rpg.menu.gold")}</div>
|
|
29
29
|
<div class="rpg-ui-main-menu-status-value">{gold()}</div>
|
|
30
30
|
</div>
|
|
31
31
|
<div class="rpg-ui-main-menu-status-block">
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
</div>
|
|
48
48
|
</div>
|
|
49
49
|
</div>
|
|
50
|
-
<div class="rpg-ui-main-menu-section-title">
|
|
50
|
+
<div class="rpg-ui-main-menu-section-title">{t("rpg.menu.parameters")}</div>
|
|
51
51
|
<div class="rpg-ui-main-menu-params">
|
|
52
52
|
@for ((param,index) of paramsList) {
|
|
53
53
|
<div class="rpg-ui-main-menu-param">
|
|
@@ -101,8 +101,10 @@
|
|
|
101
101
|
import ExitMenu from "./exit-menu.ce";
|
|
102
102
|
import { getEntityProp } from "../../../utils/getEntityProp";
|
|
103
103
|
import { delay } from "@rpgjs/common";
|
|
104
|
+
import { getKeyboardControlBind } from "../../../services/actionInput";
|
|
104
105
|
|
|
105
106
|
const engine = inject(RpgClientEngine);
|
|
107
|
+
const { t } = engine.i18n();
|
|
106
108
|
const currentPlayer = engine.scene.currentPlayer;
|
|
107
109
|
const keyboardControls = engine.globalConfig.keyboardControls;
|
|
108
110
|
|
|
@@ -110,12 +112,12 @@
|
|
|
110
112
|
const { menus, items, skills, equips, saveLoad } = data();
|
|
111
113
|
|
|
112
114
|
const defaultMenus = [
|
|
113
|
-
{ id: "items", label: "
|
|
114
|
-
{ id: "skills", label: "
|
|
115
|
-
{ id: "equip", label: "
|
|
116
|
-
{ id: "options", label: "
|
|
117
|
-
{ id: "save", label: "
|
|
118
|
-
{ id: "exit", label: "
|
|
115
|
+
{ id: "items", label: t("rpg.menu.items") },
|
|
116
|
+
{ id: "skills", label: t("rpg.menu.skills") },
|
|
117
|
+
{ id: "equip", label: t("rpg.menu.equip") },
|
|
118
|
+
{ id: "options", label: t("rpg.menu.options") },
|
|
119
|
+
{ id: "save", label: t("rpg.menu.save") },
|
|
120
|
+
{ id: "exit", label: t("rpg.menu.exit") }
|
|
119
121
|
];
|
|
120
122
|
|
|
121
123
|
const menuEntries = computed(() => {
|
|
@@ -259,7 +261,7 @@
|
|
|
259
261
|
}
|
|
260
262
|
},
|
|
261
263
|
action: {
|
|
262
|
-
bind: keyboardControls.action,
|
|
264
|
+
bind: getKeyboardControlBind(keyboardControls.action),
|
|
263
265
|
keyDown() {
|
|
264
266
|
if (saveOverlay()) return;
|
|
265
267
|
if (view() !== "menu") return;
|
|
@@ -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.options")}</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.options")}</div>
|
|
7
7
|
<div class="rpg-ui-menu-panel-details-desc">
|
|
8
|
-
|
|
8
|
+
{t("rpg.menu.options-help")}
|
|
9
9
|
</div>
|
|
10
10
|
</div>
|
|
11
11
|
</div>
|
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
import { RpgClientEngine } from "../../../RpgClientEngine";
|
|
19
19
|
|
|
20
20
|
const engine = inject(RpgClientEngine);
|
|
21
|
+
const { t } = engine.i18n();
|
|
21
22
|
const keyboardControls = engine.globalConfig.keyboardControls;
|
|
22
23
|
const { onBack } = defineProps();
|
|
23
24
|
|
|
@@ -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.skills")}</div>
|
|
4
4
|
<div class="rpg-ui-menu-panel-body rpg-ui-menu-panel-body-stacked">
|
|
5
5
|
<div class="rpg-ui-menu-panel-details rpg-ui-panel">
|
|
6
6
|
@if (currentSkill) {
|
|
@@ -38,6 +38,7 @@
|
|
|
38
38
|
import { RpgClientEngine } from "../../../RpgClientEngine";
|
|
39
39
|
|
|
40
40
|
const engine = inject(RpgClientEngine);
|
|
41
|
+
const { t } = engine.i18n();
|
|
41
42
|
const keyboardControls = engine.globalConfig.keyboardControls;
|
|
42
43
|
|
|
43
44
|
const selectedSkill = signal(0);
|
|
@@ -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()
|
|
@@ -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
|
|
|
@@ -51,12 +53,12 @@
|
|
|
51
53
|
const { entries, title, subtitle, version, saveLoad, localActions } = data();
|
|
52
54
|
|
|
53
55
|
const defaultEntries = [
|
|
54
|
-
{ id: "start", label: "
|
|
55
|
-
{ id: "load", label: "
|
|
56
|
+
{ id: "start", label: t("rpg.title.start") },
|
|
57
|
+
{ id: "load", label: t("rpg.title.load") }
|
|
56
58
|
];
|
|
57
59
|
|
|
58
60
|
const resolveProp = (value) => typeof value === "function" ? value() : value;
|
|
59
|
-
const titleText = computed(() => resolveProp(title) || "
|
|
61
|
+
const titleText = computed(() => resolveProp(title) || t("rpg.title.default"));
|
|
60
62
|
const subtitleText = computed(() => resolveProp(subtitle) || "");
|
|
61
63
|
const versionText = computed(() => resolveProp(version) || "");
|
|
62
64
|
const localActionsEnabled = computed(() => resolveProp(localActions) === true);
|
|
@@ -150,7 +152,7 @@
|
|
|
150
152
|
}
|
|
151
153
|
},
|
|
152
154
|
action: {
|
|
153
|
-
bind: keyboardControls.action,
|
|
155
|
+
bind: getKeyboardControlBind(keyboardControls.action),
|
|
154
156
|
keyDown() {
|
|
155
157
|
if (guiService.isDisplaying(PrebuiltGui.Save)) return;
|
|
156
158
|
triggerSelect(selectedEntry());
|
package/src/components/index.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import EventLayerComponent from "./scenes/event-layer.ce";
|
|
2
|
+
import SceneMap from "./scenes/draw-map.ce";
|
|
2
3
|
import CharacterComponent from "./character.ce";
|
|
3
4
|
|
|
4
5
|
// Prebuilt sprite components
|
|
5
6
|
export { HpBar } from "./prebuilt";
|
|
6
7
|
|
|
7
|
-
export { EventLayerComponent, CharacterComponent }
|
|
8
|
+
export { EventLayerComponent, SceneMap, CharacterComponent }
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
<Container>
|
|
2
|
+
@for (entry of renderedComponents) {
|
|
3
|
+
<Container dependencies={entry.dependencies}>
|
|
4
|
+
<entry.component ...entry.props />
|
|
5
|
+
</Container>
|
|
6
|
+
}
|
|
7
|
+
</Container>
|
|
8
|
+
|
|
9
|
+
<script>
|
|
10
|
+
import { computed } from "canvasengine";
|
|
11
|
+
import { RpgClientEngine } from "../RpgClientEngine";
|
|
12
|
+
import { inject } from "../core/inject";
|
|
13
|
+
|
|
14
|
+
const { object, bounds, hitboxBounds, graphicBounds } = defineProps();
|
|
15
|
+
const client = inject(RpgClientEngine);
|
|
16
|
+
const sprite = object();
|
|
17
|
+
|
|
18
|
+
const renderedComponents = computed(() => client.interactions.getRenderedComponents(sprite, {
|
|
19
|
+
bounds: typeof bounds === "function" ? bounds() : undefined,
|
|
20
|
+
hitbox: typeof hitboxBounds === "function" ? hitboxBounds() : undefined,
|
|
21
|
+
graphic: typeof graphicBounds === "function" ? graphicBounds() : undefined,
|
|
22
|
+
}));
|
|
23
|
+
</script>
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { describe, expect, test } from "vitest";
|
|
2
|
+
import {
|
|
3
|
+
computeBlockPosition,
|
|
4
|
+
computeBlockSize,
|
|
5
|
+
estimateComponentSize,
|
|
6
|
+
getComponentProps
|
|
7
|
+
} from "./player-components-utils";
|
|
8
|
+
|
|
9
|
+
const graphic = {
|
|
10
|
+
left: -8,
|
|
11
|
+
top: -24,
|
|
12
|
+
right: 40,
|
|
13
|
+
bottom: 48,
|
|
14
|
+
width: 48,
|
|
15
|
+
height: 72,
|
|
16
|
+
centerX: 16,
|
|
17
|
+
centerY: 12
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
describe("player component layout utilities", () => {
|
|
21
|
+
test("bottom layout uses the hitbox as positioning rectangle", () => {
|
|
22
|
+
const rowMetrics = [
|
|
23
|
+
{
|
|
24
|
+
cells: [{ width: 32, height: 32 }],
|
|
25
|
+
width: 32,
|
|
26
|
+
height: 32
|
|
27
|
+
}
|
|
28
|
+
];
|
|
29
|
+
|
|
30
|
+
const size = computeBlockSize({
|
|
31
|
+
position: "bottom",
|
|
32
|
+
rowMetrics,
|
|
33
|
+
graphic,
|
|
34
|
+
hitbox: { w: 32, h: 32 }
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
expect(size).toEqual({ width: 32, height: 32 });
|
|
38
|
+
expect(
|
|
39
|
+
computeBlockPosition({
|
|
40
|
+
position: "bottom",
|
|
41
|
+
size,
|
|
42
|
+
graphic,
|
|
43
|
+
hitbox: { w: 32, h: 32 }
|
|
44
|
+
})
|
|
45
|
+
).toEqual({ x: 0, y: 0 });
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
test("bottom layout centers smaller content in the hitbox rectangle", () => {
|
|
49
|
+
const size = computeBlockSize({
|
|
50
|
+
position: "bottom",
|
|
51
|
+
rowMetrics: [
|
|
52
|
+
{
|
|
53
|
+
cells: [{ width: 16, height: 8 }],
|
|
54
|
+
width: 16,
|
|
55
|
+
height: 8
|
|
56
|
+
}
|
|
57
|
+
],
|
|
58
|
+
graphic,
|
|
59
|
+
hitbox: { w: 32, h: 32 }
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
expect(size).toEqual({ width: 32, height: 32 });
|
|
63
|
+
expect(
|
|
64
|
+
computeBlockPosition({
|
|
65
|
+
position: "bottom",
|
|
66
|
+
size,
|
|
67
|
+
graphic,
|
|
68
|
+
hitbox: { w: 32, h: 32 }
|
|
69
|
+
})
|
|
70
|
+
).toEqual({ x: 0, y: 0 });
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
test("bottom margins move from the hitbox-centered position", () => {
|
|
74
|
+
const position = computeBlockPosition({
|
|
75
|
+
position: "bottom",
|
|
76
|
+
size: { width: 32, height: 32 },
|
|
77
|
+
layout: { marginLeft: 3, marginRight: 1, marginBottom: 16, marginTop: 4 },
|
|
78
|
+
graphic,
|
|
79
|
+
hitbox: { w: 32, h: 32 }
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
expect(position).toEqual({ x: 2, y: 12 });
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
test("top layout remains anchored above graphic bounds", () => {
|
|
86
|
+
const position = computeBlockPosition({
|
|
87
|
+
position: "top",
|
|
88
|
+
size: { width: 50, height: 12 },
|
|
89
|
+
graphic,
|
|
90
|
+
hitbox: { w: 32, h: 32 }
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
expect(position).toEqual({ x: -9, y: -36 });
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
test("estimates bar labels, shape aliases, circles, lines and polygons", () => {
|
|
97
|
+
expect(estimateComponentSize({ type: "hpBar", style: { width: 60, height: 6 }, text: "{$percent}%" })).toEqual({ width: 60, height: 18 });
|
|
98
|
+
expect(estimateComponentSize({ type: "shape", value: { type: "rect", width: 32, height: 24 } })).toEqual({ width: 32, height: 24 });
|
|
99
|
+
expect(estimateComponentSize({ type: "shape", value: { type: "circle", radius: 7 } })).toEqual({ width: 14, height: 14 });
|
|
100
|
+
expect(estimateComponentSize({ type: "shape", value: { type: "line", x1: -4, y1: 2, x2: 6, y2: 2 } })).toEqual({ width: 10, height: 1 });
|
|
101
|
+
expect(estimateComponentSize({ type: "shape", value: { type: "polygon", points: [-5, 2, 15, 2, 5, 12] } })).toEqual({ width: 20, height: 10 });
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
test("legacy hp and sp bars receive default fill colors", () => {
|
|
105
|
+
expect(getComponentProps({ type: "hpBar" }).style.fillColor).toBe("#ef4444");
|
|
106
|
+
expect(getComponentProps({ type: "spBar" }).style.fillColor).toBe("#3b82f6");
|
|
107
|
+
expect(getComponentProps({ type: "hpBar", style: { fillColor: "#111111" } }).style.fillColor).toBe("#111111");
|
|
108
|
+
});
|
|
109
|
+
});
|