@rpgjs/client 5.0.0-alpha.9 → 5.0.0-beta.10
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 +37 -0
- package/LICENSE +19 -0
- package/dist/Game/AnimationManager.d.ts +8 -0
- package/dist/Game/AnimationManager.js +35 -0
- package/dist/Game/AnimationManager.js.map +1 -0
- package/dist/Game/AnimationManager.spec.d.ts +1 -0
- package/dist/Game/Event.d.ts +1 -1
- package/dist/Game/Event.js +12 -0
- package/dist/Game/Event.js.map +1 -0
- package/dist/Game/Map.d.ts +31 -2
- package/dist/Game/Map.js +138 -0
- package/dist/Game/Map.js.map +1 -0
- package/dist/Game/Object.d.ts +189 -0
- package/dist/Game/Object.js +255 -0
- package/dist/Game/Object.js.map +1 -0
- package/dist/Game/Player.d.ts +1 -1
- package/dist/Game/Player.js +12 -0
- package/dist/Game/Player.js.map +1 -0
- package/dist/Gui/Gui.d.ts +192 -7
- package/dist/Gui/Gui.js +475 -0
- package/dist/Gui/Gui.js.map +1 -0
- package/dist/Gui/Gui.spec.d.ts +1 -0
- package/dist/Gui/NotificationManager.d.ts +23 -0
- package/dist/Gui/NotificationManager.js +49 -0
- package/dist/Gui/NotificationManager.js.map +1 -0
- package/dist/Resource.d.ts +97 -0
- package/dist/Resource.js +133 -0
- package/dist/Resource.js.map +1 -0
- package/dist/RpgClient.d.ts +295 -13
- package/dist/RpgClientEngine.d.ts +671 -15
- package/dist/RpgClientEngine.js +1442 -0
- package/dist/RpgClientEngine.js.map +1 -0
- package/dist/Sound.d.ts +199 -0
- package/dist/Sound.js +167 -0
- package/dist/Sound.js.map +1 -0
- package/dist/_virtual/_@oxc-project_runtime@0.130.0/helpers/decorate.js +9 -0
- package/dist/_virtual/_@oxc-project_runtime@0.130.0/helpers/decorateMetadata.js +6 -0
- package/dist/components/animations/animation.ce.js +23 -0
- package/dist/components/animations/animation.ce.js.map +1 -0
- package/dist/components/animations/hit.ce.js +64 -0
- package/dist/components/animations/hit.ce.js.map +1 -0
- package/dist/components/animations/index.d.ts +4 -0
- package/dist/components/animations/index.js +11 -0
- package/dist/components/animations/index.js.map +1 -0
- package/dist/components/character.ce.js +572 -0
- package/dist/components/character.ce.js.map +1 -0
- package/dist/components/dynamics/bar.ce.js +96 -0
- package/dist/components/dynamics/bar.ce.js.map +1 -0
- package/dist/components/dynamics/image.ce.js +23 -0
- package/dist/components/dynamics/image.ce.js.map +1 -0
- package/dist/components/dynamics/parse-value.d.ts +4 -0
- package/dist/components/dynamics/parse-value.js +63 -0
- package/dist/components/dynamics/parse-value.js.map +1 -0
- 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 +83 -0
- package/dist/components/dynamics/shape.ce.js.map +1 -0
- package/dist/components/dynamics/text.ce.js +50 -0
- package/dist/components/dynamics/text.ce.js.map +1 -0
- package/dist/components/gui/box.ce.js +26 -0
- package/dist/components/gui/box.ce.js.map +1 -0
- package/dist/components/gui/dialogbox/index.ce.js +198 -0
- package/dist/components/gui/dialogbox/index.ce.js.map +1 -0
- package/dist/components/gui/gameover.ce.js +169 -0
- package/dist/components/gui/gameover.ce.js.map +1 -0
- package/dist/components/gui/hud/hud.ce.js +83 -0
- package/dist/components/gui/hud/hud.ce.js.map +1 -0
- package/dist/components/gui/index.d.ts +15 -3
- package/dist/components/gui/index.js +14 -0
- package/dist/components/gui/menu/equip-menu.ce.js +427 -0
- package/dist/components/gui/menu/equip-menu.ce.js.map +1 -0
- package/dist/components/gui/menu/exit-menu.ce.js +55 -0
- package/dist/components/gui/menu/exit-menu.ce.js.map +1 -0
- package/dist/components/gui/menu/items-menu.ce.js +326 -0
- package/dist/components/gui/menu/items-menu.ce.js.map +1 -0
- package/dist/components/gui/menu/main-menu.ce.js +399 -0
- package/dist/components/gui/menu/main-menu.ce.js.map +1 -0
- package/dist/components/gui/menu/options-menu.ce.js +49 -0
- package/dist/components/gui/menu/options-menu.ce.js.map +1 -0
- package/dist/components/gui/menu/skills-menu.ce.js +102 -0
- package/dist/components/gui/menu/skills-menu.ce.js.map +1 -0
- package/dist/components/gui/mobile/index.d.ts +8 -0
- package/dist/components/gui/mobile/index.js +21 -0
- package/dist/components/gui/mobile/index.js.map +1 -0
- package/dist/components/gui/mobile/mobile.ce.js +79 -0
- package/dist/components/gui/mobile/mobile.ce.js.map +1 -0
- package/dist/components/gui/notification/notification.ce.js +62 -0
- package/dist/components/gui/notification/notification.ce.js.map +1 -0
- package/dist/components/gui/save-load.ce.js +211 -0
- package/dist/components/gui/save-load.ce.js.map +1 -0
- package/dist/components/gui/shop/shop.ce.js +614 -0
- package/dist/components/gui/shop/shop.ce.js.map +1 -0
- package/dist/components/gui/title-screen.ce.js +164 -0
- package/dist/components/gui/title-screen.ce.js.map +1 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.js +4 -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 +188 -0
- package/dist/components/player-components.ce.js.map +1 -0
- package/dist/components/prebuilt/hp-bar.ce.js +113 -0
- package/dist/components/prebuilt/hp-bar.ce.js.map +1 -0
- package/dist/components/prebuilt/index.d.ts +19 -0
- package/dist/components/prebuilt/index.js +2 -0
- package/dist/components/prebuilt/light-halo.ce.js +70 -0
- package/dist/components/prebuilt/light-halo.ce.js.map +1 -0
- package/dist/components/scenes/canvas.ce.js +196 -0
- package/dist/components/scenes/canvas.ce.js.map +1 -0
- package/dist/components/scenes/draw-map.ce.js +79 -0
- package/dist/components/scenes/draw-map.ce.js.map +1 -0
- package/dist/components/scenes/event-layer.ce.js +29 -0
- package/dist/components/scenes/event-layer.ce.js.map +1 -0
- package/dist/core/inject.js +18 -0
- package/dist/core/inject.js.map +1 -0
- package/dist/core/setup.js +16 -0
- package/dist/core/setup.js.map +1 -0
- 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/index.d.ts +16 -1
- package/dist/index.js +45 -14
- package/dist/module.d.ts +43 -4
- package/dist/module.js +179 -0
- package/dist/module.js.map +1 -0
- package/dist/node_modules/.pnpm/@signe_di@3.0.1/node_modules/@signe/di/dist/index.js +167 -0
- package/dist/node_modules/.pnpm/@signe_di@3.0.1/node_modules/@signe/di/dist/index.js.map +1 -0
- package/dist/node_modules/.pnpm/@signe_reactive@3.0.1/node_modules/@signe/reactive/dist/index.js +239 -0
- package/dist/node_modules/.pnpm/@signe_reactive@3.0.1/node_modules/@signe/reactive/dist/index.js.map +1 -0
- package/dist/node_modules/.pnpm/@signe_room@3.0.1/node_modules/@signe/room/dist/chunk-EUXUH3YW.js +13 -0
- package/dist/node_modules/.pnpm/@signe_room@3.0.1/node_modules/@signe/room/dist/chunk-EUXUH3YW.js.map +1 -0
- package/dist/node_modules/.pnpm/@signe_room@3.0.1/node_modules/@signe/room/dist/index.js +696 -0
- package/dist/node_modules/.pnpm/@signe_room@3.0.1/node_modules/@signe/room/dist/index.js.map +1 -0
- package/dist/node_modules/.pnpm/@signe_sync@3.0.1/node_modules/@signe/sync/dist/client/index.js +44 -0
- package/dist/node_modules/.pnpm/@signe_sync@3.0.1/node_modules/@signe/sync/dist/client/index.js.map +1 -0
- package/dist/node_modules/.pnpm/@signe_sync@3.0.1/node_modules/@signe/sync/dist/index.js +241 -0
- package/dist/node_modules/.pnpm/@signe_sync@3.0.1/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 +115 -0
- package/dist/node_modules/.pnpm/partysocket@1.1.3/node_modules/partysocket/dist/chunk-HAC622V3.js.map +1 -0
- package/dist/node_modules/.pnpm/partysocket@1.1.3/node_modules/partysocket/dist/chunk-S74YV6PU.js +401 -0
- package/dist/node_modules/.pnpm/partysocket@1.1.3/node_modules/partysocket/dist/chunk-S74YV6PU.js.map +1 -0
- package/dist/node_modules/.pnpm/partysocket@1.1.3/node_modules/partysocket/dist/index.js +2 -0
- package/dist/node_modules/.pnpm/zod@3.24.2/node_modules/zod/lib/index.js +3756 -0
- package/dist/node_modules/.pnpm/zod@3.24.2/node_modules/zod/lib/index.js.map +1 -0
- package/dist/presets/animation.d.ts +31 -0
- package/dist/presets/animation.js +39 -0
- package/dist/presets/animation.js.map +1 -0
- package/dist/presets/faceset.d.ts +30 -0
- package/dist/presets/faceset.js +51 -0
- package/dist/presets/faceset.js.map +1 -0
- package/dist/presets/icon.d.ts +20 -0
- package/dist/presets/icon.js +15 -0
- package/dist/presets/icon.js.map +1 -0
- package/dist/presets/index.d.ts +123 -0
- package/dist/presets/index.js +17 -0
- package/dist/presets/index.js.map +1 -0
- package/dist/presets/lpc.d.ts +89 -0
- package/dist/presets/lpc.js +98 -0
- package/dist/presets/lpc.js.map +1 -0
- package/dist/presets/rmspritesheet.js +42 -0
- package/dist/presets/rmspritesheet.js.map +1 -0
- package/dist/services/AbstractSocket.d.ts +9 -5
- package/dist/services/AbstractSocket.js +11 -0
- package/dist/services/AbstractSocket.js.map +1 -0
- package/dist/services/keyboardControls.d.ts +15 -0
- package/dist/services/keyboardControls.js +23 -0
- package/dist/services/keyboardControls.js.map +1 -0
- package/dist/services/loadMap.d.ts +6 -0
- package/dist/services/loadMap.js +123 -0
- package/dist/services/loadMap.js.map +1 -0
- package/dist/services/mmorpg.d.ts +21 -9
- package/dist/services/mmorpg.js +136 -0
- package/dist/services/mmorpg.js.map +1 -0
- package/dist/services/save.d.ts +19 -0
- package/dist/services/save.js +77 -0
- package/dist/services/save.js.map +1 -0
- package/dist/services/save.spec.d.ts +1 -0
- package/dist/services/standalone.d.ts +67 -7
- package/dist/services/standalone.js +168 -0
- package/dist/services/standalone.js.map +1 -0
- package/dist/utils/getEntityProp.d.ts +39 -0
- package/dist/utils/getEntityProp.js +53 -0
- package/dist/utils/getEntityProp.js.map +1 -0
- package/dist/utils/getEntityProp.spec.d.ts +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 +14 -11
- package/src/Game/AnimationManager.spec.ts +30 -0
- package/src/Game/AnimationManager.ts +33 -0
- package/src/Game/Event.ts +1 -1
- package/src/Game/Map.ts +184 -3
- package/src/Game/Object.ts +409 -14
- package/src/Game/Player.ts +1 -1
- package/src/Gui/Gui.spec.ts +273 -0
- package/src/Gui/Gui.ts +566 -23
- package/src/Gui/NotificationManager.ts +69 -0
- package/src/Resource.ts +149 -0
- package/src/RpgClient.ts +309 -14
- package/src/RpgClientEngine.ts +1790 -63
- package/src/Sound.ts +253 -0
- package/src/components/{effects → animations}/animation.ce +3 -6
- package/src/components/{effects → animations}/index.ts +1 -1
- package/src/components/character.ce +801 -59
- package/src/components/dynamics/bar.ce +87 -0
- package/src/components/dynamics/image.ce +20 -0
- package/src/components/dynamics/parse-value.spec.ts +83 -0
- package/src/components/dynamics/parse-value.ts +154 -0
- 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 +89 -0
- package/src/components/dynamics/text.ce +68 -0
- package/src/components/gui/box.ce +17 -0
- package/src/components/gui/dialogbox/index.ce +213 -187
- package/src/components/gui/gameover.ce +158 -0
- package/src/components/gui/hud/hud.ce +61 -0
- package/src/components/gui/index.ts +30 -4
- package/src/components/gui/menu/equip-menu.ce +410 -0
- package/src/components/gui/menu/exit-menu.ce +41 -0
- package/src/components/gui/menu/items-menu.ce +317 -0
- package/src/components/gui/menu/main-menu.ce +294 -0
- package/src/components/gui/menu/options-menu.ce +35 -0
- package/src/components/gui/menu/skills-menu.ce +83 -0
- package/src/components/gui/mobile/index.ts +24 -0
- package/src/components/gui/mobile/mobile.ce +80 -0
- package/src/components/gui/notification/notification.ce +51 -0
- package/src/components/gui/save-load.ce +208 -0
- package/src/components/gui/shop/shop.ce +493 -0
- package/src/components/gui/title-screen.ce +163 -0
- package/src/components/index.ts +3 -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 +221 -0
- package/src/components/prebuilt/hp-bar.ce +255 -0
- package/src/components/prebuilt/index.ts +24 -0
- package/src/components/prebuilt/light-halo.ce +148 -0
- package/src/components/scenes/canvas.ce +185 -21
- package/src/components/scenes/draw-map.ce +55 -21
- package/src/components/scenes/event-layer.ce +8 -2
- package/src/components/scenes/transition.ce +60 -0
- package/src/core/setup.ts +2 -2
- package/src/decorators/spritesheet.ts +8 -0
- package/src/index.ts +17 -2
- package/src/module.ts +132 -10
- package/src/presets/animation.ts +46 -0
- package/src/presets/faceset.ts +60 -0
- package/src/presets/icon.ts +17 -0
- package/src/presets/index.ts +9 -1
- package/src/presets/lpc.ts +108 -0
- package/src/services/AbstractSocket.ts +10 -2
- package/src/services/keyboardControls.ts +20 -0
- package/src/services/loadMap.ts +3 -1
- package/src/services/mmorpg.ts +106 -12
- package/src/services/save.spec.ts +127 -0
- package/src/services/save.ts +103 -0
- package/src/services/standalone.ts +110 -18
- package/src/utils/getEntityProp.spec.ts +96 -0
- package/src/utils/getEntityProp.ts +88 -0
- package/src/utils/readPropValue.ts +16 -0
- package/vite.config.ts +4 -2
- package/dist/Game/EffectManager.d.ts +0 -5
- package/dist/components/effects/index.d.ts +0 -4
- package/dist/index.js.map +0 -1
- package/dist/index10.js +0 -8
- package/dist/index10.js.map +0 -1
- package/dist/index11.js +0 -10
- package/dist/index11.js.map +0 -1
- package/dist/index12.js +0 -8
- package/dist/index12.js.map +0 -1
- package/dist/index13.js +0 -17
- package/dist/index13.js.map +0 -1
- package/dist/index14.js +0 -107
- package/dist/index14.js.map +0 -1
- package/dist/index15.js +0 -50
- package/dist/index15.js.map +0 -1
- package/dist/index16.js +0 -191
- package/dist/index16.js.map +0 -1
- package/dist/index17.js +0 -9
- package/dist/index17.js.map +0 -1
- package/dist/index18.js +0 -387
- package/dist/index18.js.map +0 -1
- package/dist/index19.js +0 -31
- package/dist/index19.js.map +0 -1
- package/dist/index2.js +0 -181
- package/dist/index2.js.map +0 -1
- package/dist/index20.js +0 -24
- package/dist/index20.js.map +0 -1
- package/dist/index21.js +0 -2421
- package/dist/index21.js.map +0 -1
- package/dist/index22.js +0 -114
- package/dist/index22.js.map +0 -1
- package/dist/index23.js +0 -109
- package/dist/index23.js.map +0 -1
- package/dist/index24.js +0 -71
- package/dist/index24.js.map +0 -1
- package/dist/index25.js +0 -21
- package/dist/index25.js.map +0 -1
- package/dist/index26.js +0 -41
- package/dist/index26.js.map +0 -1
- package/dist/index27.js +0 -5
- package/dist/index27.js.map +0 -1
- package/dist/index28.js +0 -322
- package/dist/index28.js.map +0 -1
- package/dist/index29.js +0 -27
- package/dist/index29.js.map +0 -1
- package/dist/index3.js +0 -87
- package/dist/index3.js.map +0 -1
- package/dist/index30.js +0 -11
- package/dist/index30.js.map +0 -1
- package/dist/index31.js +0 -11
- package/dist/index31.js.map +0 -1
- package/dist/index32.js +0 -174
- package/dist/index32.js.map +0 -1
- package/dist/index33.js +0 -501
- package/dist/index33.js.map +0 -1
- package/dist/index34.js +0 -12
- package/dist/index34.js.map +0 -1
- package/dist/index35.js +0 -4403
- package/dist/index35.js.map +0 -1
- package/dist/index36.js +0 -316
- package/dist/index36.js.map +0 -1
- package/dist/index37.js +0 -61
- package/dist/index37.js.map +0 -1
- package/dist/index38.js +0 -20
- package/dist/index38.js.map +0 -1
- package/dist/index39.js +0 -20
- package/dist/index39.js.map +0 -1
- package/dist/index4.js +0 -67
- package/dist/index4.js.map +0 -1
- package/dist/index5.js +0 -16
- package/dist/index5.js.map +0 -1
- package/dist/index6.js +0 -17
- package/dist/index6.js.map +0 -1
- package/dist/index7.js +0 -39
- package/dist/index7.js.map +0 -1
- package/dist/index8.js +0 -108
- package/dist/index8.js.map +0 -1
- package/dist/index9.js +0 -76
- package/dist/index9.js.map +0 -1
- package/src/Game/EffectManager.ts +0 -20
- package/src/components/gui/dialogbox/itemMenu.ce +0 -23
- package/src/components/gui/dialogbox/selection.ce +0 -67
- /package/src/components/{effects → animations}/hit.ce +0 -0
|
@@ -1,39 +1,73 @@
|
|
|
1
|
-
<Container sound={backgroundMusic} >
|
|
1
|
+
<Container sound={backgroundMusic} shake={shakeConfig} freeze={engine.gamePause}>
|
|
2
2
|
<Container sound={backgroundAmbientSound} />
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
@if (map() && sceneComponent()) {
|
|
5
|
+
<sceneComponent() data={map().data} params={map().params} />
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
@for (componentAnimation of componentAnimations) {
|
|
7
9
|
<Container>
|
|
8
|
-
@for (animation of
|
|
9
|
-
<
|
|
10
|
+
@for (animation of componentAnimation.current) {
|
|
11
|
+
<componentAnimation.component ...animation />
|
|
10
12
|
}
|
|
11
13
|
</Container>
|
|
12
14
|
}
|
|
15
|
+
|
|
16
|
+
@if (weatherProps()) {
|
|
17
|
+
<Weather ...weatherProps() />
|
|
18
|
+
}
|
|
13
19
|
</Container>
|
|
14
20
|
|
|
15
21
|
<script>
|
|
16
|
-
import {
|
|
22
|
+
import { computed } from 'canvasengine'
|
|
17
23
|
import { inject } from "../../core/inject";
|
|
18
24
|
import { RpgClientEngine } from "../../RpgClientEngine";
|
|
25
|
+
import { Weather } from '@canvasengine/presets'
|
|
19
26
|
|
|
20
27
|
const engine = inject(RpgClientEngine);
|
|
21
|
-
const
|
|
22
|
-
const map = engine.sceneMap
|
|
28
|
+
const componentAnimations = engine.componentAnimations
|
|
29
|
+
const map = engine.sceneMap?.data
|
|
23
30
|
const sceneComponent = computed(() => map()?.component)
|
|
24
|
-
const
|
|
25
|
-
const
|
|
26
|
-
const animations = engine.sceneMap.animations
|
|
31
|
+
const mapParams = map()?.params
|
|
32
|
+
const weather = engine.sceneMap.weather
|
|
27
33
|
const backgroundMusic = { src: mapParams?.backgroundMusic, autoplay: true, loop: true }
|
|
28
34
|
const backgroundAmbientSound = { src: mapParams?.backgroundAmbientSound, autoplay: true, loop: true }
|
|
29
|
-
|
|
30
|
-
const data = signal(map().data)
|
|
31
35
|
|
|
32
|
-
const
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
direction:
|
|
36
|
+
const shakeConfig = {
|
|
37
|
+
trigger: engine.mapShakeTrigger,
|
|
38
|
+
intensity: 10,
|
|
39
|
+
duration: 500,
|
|
40
|
+
frequency: 10,
|
|
41
|
+
direction: 'both'
|
|
38
42
|
}
|
|
39
|
-
|
|
43
|
+
|
|
44
|
+
const weatherProps = computed(() => {
|
|
45
|
+
const state = weather?.()
|
|
46
|
+
if (!state) {
|
|
47
|
+
return null
|
|
48
|
+
}
|
|
49
|
+
const validEffects = ['rain', 'snow', 'fog', 'cloud']
|
|
50
|
+
if (!validEffects.includes(state.effect)) {
|
|
51
|
+
return null
|
|
52
|
+
}
|
|
53
|
+
const params = state.params ?? {}
|
|
54
|
+
return {
|
|
55
|
+
effect: state.effect,
|
|
56
|
+
speed: params.speed,
|
|
57
|
+
windDirection: params.windDirection,
|
|
58
|
+
windStrength: params.windStrength,
|
|
59
|
+
density: params.density,
|
|
60
|
+
maxDrops: params.maxDrops,
|
|
61
|
+
height: params.height,
|
|
62
|
+
scale: params.scale,
|
|
63
|
+
sunIntensity: params.sunIntensity,
|
|
64
|
+
sunAngle: params.sunAngle,
|
|
65
|
+
raySpread: params.raySpread,
|
|
66
|
+
rayTwinkle: params.rayTwinkle,
|
|
67
|
+
rayTwinkleSpeed: params.rayTwinkleSpeed,
|
|
68
|
+
zIndex: params.zIndex ?? 1000,
|
|
69
|
+
alpha: params.alpha,
|
|
70
|
+
blendMode: params.blendMode,
|
|
71
|
+
}
|
|
72
|
+
})
|
|
73
|
+
</script>
|
|
@@ -6,15 +6,21 @@
|
|
|
6
6
|
@for ((player,id) of players) {
|
|
7
7
|
<Character id={id} object={player} />
|
|
8
8
|
}
|
|
9
|
+
|
|
10
|
+
@for (child of children) {
|
|
11
|
+
<child />
|
|
12
|
+
}
|
|
9
13
|
</Container>
|
|
10
14
|
|
|
11
15
|
<script>
|
|
12
|
-
import { effect, signal } from 'canvasengine'
|
|
13
16
|
import { inject } from "../../core/inject";
|
|
14
17
|
import { RpgClientEngine } from "../../RpgClientEngine";
|
|
15
18
|
import Character from "../character.ce";
|
|
19
|
+
import LightHalo from "../prebuilt/light-halo.ce";
|
|
16
20
|
|
|
17
21
|
const engine = inject(RpgClientEngine);
|
|
22
|
+
const { children } = defineProps()
|
|
23
|
+
|
|
18
24
|
const players = engine.sceneMap.players
|
|
19
25
|
const events = engine.sceneMap.events
|
|
20
|
-
</script>
|
|
26
|
+
</script>
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
<Rect
|
|
2
|
+
x={0}
|
|
3
|
+
y={0}
|
|
4
|
+
width={engine.width}
|
|
5
|
+
height={engine.height}
|
|
6
|
+
fill={color}
|
|
7
|
+
alpha={opacity}
|
|
8
|
+
zIndex={100000}
|
|
9
|
+
/>
|
|
10
|
+
|
|
11
|
+
<script>
|
|
12
|
+
import { animatedSignal, mount, computed, signal } from "canvasengine";
|
|
13
|
+
import { inject } from "../../core/inject";
|
|
14
|
+
import { RpgClientEngine } from "../../RpgClientEngine";
|
|
15
|
+
|
|
16
|
+
const {
|
|
17
|
+
onFinish,
|
|
18
|
+
duration,
|
|
19
|
+
color,
|
|
20
|
+
fadeIn
|
|
21
|
+
} = defineProps({
|
|
22
|
+
duration: {
|
|
23
|
+
default: 1000
|
|
24
|
+
},
|
|
25
|
+
color: {
|
|
26
|
+
default: 'black'
|
|
27
|
+
},
|
|
28
|
+
fadeIn: {
|
|
29
|
+
default: true
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
const engine = inject(RpgClientEngine);
|
|
34
|
+
|
|
35
|
+
// Calculate width and height from engine
|
|
36
|
+
const width = computed(() => {
|
|
37
|
+
const w = engine.width();
|
|
38
|
+
return typeof w === 'string' ? parseInt(w) || 1920 : w;
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
const height = computed(() => {
|
|
42
|
+
const h = engine.height();
|
|
43
|
+
return typeof h === 'string' ? parseInt(h) || 1080 : h;
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
// Animation: fade in from transparent to opaque, or fade out from opaque to transparent
|
|
47
|
+
const opacity = animatedSignal(fadeIn() ? 0 : 1, {
|
|
48
|
+
duration: duration(),
|
|
49
|
+
onComplete: () => {
|
|
50
|
+
if (onFinish) {
|
|
51
|
+
onFinish();
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
mount(() => {
|
|
57
|
+
// Start the fade animation
|
|
58
|
+
opacity.set(fadeIn() ? 1 : 0);
|
|
59
|
+
});
|
|
60
|
+
</script>
|
package/src/core/setup.ts
CHANGED
|
@@ -14,7 +14,7 @@ export async function startGame(options: SetupOptions) {
|
|
|
14
14
|
|
|
15
15
|
await injector(context, options.providers);
|
|
16
16
|
|
|
17
|
-
const engine = inject(context, RpgClientEngine);
|
|
17
|
+
const engine = inject<RpgClientEngine>(context, RpgClientEngine);
|
|
18
18
|
await engine.start();
|
|
19
19
|
return context;
|
|
20
|
-
}
|
|
20
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -2,12 +2,27 @@ export * from "./RpgClientEngine";
|
|
|
2
2
|
export type * from "./RpgClient";
|
|
3
3
|
export * from "./services/standalone";
|
|
4
4
|
export * from "./services/mmorpg";
|
|
5
|
+
export * from "./services/save";
|
|
5
6
|
export * from "./core/setup";
|
|
6
7
|
export * from "./core/inject";
|
|
7
8
|
export * from "./services/loadMap";
|
|
8
9
|
export * from "./module";
|
|
9
10
|
export * from "./Gui/Gui";
|
|
10
11
|
export * from "./components/gui";
|
|
11
|
-
export * from "./components/
|
|
12
|
+
export * from "./components/animations";
|
|
13
|
+
export * from "./components/prebuilt";
|
|
12
14
|
export * from "./presets";
|
|
13
|
-
export * from "./components";
|
|
15
|
+
export * from "./components";
|
|
16
|
+
export * from "./components/gui";
|
|
17
|
+
export * from "./Sound";
|
|
18
|
+
export * from "./Resource";
|
|
19
|
+
export * from "./decorators/spritesheet";
|
|
20
|
+
export * from "./utils/getEntityProp";
|
|
21
|
+
export { Context } from "@signe/di";
|
|
22
|
+
export { KeyboardControls, Input } from "canvasengine";
|
|
23
|
+
export { Control } from "./services/keyboardControls";
|
|
24
|
+
export { RpgClientObject } from "./Game/Object";
|
|
25
|
+
export { RpgClientPlayer } from "./Game/Player";
|
|
26
|
+
export { RpgClientEvent } from "./Game/Event";
|
|
27
|
+
export { withMobile } from "./components/gui/mobile";
|
|
28
|
+
export * from "./services/AbstractSocket";
|
package/src/module.ts
CHANGED
|
@@ -1,14 +1,69 @@
|
|
|
1
1
|
import { findModules, provideModules } from "@rpgjs/common";
|
|
2
|
+
import { FactoryProvider } from "@signe/di";
|
|
2
3
|
import { RpgClientEngine } from "./RpgClientEngine";
|
|
3
4
|
import { RpgClient } from "./RpgClient";
|
|
4
5
|
import { inject } from "@signe/di";
|
|
5
6
|
import { RpgGui } from "./Gui/Gui";
|
|
7
|
+
import { getSoundMetadata } from "./Sound";
|
|
6
8
|
|
|
7
|
-
|
|
9
|
+
/**
|
|
10
|
+
* Type for client modules that can be either:
|
|
11
|
+
* - An object implementing RpgClient interface
|
|
12
|
+
* - A class decorated with @RpgModule decorator
|
|
13
|
+
*/
|
|
14
|
+
export type RpgClientModule = RpgClient | (new () => any);
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Provides client modules configuration to Dependency Injection
|
|
18
|
+
*
|
|
19
|
+
* This function accepts an array of client modules that can be either:
|
|
20
|
+
* - Objects implementing the RpgClient interface
|
|
21
|
+
* - Classes decorated with the @RpgModule decorator (which will be instantiated)
|
|
22
|
+
*
|
|
23
|
+
* @param modules - Array of client modules (objects or classes)
|
|
24
|
+
* @returns FactoryProvider configuration for DI
|
|
25
|
+
* @example
|
|
26
|
+
* ```ts
|
|
27
|
+
* // Using an object
|
|
28
|
+
* provideClientModules([
|
|
29
|
+
* {
|
|
30
|
+
* engine: {
|
|
31
|
+
* onConnected(engine) {
|
|
32
|
+
* console.log('Client connected')
|
|
33
|
+
* }
|
|
34
|
+
* }
|
|
35
|
+
* }
|
|
36
|
+
* ])
|
|
37
|
+
*
|
|
38
|
+
* // Using a decorated class
|
|
39
|
+
* @RpgModule<RpgClient>({
|
|
40
|
+
* engine: {
|
|
41
|
+
* onStart(engine) {
|
|
42
|
+
* console.log('Client started')
|
|
43
|
+
* }
|
|
44
|
+
* }
|
|
45
|
+
* })
|
|
46
|
+
* class MyClientModule {}
|
|
47
|
+
*
|
|
48
|
+
* provideClientModules([MyClientModule])
|
|
49
|
+
* ```
|
|
50
|
+
*/
|
|
51
|
+
export function provideClientModules(modules: RpgClientModule[]): FactoryProvider {
|
|
8
52
|
return provideModules(modules, "client", (modules, context) => {
|
|
9
53
|
const mainModuleClient = findModules(context, 'Client')
|
|
10
54
|
modules = [...mainModuleClient, ...modules]
|
|
11
55
|
modules = modules.map((module) => {
|
|
56
|
+
// If module is a class (constructor function), instantiate it
|
|
57
|
+
// The RpgModule decorator adds properties to the prototype, which will be accessible via the instance
|
|
58
|
+
if (typeof module === 'function') {
|
|
59
|
+
const instance = new module() as any;
|
|
60
|
+
// Copy all enumerable properties (including from prototype) to a plain object
|
|
61
|
+
const moduleObj: any = {};
|
|
62
|
+
for (const key in instance) {
|
|
63
|
+
moduleObj[key] = instance[key];
|
|
64
|
+
}
|
|
65
|
+
module = moduleObj;
|
|
66
|
+
}
|
|
12
67
|
if ('client' in module) {
|
|
13
68
|
module = module.client as any;
|
|
14
69
|
}
|
|
@@ -22,33 +77,95 @@ export function provideClientModules(modules: RpgClient[]) {
|
|
|
22
77
|
},
|
|
23
78
|
};
|
|
24
79
|
}
|
|
80
|
+
if (module.spritesheetResolver) {
|
|
81
|
+
const resolver = module.spritesheetResolver;
|
|
82
|
+
module.spritesheetResolver = {
|
|
83
|
+
load: (engine: RpgClientEngine) => {
|
|
84
|
+
engine.setSpritesheetResolver(resolver);
|
|
85
|
+
},
|
|
86
|
+
};
|
|
87
|
+
}
|
|
25
88
|
if (module.sounds) {
|
|
26
89
|
const sounds = [...module.sounds];
|
|
27
90
|
module.sounds = {
|
|
28
91
|
load: (engine: RpgClientEngine) => {
|
|
29
92
|
sounds.forEach((sound) => {
|
|
30
|
-
|
|
93
|
+
// Check if it's a class decorated with @Sound
|
|
94
|
+
if (typeof sound === 'function' || (sound && sound.constructor && sound.constructor !== Object)) {
|
|
95
|
+
const metadata = getSoundMetadata(sound);
|
|
96
|
+
if (metadata) {
|
|
97
|
+
// Handle single sound
|
|
98
|
+
if (metadata.id && metadata.sound) {
|
|
99
|
+
engine.addSound({
|
|
100
|
+
id: metadata.id,
|
|
101
|
+
src: metadata.sound,
|
|
102
|
+
loop: metadata.loop,
|
|
103
|
+
volume: metadata.volume,
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
// Handle multiple sounds
|
|
107
|
+
if (metadata.sounds) {
|
|
108
|
+
Object.entries(metadata.sounds).forEach(([soundId, soundSrc]) => {
|
|
109
|
+
engine.addSound({
|
|
110
|
+
id: soundId,
|
|
111
|
+
src: soundSrc,
|
|
112
|
+
loop: metadata.loop,
|
|
113
|
+
volume: metadata.volume,
|
|
114
|
+
});
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
} else {
|
|
118
|
+
// Not a decorated class, treat as regular sound object
|
|
119
|
+
engine.addSound(sound);
|
|
120
|
+
}
|
|
121
|
+
} else {
|
|
122
|
+
// Regular sound object
|
|
123
|
+
engine.addSound(sound);
|
|
124
|
+
}
|
|
31
125
|
});
|
|
32
126
|
},
|
|
33
127
|
};
|
|
34
128
|
}
|
|
129
|
+
if (module.soundResolver) {
|
|
130
|
+
const resolver = module.soundResolver;
|
|
131
|
+
module.soundResolver = {
|
|
132
|
+
load: (engine: RpgClientEngine) => {
|
|
133
|
+
engine.setSoundResolver(resolver);
|
|
134
|
+
},
|
|
135
|
+
};
|
|
136
|
+
}
|
|
35
137
|
if (module.gui) {
|
|
36
138
|
const gui = [...module.gui];
|
|
37
139
|
module.gui = {
|
|
38
140
|
load: (engine: RpgClientEngine) => {
|
|
39
|
-
const guiService = inject(engine.context, RpgGui);
|
|
141
|
+
const guiService = inject(engine.context, RpgGui) as RpgGui;
|
|
40
142
|
gui.forEach((gui) => {
|
|
41
143
|
guiService.add(gui);
|
|
42
144
|
});
|
|
43
145
|
},
|
|
44
146
|
};
|
|
45
147
|
}
|
|
46
|
-
if (module.
|
|
47
|
-
const
|
|
48
|
-
module.
|
|
148
|
+
if (module.componentAnimations) {
|
|
149
|
+
const componentAnimations = [...module.componentAnimations];
|
|
150
|
+
module.componentAnimations = {
|
|
49
151
|
load: (engine: RpgClientEngine) => {
|
|
50
|
-
|
|
51
|
-
engine.
|
|
152
|
+
componentAnimations.forEach((componentAnimation) => {
|
|
153
|
+
engine.addComponentAnimation(componentAnimation);
|
|
154
|
+
});
|
|
155
|
+
},
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
if (module.transitions) {
|
|
159
|
+
const transitions = [...module.transitions];
|
|
160
|
+
module.transitions = {
|
|
161
|
+
load: (engine: RpgClientEngine) => {
|
|
162
|
+
const guiService = inject(engine.context, RpgGui) as RpgGui;
|
|
163
|
+
transitions.forEach((transition) => {
|
|
164
|
+
guiService.add({
|
|
165
|
+
name: transition.id,
|
|
166
|
+
component: transition.component,
|
|
167
|
+
data: transition.props || {}
|
|
168
|
+
});
|
|
52
169
|
});
|
|
53
170
|
},
|
|
54
171
|
};
|
|
@@ -78,6 +195,11 @@ export function provideClientModules(modules: RpgClient[]) {
|
|
|
78
195
|
engine.addSpriteComponentInFront(component);
|
|
79
196
|
});
|
|
80
197
|
}
|
|
198
|
+
if (sprite.components) {
|
|
199
|
+
Object.entries(sprite.components).forEach(([id, component]) => {
|
|
200
|
+
engine.registerSpriteComponent(id, component);
|
|
201
|
+
});
|
|
202
|
+
}
|
|
81
203
|
},
|
|
82
204
|
};
|
|
83
205
|
}
|
|
@@ -103,9 +225,9 @@ export function provideClientGlobalConfig(config: any = {}) {
|
|
|
103
225
|
down: 'down',
|
|
104
226
|
left: 'left',
|
|
105
227
|
right: 'right',
|
|
106
|
-
action: 'space'
|
|
228
|
+
action: 'space',
|
|
229
|
+
escape: 'escape'
|
|
107
230
|
}
|
|
108
231
|
}
|
|
109
232
|
return provideGlobalConfig(config)
|
|
110
233
|
}
|
|
111
|
-
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Creates an animation spritesheet preset with automatic frame generation
|
|
3
|
+
*
|
|
4
|
+
* This function generates animation frames based on the provided width and height dimensions.
|
|
5
|
+
* It creates a sequence of frames that progresses through the spritesheet from left to right,
|
|
6
|
+
* top to bottom, with each frame having a 10ms time increment.
|
|
7
|
+
*
|
|
8
|
+
* @param {number} framesWidth - The number of frames horizontally in the spritesheet
|
|
9
|
+
* @param {number} framesHeight - The number of frames vertically in the spritesheet
|
|
10
|
+
* @returns {Object} Animation preset configuration object
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```javascript
|
|
14
|
+
* // For a 4x4 spritesheet
|
|
15
|
+
* const preset = AnimationSpritesheetPreset(4, 4);
|
|
16
|
+
* // This will generate 16 frames with coordinates from (0,0) to (3,3)
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
export const AnimationSpritesheetPreset = (framesWidth: number, framesHeight: number) => {
|
|
20
|
+
|
|
21
|
+
const animations: Array<{ time: number; frameX: number; frameY: number }> = [];
|
|
22
|
+
|
|
23
|
+
for (let y = 0; y < framesHeight; y++) {
|
|
24
|
+
for (let x = 0; x < framesWidth; x++) {
|
|
25
|
+
const frameIndex = y * framesWidth + x;
|
|
26
|
+
animations.push({
|
|
27
|
+
time: frameIndex * 10,
|
|
28
|
+
frameX: x,
|
|
29
|
+
frameY: y
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
return {
|
|
35
|
+
framesWidth,
|
|
36
|
+
framesHeight,
|
|
37
|
+
textures: {
|
|
38
|
+
default: {
|
|
39
|
+
animations: () => [
|
|
40
|
+
animations
|
|
41
|
+
],
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Creates a faceset preset for character expressions
|
|
3
|
+
*
|
|
4
|
+
* This preset allows you to define multiple facial expressions for a character,
|
|
5
|
+
* where each expression corresponds to a specific frame position (frameX, frameY)
|
|
6
|
+
* within a single faceset texture. Each expression is defined by its position
|
|
7
|
+
* in the faceset grid.
|
|
8
|
+
*
|
|
9
|
+
* @param options - Object containing the faceset configuration
|
|
10
|
+
* @param framesWidth - Number of frames horizontally in the faceset texture
|
|
11
|
+
* @param framesHeight - Number of frames vertically in the faceset texture
|
|
12
|
+
* @param expressions - Object mapping expression names to their frame positions as tuples [frameX, frameY]
|
|
13
|
+
* @returns Faceset configuration with animations for each expression
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```typescript
|
|
17
|
+
* const faceset = FacesetPreset({
|
|
18
|
+
* id: "facesetId",
|
|
19
|
+
* image: "faceset.png",
|
|
20
|
+
* width: 1024,
|
|
21
|
+
* height: 1024,
|
|
22
|
+
* }, 4, 2, {
|
|
23
|
+
* happy: [0, 0],
|
|
24
|
+
* sad: [1, 0],
|
|
25
|
+
* angry: [2, 0],
|
|
26
|
+
* surprised: [3, 0]
|
|
27
|
+
* });
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
export const FacesetPreset = (
|
|
31
|
+
options: any,
|
|
32
|
+
framesWidth: number,
|
|
33
|
+
framesHeight: number,
|
|
34
|
+
expressions: Record<string, [number, number]>,
|
|
35
|
+
) => {
|
|
36
|
+
|
|
37
|
+
const textures: Record<string, any> = {};
|
|
38
|
+
|
|
39
|
+
// Create texture configuration for each expression
|
|
40
|
+
Object.keys(expressions).forEach((expressionName) => {
|
|
41
|
+
const [frameX, frameY] = expressions[expressionName];
|
|
42
|
+
textures[expressionName] = {
|
|
43
|
+
animations: () => [
|
|
44
|
+
[{
|
|
45
|
+
time: 0,
|
|
46
|
+
frameX: frameX,
|
|
47
|
+
frameY: frameY
|
|
48
|
+
}]
|
|
49
|
+
],
|
|
50
|
+
};
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
return {
|
|
54
|
+
...options,
|
|
55
|
+
framesWidth,
|
|
56
|
+
framesHeight,
|
|
57
|
+
textures
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export const IconPreset = (options: {
|
|
2
|
+
image: string;
|
|
3
|
+
framesWidth: number;
|
|
4
|
+
framesHeight: number;
|
|
5
|
+
id: string;
|
|
6
|
+
}) => {
|
|
7
|
+
return {
|
|
8
|
+
textures: {
|
|
9
|
+
default: {
|
|
10
|
+
animations: () => [
|
|
11
|
+
[{ time: 0, frameX: 0, frameY: 0 }]
|
|
12
|
+
]
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
...options
|
|
16
|
+
}
|
|
17
|
+
}
|
package/src/presets/index.ts
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
|
+
import { AnimationSpritesheetPreset } from "./animation";
|
|
2
|
+
import { LPCSpritesheetPreset } from "./lpc";
|
|
1
3
|
import { RMSpritesheet } from "./rmspritesheet";
|
|
4
|
+
import { FacesetPreset } from "./faceset";
|
|
5
|
+
import { IconPreset } from "./icon";
|
|
2
6
|
|
|
3
7
|
export const Presets = {
|
|
4
|
-
RMSpritesheet
|
|
8
|
+
RMSpritesheet,
|
|
9
|
+
LPCSpritesheetPreset,
|
|
10
|
+
AnimationSpritesheetPreset,
|
|
11
|
+
FacesetPreset,
|
|
12
|
+
IconPreset
|
|
5
13
|
}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { Animation, Direction } from "@rpgjs/common";
|
|
2
|
+
|
|
3
|
+
export const LPCSpritesheetPreset = (options: {
|
|
4
|
+
id: string;
|
|
5
|
+
imageSource: string;
|
|
6
|
+
width: number;
|
|
7
|
+
height: number;
|
|
8
|
+
ratio?: number;
|
|
9
|
+
}) => {
|
|
10
|
+
const ratio = options.ratio ?? 1;
|
|
11
|
+
|
|
12
|
+
const frameY = (direction: Direction) => {
|
|
13
|
+
return {
|
|
14
|
+
[Direction.Down]: 2,
|
|
15
|
+
[Direction.Left]: 1,
|
|
16
|
+
[Direction.Right]: 3,
|
|
17
|
+
[Direction.Up]: 0,
|
|
18
|
+
}[direction];
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
const stand = (direction: Direction) => [
|
|
22
|
+
{ time: 0, frameX: 0, frameY: frameY(direction) },
|
|
23
|
+
];
|
|
24
|
+
const anim = (
|
|
25
|
+
direction: Direction,
|
|
26
|
+
framesWidth: number,
|
|
27
|
+
speed: number = 5
|
|
28
|
+
) => {
|
|
29
|
+
const array: any = [];
|
|
30
|
+
for (let i = 0; i < framesWidth; i++) {
|
|
31
|
+
array.push({ time: i * speed, frameX: i, frameY: frameY(direction) });
|
|
32
|
+
}
|
|
33
|
+
return array;
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
return {
|
|
37
|
+
id: options.id,
|
|
38
|
+
image: options.imageSource,
|
|
39
|
+
width: options.width,
|
|
40
|
+
height: options.height,
|
|
41
|
+
opacity: 1,
|
|
42
|
+
rectWidth: 64 * ratio,
|
|
43
|
+
rectHeight: 64 * ratio,
|
|
44
|
+
framesWidth: 6,
|
|
45
|
+
framesHeight: 4,
|
|
46
|
+
spriteRealSize: {
|
|
47
|
+
width: 48 * ratio,
|
|
48
|
+
height: 52 * ratio,
|
|
49
|
+
},
|
|
50
|
+
textures: {
|
|
51
|
+
[Animation.Stand]: {
|
|
52
|
+
offset: {
|
|
53
|
+
x: 0,
|
|
54
|
+
y: 512 * ratio,
|
|
55
|
+
},
|
|
56
|
+
animations: ({ direction }) => [stand(direction)],
|
|
57
|
+
},
|
|
58
|
+
[Animation.Walk]: {
|
|
59
|
+
offset: {
|
|
60
|
+
x: 0,
|
|
61
|
+
y: 512 * ratio,
|
|
62
|
+
},
|
|
63
|
+
framesWidth: 9,
|
|
64
|
+
framesHeight: 4,
|
|
65
|
+
animations: ({ direction }) => [anim(direction, 9)],
|
|
66
|
+
},
|
|
67
|
+
[Animation.Attack]: {
|
|
68
|
+
offset: {
|
|
69
|
+
x: 0,
|
|
70
|
+
y: 768 * ratio,
|
|
71
|
+
},
|
|
72
|
+
framesWidth: 6,
|
|
73
|
+
framesHeight: 4,
|
|
74
|
+
animations: ({ direction }) => [anim(direction, 6, 3)],
|
|
75
|
+
},
|
|
76
|
+
[Animation.Skill]: {
|
|
77
|
+
framesWidth: 7,
|
|
78
|
+
framesHeight: 4,
|
|
79
|
+
animations: ({ direction }) => [anim(direction, 7, 3)],
|
|
80
|
+
},
|
|
81
|
+
attack2: {
|
|
82
|
+
offset: {
|
|
83
|
+
x: 0,
|
|
84
|
+
y: 256 * ratio,
|
|
85
|
+
},
|
|
86
|
+
framesWidth: 7,
|
|
87
|
+
framesHeight: 8,
|
|
88
|
+
animations: ({ direction }) => [anim(direction, 7, 3)],
|
|
89
|
+
},
|
|
90
|
+
...(options.height > 3000
|
|
91
|
+
? {
|
|
92
|
+
attack3: {
|
|
93
|
+
offset: {
|
|
94
|
+
x: 0,
|
|
95
|
+
y: 5568 - 288 * 4,
|
|
96
|
+
},
|
|
97
|
+
rectWidth: 288,
|
|
98
|
+
rectHeight: 288,
|
|
99
|
+
framesWidth: 6,
|
|
100
|
+
framesHeight: 4,
|
|
101
|
+
animations: ({ direction }) => [anim(direction, 6, 3)],
|
|
102
|
+
},
|
|
103
|
+
}
|
|
104
|
+
: {}),
|
|
105
|
+
},
|
|
106
|
+
};
|
|
107
|
+
};
|
|
108
|
+
|