bard-legends-framework 0.11.0 → 0.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/actions-performance.test.d.ts +1 -0
- package/dist/actions-performance.test.js +83 -0
- package/dist/game-entities/controller/controller.d.ts +2 -2
- package/dist/game-entities/controller/controller.js +8 -8
- package/dist/game-entities/controller/controller.test.js +2 -2
- package/dist/game-entities/entity/entity.d.ts +7 -7
- package/dist/game-entities/entity/entity.js +18 -12
- package/dist/game-entities/entity/entity.test.js +93 -30
- package/dist/game-entities/entity/helpers/entity-store.helper.d.ts +3 -3
- package/dist/game-entities/entity/helpers/entity-store.helper.js +12 -12
- package/dist/game-entities/entity/helpers/entity-store.helper.test.js +11 -11
- package/dist/game-entities/entity/helpers/entity-views.helper.d.ts +6 -6
- package/dist/game-entities/entity/helpers/entity-views.helper.js +25 -22
- package/dist/game-entities/entity/singleton-entity.test.js +9 -4
- package/dist/game-entities/hard-reset.d.ts +5 -0
- package/dist/game-entities/hard-reset.js +14 -0
- package/dist/game-entities/index.d.ts +1 -1
- package/dist/game-entities/index.js +3 -3
- package/dist/game-entities/scene/scene.d.ts +13 -13
- package/dist/game-entities/scene/scene.js +41 -46
- package/dist/game-entities/scene/scene.test.js +95 -37
- package/dist/game-entities/service/service.d.ts +1 -4
- package/dist/game-entities/service/service.js +12 -13
- package/dist/game-entities/service/service.test.js +33 -12
- package/dist/game-entities/unit-test.helper.js +1 -1
- package/dist/game-entities/update-cycle.d.ts +7 -17
- package/dist/game-entities/update-cycle.js +25 -19
- package/dist/game-entities/view/view.d.ts +6 -6
- package/dist/game-entities/view/view.js +15 -21
- package/dist/game-entities/view/view.test.js +40 -9
- package/dist/physics/entity-types/immovable-physics-entity.d.ts +1 -1
- package/dist/physics/entity-types/immovable-physics-entity.js +4 -4
- package/dist/physics/entity-types/movable-entity.d.ts +1 -1
- package/dist/physics/entity-types/movable-entity.js +2 -2
- package/dist/physics/entity-types/movable-physics-entity.d.ts +8 -8
- package/dist/physics/entity-types/movable-physics-entity.js +27 -27
- package/dist/physics/entity-types/physics-entity.d.ts +10 -14
- package/dist/physics/entity-types/physics-entity.js +27 -26
- package/dist/physics/interfaces.d.ts +6 -6
- package/dist/physics/interfaces.js +4 -4
- package/dist/physics/module//342/232/234/357/270/217gateways/controllers/physics-internal.controller.d.ts +16 -16
- package/dist/physics/module//342/232/234/357/270/217gateways/controllers/physics-internal.controller.js +22 -22
- package/dist/physics/module//342/232/234/357/270/217gateways/controllers/physics.controller.d.ts +19 -19
- package/dist/physics/module//342/232/234/357/270/217gateways/controllers/physics.controller.js +30 -30
- package/dist/physics/module//342/232/234/357/270/217gateways/dtos/requests.dto.d.ts +3 -3
- package/dist/physics/module//342/232/234/357/270/217gateways/physics-internal.gateway.d.ts +10 -10
- package/dist/physics/module//342/232/234/357/270/217gateways/physics-internal.gateway.js +16 -16
- package/dist/physics/module//342/232/234/357/270/217gateways/physics.gateway.d.ts +10 -10
- package/dist/physics/module//342/232/234/357/270/217gateways/physics.gateway.js +18 -18
- package/dist/physics/module//360/237/223/220services/collision/collisions.service.d.ts +5 -5
- package/dist/physics/module//360/237/223/220services/collision/collisions.service.js +17 -17
- package/dist/physics/module//360/237/223/220services/collision/hit-test.service.d.ts +4 -4
- package/dist/physics/module//360/237/223/220services/collision/hit-test.service.js +11 -11
- package/dist/physics/module//360/237/223/220services/collision/physics-body-group.service.d.ts +2 -2
- package/dist/physics/module//360/237/223/220services/collision/physics-body-group.service.js +4 -4
- package/dist/physics/module//360/237/223/220services/creation/border.service.d.ts +2 -2
- package/dist/physics/module//360/237/223/220services/creation/border.service.js +9 -9
- package/dist/physics/module//360/237/223/220services/creation/materials.service.d.ts +7 -7
- package/dist/physics/module//360/237/223/220services/creation/materials.service.js +17 -17
- package/dist/physics/module//360/237/223/220services/creation/physics-world.service.d.ts +11 -11
- package/dist/physics/module//360/237/223/220services/creation/physics-world.service.js +27 -26
- package/dist/physics/module//360/237/223/220services/creation/shape-creation.service.d.ts +4 -4
- package/dist/physics/module//360/237/223/220services/creation/shape-creation.service.js +13 -13
- package/dist/physics/module//360/237/223/220services/impact/eliptic-explosion.service.d.ts +9 -9
- package/dist/physics/module//360/237/223/220services/impact/eliptic-explosion.service.js +19 -19
- package/dist/physics/module//360/237/223/220services/impact/explosion.service.d.ts +9 -9
- package/dist/physics/module//360/237/223/220services/impact/explosion.service.js +20 -20
- package/dist/physics/module//360/237/223/220services/impact/ray-cast-hit-converter.d.ts +1 -1
- package/dist/physics/module//360/237/223/220services/impact/ray-cast-hit-converter.js +4 -4
- package/dist/physics/module//360/237/223/220services/path-finding/availability-grid-cache.service.d.ts +2 -2
- package/dist/physics/module//360/237/223/220services/path-finding/availability-grid-cache.service.js +3 -3
- package/dist/physics/module//360/237/223/220services/path-finding/availability-grid.service.d.ts +5 -5
- package/dist/physics/module//360/237/223/220services/path-finding/availability-grid.service.js +12 -12
- package/dist/physics/module//360/237/223/220services/path-finding/path-finder.service.d.ts +4 -4
- package/dist/physics/module//360/237/223/220services/path-finding/path-finder.service.js +12 -12
- package/dist/physics/module//360/237/223/220services/query/physics-query.service.d.ts +4 -4
- package/dist/physics/module//360/237/223/220services/query/physics-query.service.js +4 -4
- package/dist/physics/module//360/237/223/220services/ray-casting/ray-casting.service.d.ts +1 -4
- package/dist/physics/module//360/237/223/220services/ray-casting/ray-casting.service.js +7 -15
- package/dist/physics/module//360/237/223/220services/test-visuals/test-visuals.service.d.ts +9 -9
- package/dist/physics/module//360/237/223/220services/test-visuals/test-visuals.service.js +43 -42
- package/dist/physics/module//360/237/247/212entities/border.entity.d.ts +1 -1
- package/dist/physics/module//360/237/247/212entities/border.entity.js +3 -3
- package/dist/pixi/components/display-object-array.d.ts +5 -5
- package/dist/pixi/components/display-object-array.js +14 -14
- package/dist/pixi/components/helpers/smooth-scroller.d.ts +7 -7
- package/dist/pixi/components/helpers/smooth-scroller.js +23 -23
- package/dist/pixi/components/helpers/smooth-scroller.test.js +14 -14
- package/dist/pixi/components/menu/menu-entity.d.ts +14 -0
- package/dist/pixi/components/menu/menu-entity.js +48 -0
- package/dist/pixi/components/menu/menu.ui.d.ts +23 -0
- package/dist/pixi/components/menu/menu.ui.js +97 -0
- package/dist/pixi/components/mouse-wheel-listener.ui.d.ts +2 -2
- package/dist/pixi/components/mouse-wheel-listener.ui.js +11 -11
- package/dist/pixi/components/scroll-area.ui.d.ts +1 -1
- package/dist/pixi/components/scroll-area.ui.js +9 -9
- package/dist/pixi/components/scroll-mask.ui.d.ts +9 -8
- package/dist/pixi/components/scroll-mask.ui.js +25 -24
- package/dist/pixi/display-object/container-attributes.d.ts +24 -25
- package/dist/pixi/display-object/container-attributes.js +26 -26
- package/dist/pixi/display-object/container.d.ts +3 -3
- package/dist/pixi/display-object/container.js +2 -2
- package/dist/pixi/display-object/filters/base-filters/blur.filter.d.ts +9 -9
- package/dist/pixi/display-object/filters/base-filters/blur.filter.js +25 -25
- package/dist/pixi/display-object/filters/base-filters/expand-with-color.filter.d.ts +7 -7
- package/dist/pixi/display-object/filters/base-filters/expand-with-color.filter.js +17 -17
- package/dist/pixi/display-object/filters/composite-filters/glow-filter.d.ts +6 -6
- package/dist/pixi/display-object/filters/composite-filters/glow-filter.js +10 -11
- package/dist/pixi/display-object/filters/helpers/gaussian-values.helper.d.ts +2 -2
- package/dist/pixi/display-object/filters/helpers/gaussian-values.helper.js +5 -5
- package/dist/pixi/display-object/filters/templates/checking-neighbors.template.d.ts +5 -5
- package/dist/pixi/display-object/filters/templates/checking-neighbors.template.js +8 -8
- package/dist/pixi/display-object/filters/templates/plane.template.d.ts +5 -5
- package/dist/pixi/display-object/filters/templates/plane.template.js +7 -7
- package/dist/pixi/display-object/filters.d.ts +7 -7
- package/dist/pixi/display-object/filters.js +34 -34
- package/dist/pixi/display-object/index.d.ts +1 -1
- package/dist/pixi/display-object/objects/graphics/graphics.d.ts +9 -9
- package/dist/pixi/display-object/objects/graphics/graphics.js +25 -25
- package/dist/pixi/display-object/objects/placeholder.d.ts +1 -1
- package/dist/pixi/display-object/objects/placeholder.js +7 -7
- package/dist/pixi/display-object/objects/sprite/glow-sprite-generator.d.ts +9 -9
- package/dist/pixi/display-object/objects/sprite/glow-sprite-generator.js +26 -25
- package/dist/pixi/display-object/objects/sprite/sprite.d.ts +10 -9
- package/dist/pixi/display-object/objects/sprite/sprite.js +62 -53
- package/dist/pixi/display-object/objects/text/helpers/process-steps/1-data-in-converter/pixi-text-style-converter.d.ts +4 -3
- package/dist/pixi/display-object/objects/text/helpers/process-steps/1-data-in-converter/rich-text-data-in-converter.d.ts +6 -6
- package/dist/pixi/display-object/objects/text/helpers/process-steps/1-data-in-converter/rich-text-data-in-converter.js +16 -16
- package/dist/pixi/display-object/objects/text/helpers/process-steps/1-data-in-converter/rich-text-data-in-converter.test.js +28 -28
- package/dist/pixi/display-object/objects/text/helpers/process-steps/2-wrapping-text/consistent-space-text-wrapper.d.ts +1 -1
- package/dist/pixi/display-object/objects/text/helpers/process-steps/2-wrapping-text/consistent-space-text-wrapper.js +3 -3
- package/dist/pixi/display-object/objects/text/helpers/process-steps/2-wrapping-text/rich-text-typewriter.d.ts +17 -17
- package/dist/pixi/display-object/objects/text/helpers/process-steps/2-wrapping-text/rich-text-typewriter.js +62 -62
- package/dist/pixi/display-object/objects/text/helpers/process-steps/2-wrapping-text/rich-text-typewriter.test.js +2 -2
- package/dist/pixi/display-object/objects/text/helpers/process-steps/3-data-out-converter/rich-text-data-out-converter.d.ts +3 -3
- package/dist/pixi/display-object/objects/text/helpers/process-steps/3-data-out-converter/rich-text-data-out-converter.js +6 -6
- package/dist/pixi/display-object/objects/text/helpers/process-steps/3-data-out-converter/rich-text-data-out-converter.test.js +12 -12
- package/dist/pixi/display-object/objects/text/helpers/rich-text-to-plane-text.d.ts +2 -2
- package/dist/pixi/display-object/objects/text/helpers/rich-text-to-plane-text.test.js +5 -5
- package/dist/pixi/display-object/objects/text/rich-text.d.ts +0 -1
- package/dist/pixi/display-object/objects/text/rich-text.js +0 -1
- package/dist/pixi/display-object/objects/text/text.d.ts +9 -10
- package/dist/pixi/display-object/objects/text/text.js +34 -35
- package/dist/pixi/game.d.ts +20 -15
- package/dist/pixi/game.js +40 -35
- package/dist/pixi/helpers/game-assets.d.ts +5 -5
- package/dist/pixi/helpers/game-assets.js +14 -11
- package/dist/pixi/helpers/position-conversion.helper.d.ts +4 -4
- package/dist/pixi/helpers/position-conversion.helper.js +3 -3
- package/dist/pixi/index.d.ts +3 -37
- package/dist/pixi/index.js +6 -22
- package/dist/pixi/modules/CAMERA/camera.d.ts +5 -4
- package/dist/pixi/modules/CAMERA/camera.js +9 -9
- package/dist/pixi/modules/CAMERA//342/232/234/357/270/217gateways/camera-view.gateway.d.ts +3 -2
- package/dist/pixi/modules/CAMERA//342/232/234/357/270/217gateways/camera-view.gateway.js +1 -1
- package/dist/pixi/modules/CAMERA//342/232/234/357/270/217gateways/controllers/camera-view.controller.d.ts +3 -2
- package/dist/pixi/modules/CAMERA//342/232/234/357/270/217gateways/controllers/camera-view.controller.js +5 -5
- package/dist/pixi/modules/CAMERA//342/232/234/357/270/217gateways/controllers/camera.controller.d.ts +3 -3
- package/dist/pixi/modules/CAMERA//342/232/234/357/270/217gateways/controllers/camera.controller.js +7 -7
- package/dist/pixi/modules/CAMERA//342/232/234/357/270/217gateways/dtos/requests.dto.d.ts +8 -8
- package/dist/pixi/modules/CAMERA//342/232/234/357/270/217gateways/dtos/requests.dto.js +8 -8
- package/dist/pixi/modules/CAMERA//360/237/223/220services/camera.service.d.ts +2 -2
- package/dist/pixi/modules/CAMERA//360/237/223/220services/camera.service.js +12 -12
- package/dist/pixi/modules/CAMERA//360/237/247/251views/camera.view.d.ts +17 -16
- package/dist/pixi/modules/CAMERA//360/237/247/251views/camera.view.js +49 -48
- package/dist/pixi/pixi-definitions.d.ts +38 -0
- package/dist/pixi/pixi-definitions.js +37 -0
- package/dist/pixi/services/keyboard/keyboard.d.ts +2 -2
- package/dist/pixi/services/keyboard/keyboard.js +9 -9
- package/dist/pixi/services/mouse/mouse-target-focus.service.d.ts +10 -10
- package/dist/pixi/services/mouse/mouse-target-focus.service.js +28 -28
- package/dist/pixi/services/mouse/mouse.service.d.ts +1 -1
- package/dist/pixi/services/mouse/mouse.service.js +5 -5
- package/dist/utilities/animator/animating-content/fade-in-content.test.d.ts +1 -0
- package/dist/utilities/animator/animating-content/fade-in-content.test.js +10 -0
- package/dist/utilities/animator/animating-content/slide-in-content.test.d.ts +1 -0
- package/dist/utilities/animator/animating-content/slide-in-content.test.js +10 -0
- package/dist/utilities/animator/animations.d.ts +14 -6
- package/dist/utilities/animator/animations.js +15 -11
- package/dist/utilities/animator/animator/animator.d.ts +44 -0
- package/dist/utilities/animator/animator/animator.js +234 -0
- package/dist/utilities/animator/animator/animator.memory-leak.test.d.ts +1 -0
- package/dist/utilities/animator/animator/animator.memory-leak.test.js +73 -0
- package/dist/utilities/animator/animator/animator.performance.test.d.ts +1 -0
- package/dist/utilities/animator/animator/animator.performance.test.js +116 -0
- package/dist/utilities/animator/animator/animator.test.d.ts +1 -0
- package/dist/utilities/animator/animator/animator.test.js +1046 -0
- package/dist/utilities/animator/animator.d.ts +2 -3
- package/dist/utilities/animator/animator.js +66 -59
- package/dist/utilities/animator/animator.performance.test.d.ts +1 -0
- package/dist/utilities/animator/animator.performance.test.js +46 -0
- package/dist/utilities/animator/animator.test.js +89 -28
- package/dist/utilities/animator/animator2/animator.d.ts +42 -0
- package/dist/utilities/animator/animator2/animator.js +222 -0
- package/dist/utilities/animator/animator2/animator.memory-leak.test.d.ts +1 -0
- package/dist/utilities/animator/animator2/animator.memory-leak.test.js +73 -0
- package/dist/utilities/animator/animator2/animator.performance.test.d.ts +1 -0
- package/dist/utilities/animator/animator2/animator.performance.test.js +65 -0
- package/dist/utilities/animator/animator2/animator.test.d.ts +1 -0
- package/dist/utilities/animator/animator2/animator.test.js +1007 -0
- package/dist/utilities/animator/animator_old/animator.d.ts +60 -0
- package/dist/utilities/animator/animator_old/animator.js +337 -0
- package/dist/utilities/animator/animator_old/animator.performance.test.d.ts +1 -0
- package/dist/utilities/animator/animator_old/animator.performance.test.js +121 -0
- package/dist/utilities/animator/animator_old/animator.test.d.ts +1 -0
- package/dist/utilities/animator/animator_old/animator.test.js +996 -0
- package/dist/utilities/animator/content-animations/fade-in/fade-in-content.d.ts +18 -0
- package/dist/utilities/animator/content-animations/fade-in/fade-in-content.js +37 -0
- package/dist/utilities/animator/content-animations/fade-in/fade-in-content.test.d.ts +1 -0
- package/dist/utilities/animator/content-animations/fade-in/fade-in-content.test.js +10 -0
- package/dist/utilities/animator/content-animations/fade-in/fade-in-state-animation.d.ts +38 -0
- package/dist/utilities/animator/content-animations/fade-in/fade-in-state-animation.js +208 -0
- package/dist/utilities/animator/content-animations/fade-in/fade-in-state-animation.test.d.ts +1 -0
- package/dist/utilities/animator/content-animations/fade-in/fade-in-state-animation.test.js +439 -0
- package/dist/utilities/animator/content-animations/slide/slide-in-content.d.ts +41 -0
- package/dist/utilities/animator/content-animations/slide/slide-in-content.js +107 -0
- package/dist/utilities/animator/content-animations/slide/slide-in-content.test.d.ts +1 -0
- package/dist/utilities/animator/content-animations/slide/slide-in-content.test.js +10 -0
- package/dist/utilities/animator/content-animations/slide/slide-state-animation.d.ts +24 -0
- package/dist/utilities/animator/content-animations/slide/slide-state-animation.js +138 -0
- package/dist/utilities/animator/content-animations/slide/slide-state-animation.test.d.ts +1 -0
- package/dist/utilities/animator/content-animations/slide/slide-state-animation.test.js +307 -0
- package/dist/utilities/animator/content-animations/slide/state-animation.d.ts +37 -0
- package/dist/utilities/animator/content-animations/slide/state-animation.js +170 -0
- package/dist/utilities/animator/content-animations/slide/state-animation.test.d.ts +1 -0
- package/dist/utilities/animator/content-animations/slide/state-animation.test.js +340 -0
- package/dist/utilities/animator/index.d.ts +6 -6
- package/dist/utilities/animator/index.js +6 -6
- package/dist/utilities/animator/state-animation/fade-in/fade-in-content.d.ts +18 -0
- package/dist/utilities/animator/state-animation/fade-in/fade-in-content.js +37 -0
- package/dist/utilities/animator/state-animation/fade-in/fade-in-content.test.d.ts +1 -0
- package/dist/utilities/animator/state-animation/fade-in/fade-in-content.test.js +10 -0
- package/dist/utilities/animator/state-animation/fade-in/fade-in-state-animation.d.ts +32 -0
- package/dist/utilities/animator/state-animation/fade-in/fade-in-state-animation.js +168 -0
- package/dist/utilities/animator/state-animation/fade-in/fade-in-state-animation.test.d.ts +1 -0
- package/dist/utilities/animator/state-animation/fade-in/fade-in-state-animation.test.js +431 -0
- package/dist/utilities/animator/state-animation/slide/slide-in-content.d.ts +37 -0
- package/dist/utilities/animator/state-animation/slide/slide-in-content.js +100 -0
- package/dist/utilities/animator/state-animation/slide/slide-in-content.test.d.ts +1 -0
- package/dist/utilities/animator/state-animation/slide/slide-in-content.test.js +10 -0
- package/dist/utilities/animator/state-animation/slide/slide-state-animation.d.ts +24 -0
- package/dist/utilities/animator/state-animation/slide/slide-state-animation.js +130 -0
- package/dist/utilities/animator/state-animation/slide/slide-state-animation.test.d.ts +1 -0
- package/dist/utilities/animator/state-animation/slide/slide-state-animation.test.js +301 -0
- package/dist/utilities/animator/state-animation/slide-state-animation.test.js +30 -30
- package/dist/utilities/animator/state-animation/state-animation.js +7 -7
- package/dist/utilities/animator/state-animation/state-animation.test.js +24 -24
- package/dist/utilities/animator/state-animation/visit-disappear-state-animation.test.js +30 -30
- package/dist/utilities/data-structures/vector-set/vector-set.d.ts +1 -1
- package/dist/utilities/data-structures/vector-set/vector-set.js +5 -5
- package/dist/utilities/grid-algorithms/closest-available-space/closest-available-space.helper.d.ts +1 -1
- package/dist/utilities/grid-algorithms/closest-available-space/closest-available-space.helper.js +5 -5
- package/dist/utilities/grid-algorithms/path-finder/path-finder.js +21 -21
- package/dist/utilities/grid-algorithms/path-finder/path-finder.test.js +9 -9
- package/dist/utilities/grid-algorithms/vector-field-path-finder/vector-field-path-finder.d.ts +14 -14
- package/dist/utilities/grid-algorithms/vector-field-path-finder/vector-field-path-finder.js +43 -43
- package/dist/utilities/grid-algorithms/vector-field-path-finder/vector-field-path-finder.test.js +21 -21
- package/package.json +7 -5
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Service = exports.ServiceDecorator = void 0;
|
|
4
|
-
const
|
|
4
|
+
const hard_reset_1 = require("../hard-reset");
|
|
5
5
|
require("reflect-metadata");
|
|
6
6
|
function ServiceDecorator() {
|
|
7
7
|
return function (ServiceClass) {
|
|
8
|
-
let paramtypes = Service.
|
|
8
|
+
let paramtypes = Service._getParametersMeta(ServiceClass);
|
|
9
9
|
ServiceClass.$meta = {
|
|
10
10
|
paramtypes,
|
|
11
11
|
type: 'service'
|
|
@@ -14,27 +14,29 @@ function ServiceDecorator() {
|
|
|
14
14
|
}
|
|
15
15
|
exports.ServiceDecorator = ServiceDecorator;
|
|
16
16
|
class Service {
|
|
17
|
-
static { this.
|
|
17
|
+
static { this._serviceInstances = new Map(); }
|
|
18
18
|
static get(ServiceClass) {
|
|
19
|
-
let service = this.
|
|
19
|
+
let service = this._serviceInstances.get(ServiceClass);
|
|
20
20
|
if (!service) {
|
|
21
21
|
if (!ServiceClass.$meta) {
|
|
22
22
|
throw new Error(`Service: service class is not decorated by @ServiceDecorator(), class: "${ServiceClass.name}"`);
|
|
23
23
|
}
|
|
24
|
-
let resolvedArgs = this.
|
|
24
|
+
let resolvedArgs = this._resolveParameters([], ServiceClass.$meta.paramtypes);
|
|
25
25
|
service = new ServiceClass(...resolvedArgs);
|
|
26
|
-
this.
|
|
26
|
+
this._serviceInstances.set(ServiceClass, service);
|
|
27
27
|
}
|
|
28
28
|
return service;
|
|
29
29
|
}
|
|
30
|
-
|
|
30
|
+
/** @internal */
|
|
31
|
+
static _getParametersMeta(target) {
|
|
31
32
|
let paramtypes = Reflect.getMetadata('design:paramtypes', target) || [];
|
|
32
33
|
if (paramtypes.some(type => !type)) {
|
|
33
34
|
console.error(`Circular dependency: ${target.name}`);
|
|
34
35
|
}
|
|
35
36
|
return paramtypes;
|
|
36
37
|
}
|
|
37
|
-
|
|
38
|
+
/** @internal */
|
|
39
|
+
static _resolveParameters(knownArgs, paramtypes) {
|
|
38
40
|
let params = [...knownArgs];
|
|
39
41
|
if (paramtypes.length > knownArgs.length) {
|
|
40
42
|
let remainingParamTypes = paramtypes.slice(knownArgs.length);
|
|
@@ -47,14 +49,11 @@ class Service {
|
|
|
47
49
|
}
|
|
48
50
|
return params;
|
|
49
51
|
}
|
|
50
|
-
static hardReset() {
|
|
51
|
-
this.serviceInstances = new Map();
|
|
52
|
-
}
|
|
53
52
|
}
|
|
54
53
|
exports.Service = Service;
|
|
55
|
-
|
|
54
|
+
hard_reset_1.BardLegendsHardReset.onHardReset
|
|
56
55
|
.subscribe(() => {
|
|
57
|
-
Service['
|
|
56
|
+
Service['_serviceInstances'] = new Map();
|
|
58
57
|
})
|
|
59
58
|
.attachToRoot();
|
|
60
59
|
//# sourceMappingURL=service.js.map
|
|
@@ -9,15 +9,16 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
9
9
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
const actions_lib_1 = require("actions-lib");
|
|
12
13
|
const vitest_1 = require("vitest");
|
|
13
14
|
const entity_1 = require("../entity/entity");
|
|
15
|
+
const hard_reset_1 = require("../hard-reset");
|
|
14
16
|
const scene_1 = require("../scene/scene");
|
|
15
|
-
const unit_test_helper_1 = require("../unit-test.helper");
|
|
16
17
|
const view_1 = require("../view/view");
|
|
17
18
|
const service_1 = require("./service");
|
|
18
19
|
(0, vitest_1.describe)('SERVICE', () => {
|
|
19
20
|
(0, vitest_1.beforeEach)(() => {
|
|
20
|
-
|
|
21
|
+
hard_reset_1.BardLegendsHardReset.hardReset();
|
|
21
22
|
});
|
|
22
23
|
(0, vitest_1.test)('get services', () => {
|
|
23
24
|
var SampleService_1;
|
|
@@ -38,9 +39,13 @@ const service_1 = require("./service");
|
|
|
38
39
|
(0, vitest_1.test)('inject services to views', () => {
|
|
39
40
|
var SampleService_2, SampleView_1;
|
|
40
41
|
let SampleScene = class SampleScene extends scene_1.Scene {
|
|
41
|
-
|
|
42
|
+
init() {
|
|
43
|
+
return actions_lib_1.SingleEvent.instant();
|
|
44
|
+
}
|
|
42
45
|
update() { }
|
|
43
|
-
|
|
46
|
+
prepareToClose() {
|
|
47
|
+
return actions_lib_1.SingleEvent.instant();
|
|
48
|
+
}
|
|
44
49
|
};
|
|
45
50
|
SampleScene = __decorate([
|
|
46
51
|
(0, scene_1.SceneDecorator)()
|
|
@@ -107,9 +112,13 @@ const service_1 = require("./service");
|
|
|
107
112
|
super();
|
|
108
113
|
this.service2 = service2;
|
|
109
114
|
}
|
|
110
|
-
|
|
115
|
+
init() {
|
|
116
|
+
return actions_lib_1.SingleEvent.instant();
|
|
117
|
+
}
|
|
111
118
|
update() { }
|
|
112
|
-
|
|
119
|
+
prepareToClose() {
|
|
120
|
+
return actions_lib_1.SingleEvent.instant();
|
|
121
|
+
}
|
|
113
122
|
};
|
|
114
123
|
SampleScene = __decorate([
|
|
115
124
|
(0, scene_1.SceneDecorator)(),
|
|
@@ -164,9 +173,13 @@ const service_1 = require("./service");
|
|
|
164
173
|
this.service2 = service2;
|
|
165
174
|
this.service3 = service3;
|
|
166
175
|
}
|
|
167
|
-
|
|
176
|
+
init() {
|
|
177
|
+
return actions_lib_1.SingleEvent.instant();
|
|
178
|
+
}
|
|
168
179
|
update() { }
|
|
169
|
-
|
|
180
|
+
prepareToClose() {
|
|
181
|
+
return actions_lib_1.SingleEvent.instant();
|
|
182
|
+
}
|
|
170
183
|
};
|
|
171
184
|
SampleScene = __decorate([
|
|
172
185
|
(0, scene_1.SceneDecorator)(),
|
|
@@ -198,9 +211,13 @@ const service_1 = require("./service");
|
|
|
198
211
|
super();
|
|
199
212
|
this.service = service;
|
|
200
213
|
}
|
|
201
|
-
|
|
214
|
+
init() {
|
|
215
|
+
return actions_lib_1.SingleEvent.instant();
|
|
216
|
+
}
|
|
202
217
|
update() { }
|
|
203
|
-
|
|
218
|
+
prepareToClose() {
|
|
219
|
+
return actions_lib_1.SingleEvent.instant();
|
|
220
|
+
}
|
|
204
221
|
};
|
|
205
222
|
SampleScene = __decorate([
|
|
206
223
|
(0, scene_1.SceneDecorator)(),
|
|
@@ -213,9 +230,13 @@ const service_1 = require("./service");
|
|
|
213
230
|
(0, vitest_1.test)('resolve parameters should pass known parameters with falsely values', () => {
|
|
214
231
|
var Parent_1;
|
|
215
232
|
let SampleScene = class SampleScene extends scene_1.Scene {
|
|
216
|
-
|
|
233
|
+
init() {
|
|
234
|
+
return actions_lib_1.SingleEvent.instant();
|
|
235
|
+
}
|
|
217
236
|
update() { }
|
|
218
|
-
|
|
237
|
+
prepareToClose() {
|
|
238
|
+
return actions_lib_1.SingleEvent.instant();
|
|
239
|
+
}
|
|
219
240
|
};
|
|
220
241
|
SampleScene = __decorate([
|
|
221
242
|
(0, scene_1.SceneDecorator)()
|
|
@@ -6,7 +6,7 @@ class UnitTestHelper {
|
|
|
6
6
|
static { this._hardResetAction = new actions_lib_1.Action(); }
|
|
7
7
|
static { this.onHardReset = this._hardResetAction.notifier; }
|
|
8
8
|
static hardReset() {
|
|
9
|
-
actions_lib_1.
|
|
9
|
+
actions_lib_1.ActionLibHardReset.hardReset();
|
|
10
10
|
this._hardResetAction.trigger();
|
|
11
11
|
}
|
|
12
12
|
}
|
|
@@ -1,35 +1,25 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { SingleEvent } from 'actions-lib';
|
|
2
2
|
export declare class UpdateCycle {
|
|
3
|
-
static readonly _beforeSceneUpdateAction
|
|
4
|
-
time: number;
|
|
5
|
-
delta: number;
|
|
6
|
-
}>;
|
|
3
|
+
private static readonly _beforeSceneUpdateAction;
|
|
7
4
|
static readonly beforeSceneUpdateAction: import("actions-lib").Notifier<{
|
|
8
5
|
time: number;
|
|
9
6
|
delta: number;
|
|
10
7
|
}>;
|
|
11
|
-
static readonly _sceneUpdateAction
|
|
12
|
-
time: number;
|
|
13
|
-
delta: number;
|
|
14
|
-
}>;
|
|
8
|
+
private static readonly _sceneUpdateAction;
|
|
15
9
|
static readonly sceneUpdateAction: import("actions-lib").Notifier<{
|
|
16
10
|
time: number;
|
|
17
11
|
delta: number;
|
|
18
12
|
}>;
|
|
19
|
-
static readonly _afterSceneUpdateAction
|
|
20
|
-
time: number;
|
|
21
|
-
delta: number;
|
|
22
|
-
}>;
|
|
13
|
+
private static readonly _afterSceneUpdateAction;
|
|
23
14
|
static readonly afterSceneUpdateAction: import("actions-lib").Notifier<{
|
|
24
15
|
time: number;
|
|
25
16
|
delta: number;
|
|
26
17
|
}>;
|
|
27
|
-
private static
|
|
28
|
-
|
|
29
|
-
static wait(duration: number): Promise<void>;
|
|
18
|
+
private static _updateModifierCallback;
|
|
19
|
+
static wait(duration: number): SingleEvent;
|
|
30
20
|
static registerUpdateModifier(callback: (time: number, delta: number) => number): void;
|
|
31
21
|
static cleanUpdateModifier(): void;
|
|
32
|
-
static triggerUpdateTick(delta: number):
|
|
22
|
+
static triggerUpdateTick(delta: number): void;
|
|
33
23
|
static get lastDelta(): number;
|
|
34
24
|
private static _lastDelta;
|
|
35
25
|
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.UpdateCycle = void 0;
|
|
4
4
|
const actions_lib_1 = require("actions-lib");
|
|
5
|
-
const
|
|
5
|
+
const hard_reset_1 = require("./hard-reset");
|
|
6
6
|
class UpdateCycle {
|
|
7
7
|
static { this._beforeSceneUpdateAction = new actions_lib_1.Action(); }
|
|
8
8
|
static { this.beforeSceneUpdateAction = this._beforeSceneUpdateAction.notifier; }
|
|
@@ -10,41 +10,43 @@ class UpdateCycle {
|
|
|
10
10
|
static { this.sceneUpdateAction = this._sceneUpdateAction.notifier; }
|
|
11
11
|
static { this._afterSceneUpdateAction = new actions_lib_1.Action(); }
|
|
12
12
|
static { this.afterSceneUpdateAction = this._afterSceneUpdateAction.notifier; }
|
|
13
|
-
|
|
14
|
-
static { this.
|
|
15
|
-
static
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
13
|
+
/** @internal */
|
|
14
|
+
static { this._time = 0; }
|
|
15
|
+
static { this._updateModifierCallback = undefined; }
|
|
16
|
+
static wait(duration) {
|
|
17
|
+
let targetTime = this._time + duration;
|
|
18
|
+
return actions_lib_1.SingleEvent.create(resolve => {
|
|
19
|
+
let subscription = UpdateCycle.beforeSceneUpdateAction
|
|
19
20
|
.subscribe(update => {
|
|
20
21
|
if (update.time >= targetTime) {
|
|
21
22
|
resolve();
|
|
22
23
|
}
|
|
23
24
|
})
|
|
24
25
|
.attachToRoot();
|
|
26
|
+
return () => subscription.destroy();
|
|
25
27
|
});
|
|
26
28
|
}
|
|
27
29
|
static registerUpdateModifier(callback) {
|
|
28
|
-
if (!this.
|
|
29
|
-
this.
|
|
30
|
+
if (!this._updateModifierCallback) {
|
|
31
|
+
this._updateModifierCallback = callback;
|
|
30
32
|
}
|
|
31
33
|
else {
|
|
32
34
|
throw new Error('UpdateCycle: There can only one update modifier!');
|
|
33
35
|
}
|
|
34
36
|
}
|
|
35
37
|
static cleanUpdateModifier() {
|
|
36
|
-
this.
|
|
38
|
+
this._updateModifierCallback = undefined;
|
|
37
39
|
}
|
|
38
|
-
static
|
|
39
|
-
if (this.
|
|
40
|
-
delta = this.
|
|
40
|
+
static triggerUpdateTick(delta) {
|
|
41
|
+
if (this._updateModifierCallback) {
|
|
42
|
+
delta = this._updateModifierCallback(this._time, delta);
|
|
41
43
|
}
|
|
42
|
-
this.
|
|
44
|
+
this._time += delta;
|
|
43
45
|
this._lastDelta = delta;
|
|
44
46
|
if (delta > 0) {
|
|
45
|
-
UpdateCycle._beforeSceneUpdateAction.trigger({ time: this.
|
|
46
|
-
UpdateCycle._sceneUpdateAction.trigger({ time: this.
|
|
47
|
-
UpdateCycle._afterSceneUpdateAction.trigger({ time: this.
|
|
47
|
+
UpdateCycle._beforeSceneUpdateAction.trigger({ time: this._time, delta });
|
|
48
|
+
UpdateCycle._sceneUpdateAction.trigger({ time: this._time, delta });
|
|
49
|
+
UpdateCycle._afterSceneUpdateAction.trigger({ time: this._time, delta });
|
|
48
50
|
}
|
|
49
51
|
}
|
|
50
52
|
static get lastDelta() {
|
|
@@ -53,9 +55,13 @@ class UpdateCycle {
|
|
|
53
55
|
static { this._lastDelta = 0; }
|
|
54
56
|
}
|
|
55
57
|
exports.UpdateCycle = UpdateCycle;
|
|
56
|
-
|
|
58
|
+
hard_reset_1.BardLegendsHardReset.onHardReset
|
|
57
59
|
.subscribe(() => {
|
|
58
|
-
UpdateCycle['
|
|
60
|
+
UpdateCycle['_beforeSceneUpdateAction'].clear();
|
|
61
|
+
UpdateCycle['_sceneUpdateAction'].clear();
|
|
62
|
+
UpdateCycle['_afterSceneUpdateAction'].clear();
|
|
63
|
+
UpdateCycle['_updateModifierCallback'] = undefined;
|
|
64
|
+
UpdateCycle['_time'] = 0;
|
|
59
65
|
})
|
|
60
66
|
.attachToRoot();
|
|
61
67
|
//# sourceMappingURL=update-cycle.js.map
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { IDAttachable } from 'actions-lib';
|
|
2
2
|
import { Entity, EntityClassType } from '../entity/entity';
|
|
3
3
|
export type ViewClassType<EntityType extends Entity> = new (entity: EntityType, ...services: any[]) => View;
|
|
4
4
|
export interface ViewDecoratorMeta<EntityType extends Entity> {
|
|
5
5
|
entity: EntityClassType<EntityType>;
|
|
6
6
|
}
|
|
7
7
|
export declare function ViewDecorator<EntityType extends Entity>(meta: ViewDecoratorMeta<EntityType>): (ViewClass: ViewClassType<EntityType>) => any;
|
|
8
|
-
export declare abstract class View extends
|
|
9
|
-
static getInstance<T extends View>(this: new (...args: any[]) => T,
|
|
10
|
-
static getInstanceOrFail<T extends View>(this: new (...args: any[]) => T,
|
|
11
|
-
private
|
|
8
|
+
export declare abstract class View extends IDAttachable {
|
|
9
|
+
static getInstance<T extends View>(this: new (...args: any[]) => T, entityID: number): T | undefined;
|
|
10
|
+
static getInstanceOrFail<T extends View>(this: new (...args: any[]) => T, entityID: number): T;
|
|
11
|
+
private _entityID;
|
|
12
12
|
constructor();
|
|
13
13
|
destroy(): void;
|
|
14
14
|
update(time: number, delta: number): void;
|
|
15
|
-
private
|
|
15
|
+
private _getViewInstances;
|
|
16
16
|
}
|
|
@@ -7,54 +7,48 @@ const service_1 = require("../service/service");
|
|
|
7
7
|
function ViewDecorator(meta) {
|
|
8
8
|
return function (ViewClass) {
|
|
9
9
|
ViewClass.$meta = {
|
|
10
|
-
paramtypes: service_1.Service.
|
|
10
|
+
paramtypes: service_1.Service._getParametersMeta(ViewClass),
|
|
11
11
|
viewInstances: new Map(),
|
|
12
12
|
entity: meta.entity,
|
|
13
13
|
type: 'view'
|
|
14
14
|
};
|
|
15
|
-
entity_views_helper_1.EntityViewsHelper
|
|
15
|
+
entity_views_helper_1.EntityViewsHelper.registerView(ViewClass, meta.entity);
|
|
16
16
|
};
|
|
17
17
|
}
|
|
18
18
|
exports.ViewDecorator = ViewDecorator;
|
|
19
|
-
class View extends actions_lib_1.
|
|
20
|
-
static getInstance(
|
|
21
|
-
if (!this.$meta.entity.
|
|
19
|
+
class View extends actions_lib_1.IDAttachable {
|
|
20
|
+
static getInstance(entityID) {
|
|
21
|
+
if (!this.$meta.entity.validateID(entityID)) {
|
|
22
22
|
return undefined;
|
|
23
23
|
}
|
|
24
24
|
let viewInstances = this.$meta.viewInstances;
|
|
25
|
-
return viewInstances.get(
|
|
25
|
+
return viewInstances.get(entityID);
|
|
26
26
|
}
|
|
27
|
-
static getInstanceOrFail(
|
|
28
|
-
if (!this.$meta.entity.
|
|
29
|
-
throw new Error(`View: getInstance is called with entity id: "${
|
|
27
|
+
static getInstanceOrFail(entityID) {
|
|
28
|
+
if (!this.$meta.entity.validateID(entityID)) {
|
|
29
|
+
throw new Error(`View: getInstance is called with entity id: "${entityID}", that is not belonging to the class: "${this.$meta.entity}"`);
|
|
30
30
|
}
|
|
31
31
|
let viewInstances = this.$meta.viewInstances;
|
|
32
|
-
let view = viewInstances.get(
|
|
32
|
+
let view = viewInstances.get(entityID);
|
|
33
33
|
if (!view) {
|
|
34
|
-
throw new Error(`View: getInstanceOrFail is called with entity id: "${
|
|
34
|
+
throw new Error(`View: getInstanceOrFail is called with entity id: "${entityID}", that is not found!`);
|
|
35
35
|
}
|
|
36
36
|
return view;
|
|
37
37
|
}
|
|
38
38
|
constructor() {
|
|
39
39
|
super();
|
|
40
40
|
this.attachToRoot();
|
|
41
|
-
this.
|
|
42
|
-
this.
|
|
43
|
-
let originalUpdate = this.update.bind(this);
|
|
44
|
-
this.update = function (time, delta) {
|
|
45
|
-
if (!this.destroyed) {
|
|
46
|
-
originalUpdate(time, delta);
|
|
47
|
-
}
|
|
48
|
-
};
|
|
41
|
+
this._entityID = entity_views_helper_1.EntityViewsHelper.entityID;
|
|
42
|
+
this._getViewInstances().set(this._entityID, this);
|
|
49
43
|
}
|
|
50
44
|
destroy() {
|
|
51
45
|
if (!this.destroyed) {
|
|
52
|
-
this.getViewInstances().delete(this._entityId);
|
|
53
46
|
super.destroy();
|
|
47
|
+
this._getViewInstances().delete(this._entityID);
|
|
54
48
|
}
|
|
55
49
|
}
|
|
56
50
|
update(time, delta) { }
|
|
57
|
-
|
|
51
|
+
_getViewInstances() {
|
|
58
52
|
return this.constructor.$meta.viewInstances;
|
|
59
53
|
}
|
|
60
54
|
}
|
|
@@ -12,17 +12,21 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
const actions_lib_1 = require("actions-lib");
|
|
13
13
|
const vitest_1 = require("vitest");
|
|
14
14
|
const entity_1 = require("../entity/entity");
|
|
15
|
+
const hard_reset_1 = require("../hard-reset");
|
|
15
16
|
const scene_1 = require("../scene/scene");
|
|
16
|
-
const unit_test_helper_1 = require("../unit-test.helper");
|
|
17
17
|
const update_cycle_1 = require("../update-cycle");
|
|
18
18
|
const view_1 = require("./view");
|
|
19
19
|
(0, vitest_1.describe)('VIEW', () => {
|
|
20
20
|
(0, vitest_1.beforeEach)(() => {
|
|
21
|
-
|
|
21
|
+
hard_reset_1.BardLegendsHardReset.hardReset();
|
|
22
22
|
let SampleScene = class SampleScene extends scene_1.Scene {
|
|
23
|
-
|
|
23
|
+
init() {
|
|
24
|
+
return actions_lib_1.SingleEvent.instant();
|
|
25
|
+
}
|
|
24
26
|
update() { }
|
|
25
|
-
|
|
27
|
+
prepareToClose() {
|
|
28
|
+
return actions_lib_1.SingleEvent.instant();
|
|
29
|
+
}
|
|
26
30
|
};
|
|
27
31
|
SampleScene = __decorate([
|
|
28
32
|
(0, scene_1.SceneDecorator)()
|
|
@@ -233,9 +237,9 @@ const view_1 = require("./view");
|
|
|
233
237
|
(0, view_1.ViewDecorator)({ entity: BaseEntity }),
|
|
234
238
|
__metadata("design:paramtypes", [BaseEntity])
|
|
235
239
|
], SampleView);
|
|
236
|
-
(0, vitest_1.expect)(() => SampleView.getInstanceOrFail(sampleEntity.id)).toThrow('View: getInstance is called with entity id: "3
|
|
240
|
+
(0, vitest_1.expect)(() => SampleView.getInstanceOrFail(sampleEntity.id)).toThrow('View: getInstance is called with entity id: "3", that is not belonging to the class:');
|
|
237
241
|
});
|
|
238
|
-
(0, vitest_1.test)('destroying entity should
|
|
242
|
+
(0, vitest_1.test)('destroying entity should prevent subscription of the view (new expected case)', async () => {
|
|
239
243
|
var Sample_1, SampleView_7;
|
|
240
244
|
let sampleAction = new actions_lib_1.Action();
|
|
241
245
|
let Sample = class Sample extends entity_1.Entity {
|
|
@@ -258,7 +262,7 @@ const view_1 = require("./view");
|
|
|
258
262
|
let SampleView = class SampleView extends view_1.View {
|
|
259
263
|
static { SampleView_7 = this; }
|
|
260
264
|
static { this.triggered = false; }
|
|
261
|
-
constructor(
|
|
265
|
+
constructor(_) {
|
|
262
266
|
super();
|
|
263
267
|
sampleAction
|
|
264
268
|
.subscribe(() => {
|
|
@@ -273,8 +277,8 @@ const view_1 = require("./view");
|
|
|
273
277
|
], SampleView);
|
|
274
278
|
let entity = new Sample().attach(scene_1.Scene.getActiveSceneOrFail());
|
|
275
279
|
sampleAction.trigger();
|
|
276
|
-
(0, vitest_1.expect)(Sample.triggered).
|
|
277
|
-
(0, vitest_1.expect)(SampleView.triggered).
|
|
280
|
+
(0, vitest_1.expect)(Sample.triggered).toBeTruthy();
|
|
281
|
+
(0, vitest_1.expect)(SampleView.triggered).toBeFalsy();
|
|
278
282
|
});
|
|
279
283
|
(0, vitest_1.test)('if view destroys the entity, the view should also be destroyed', async () => {
|
|
280
284
|
var Sample_2, SampleView_8;
|
|
@@ -313,5 +317,32 @@ const view_1 = require("./view");
|
|
|
313
317
|
(0, vitest_1.expect)(Sample.destroyed).toEqual(true);
|
|
314
318
|
(0, vitest_1.expect)(SampleView.destroyed).toEqual(true);
|
|
315
319
|
});
|
|
320
|
+
(0, vitest_1.test)('if entity get destroyed, the view update should not be called', () => {
|
|
321
|
+
let viewUpdateCount = 0;
|
|
322
|
+
let Sample = class Sample extends entity_1.Entity {
|
|
323
|
+
update() {
|
|
324
|
+
this.destroy();
|
|
325
|
+
}
|
|
326
|
+
};
|
|
327
|
+
Sample = __decorate([
|
|
328
|
+
(0, entity_1.EntityDecorator)()
|
|
329
|
+
], Sample);
|
|
330
|
+
let _SampleView = class _SampleView extends view_1.View {
|
|
331
|
+
constructor(entity) {
|
|
332
|
+
super();
|
|
333
|
+
}
|
|
334
|
+
update() {
|
|
335
|
+
viewUpdateCount++;
|
|
336
|
+
}
|
|
337
|
+
};
|
|
338
|
+
_SampleView = __decorate([
|
|
339
|
+
(0, view_1.ViewDecorator)({ entity: Sample }),
|
|
340
|
+
__metadata("design:paramtypes", [Sample])
|
|
341
|
+
], _SampleView);
|
|
342
|
+
new Sample().attach(scene_1.Scene.getActiveSceneOrFail());
|
|
343
|
+
(0, vitest_1.expect)(viewUpdateCount).toEqual(0);
|
|
344
|
+
update_cycle_1.UpdateCycle.triggerUpdateTick(1);
|
|
345
|
+
(0, vitest_1.expect)(viewUpdateCount).toEqual(0);
|
|
346
|
+
});
|
|
316
347
|
});
|
|
317
348
|
//# sourceMappingURL=view.test.js.map
|
|
@@ -4,6 +4,6 @@ import { PhysicsEntity } from './physics-entity';
|
|
|
4
4
|
export declare abstract class ImmovablePhysicsEntity extends PhysicsEntity {
|
|
5
5
|
readonly position: Vector;
|
|
6
6
|
readonly rotation: Radian;
|
|
7
|
-
constructor(
|
|
7
|
+
constructor(physicsWorldID: number, physicsEntityDefinition: PhysicsEntityDefinition);
|
|
8
8
|
convertToDTO(): PhysicsBodyDTO;
|
|
9
9
|
}
|
|
@@ -5,15 +5,15 @@ const helpers_lib_1 = require("helpers-lib");
|
|
|
5
5
|
const p2js_helper_1 = require("../libs/p2js.helper");
|
|
6
6
|
const physics_entity_1 = require("./physics-entity");
|
|
7
7
|
class ImmovablePhysicsEntity extends physics_entity_1.PhysicsEntity {
|
|
8
|
-
constructor(
|
|
9
|
-
super(
|
|
8
|
+
constructor(physicsWorldID, physicsEntityDefinition) {
|
|
9
|
+
super(physicsWorldID, physicsEntityDefinition, 'static');
|
|
10
10
|
this.position = p2js_helper_1.P2JSHelper.arrayToVector(this.p2Body.position);
|
|
11
11
|
this.rotation = new helpers_lib_1.Radian(this.p2Body.angle);
|
|
12
12
|
}
|
|
13
13
|
convertToDTO() {
|
|
14
14
|
return {
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
entityID: this.id,
|
|
16
|
+
classID: this.classID,
|
|
17
17
|
position: this.position,
|
|
18
18
|
rotation: this.rotation,
|
|
19
19
|
velocity: helpers_lib_1.Vector.zero,
|
|
@@ -13,11 +13,11 @@ class MovableEntity extends game_entities_1.Entity {
|
|
|
13
13
|
this.rotationalSpeed = new actions_lib_1.Variable(0);
|
|
14
14
|
game_entities_1.UpdateCycle.beforeSceneUpdateAction
|
|
15
15
|
.subscribe(({ time, delta }) => {
|
|
16
|
-
this.
|
|
16
|
+
this._step(time, delta);
|
|
17
17
|
})
|
|
18
18
|
.attach(this);
|
|
19
19
|
}
|
|
20
|
-
|
|
20
|
+
_step(time, delta) {
|
|
21
21
|
this.position.value = this.position.value.add(this.velocity.value.multiplyNumber(delta));
|
|
22
22
|
this.rotation.value = new helpers_lib_1.Radian(this.rotation.value.value + this.rotationalSpeed.value * delta);
|
|
23
23
|
}
|
|
@@ -7,13 +7,13 @@ export declare abstract class MovablePhysicsEntity extends PhysicsEntity {
|
|
|
7
7
|
readonly rotation: Variable<Radian>;
|
|
8
8
|
readonly velocity: Variable<Vector>;
|
|
9
9
|
readonly rotationalSpeed: Variable<number>;
|
|
10
|
-
private
|
|
11
|
-
private
|
|
12
|
-
private
|
|
13
|
-
private
|
|
14
|
-
constructor(
|
|
10
|
+
private _ignorePositionUpdate;
|
|
11
|
+
private _ignoreRotationUpdate;
|
|
12
|
+
private _ignoreVelocityUpdate;
|
|
13
|
+
private _ignoreRotationalSpeedUpdate;
|
|
14
|
+
constructor(physicsWorldID: number, physicsEntityDefinition: PhysicsEntityDefinition);
|
|
15
15
|
convertToDTO(): PhysicsBodyDTO;
|
|
16
|
-
private
|
|
17
|
-
private
|
|
18
|
-
private
|
|
16
|
+
private _step;
|
|
17
|
+
private _phsicsToLocalSync;
|
|
18
|
+
private _localToPhsicsSync;
|
|
19
19
|
}
|