bard-legends-framework 0.9.6 → 0.9.7
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/_interfaces/index.d.ts +2 -2
- package/dist/_interfaces/index.js +2 -3
- package/dist/game-entities/attachable/attachable.d.ts +6 -6
- package/dist/game-entities/attachable/attachable.js +28 -30
- package/dist/game-entities/attachable/attachable.spec.js +129 -128
- package/dist/game-entities/attachable/attachable.store.d.ts +5 -5
- package/dist/game-entities/attachable/attachable.store.js +34 -32
- package/dist/game-entities/attachable/attachable.test.js +132 -131
- package/dist/game-entities/attachable/destroyable.d.ts +13 -13
- package/dist/game-entities/attachable/destroyable.js +64 -69
- package/dist/game-entities/attachable/helpers/decorate-actions-lib.d.ts +15 -15
- package/dist/game-entities/attachable/helpers/decorate-actions-lib.js +125 -116
- package/dist/game-entities/attachable/helpers/referance-variable.d.ts +15 -15
- package/dist/game-entities/attachable/helpers/referance-variable.js +47 -48
- package/dist/game-entities/attachable/interfaces.d.ts +6 -6
- package/dist/game-entities/attachable/interfaces.js +2 -3
- package/dist/game-entities/base/helpers/decorate-actions-lib.js +0 -1
- package/dist/game-entities/controller/controller.js +0 -1
- package/dist/game-entities/controller/controller.spec.js +128 -125
- package/dist/game-entities/entity/entity.spec.js +263 -293
- package/dist/game-entities/entity/helpers/view-creation.helper.d.ts +7 -7
- package/dist/game-entities/entity/helpers/view-creation.helper.js +48 -48
- package/dist/game-entities/scene/scene.spec.js +219 -223
- package/dist/game-entities/service/service.js +0 -4
- package/dist/game-entities/service/service.spec.js +265 -237
- package/dist/game-entities/service/service.test.js +4 -2
- package/dist/game-entities/update-loop.d.ts +18 -18
- package/dist/game-entities/update-loop.js +46 -28
- package/dist/game-entities/view/view.spec.js +490 -506
- package/dist/game-entities/view/view.test.js +1 -1
- package/dist/lib/animator/animations.d.ts +13 -13
- package/dist/lib/animator/animations.js +43 -40
- package/dist/lib/animator/animator.d.ts +41 -41
- package/dist/lib/animator/animator.js +194 -197
- package/dist/lib/animator/animator.spec.js +699 -612
- package/dist/lib/animator/index.js +24 -19
- package/dist/lib/libraries/animator/animations.d.ts +13 -13
- package/dist/lib/libraries/animator/animations.js +43 -40
- package/dist/lib/libraries/animator/animator.d.ts +41 -41
- package/dist/lib/libraries/animator/animator.js +194 -197
- package/dist/lib/libraries/animator/animator.spec.js +699 -612
- package/dist/lib/libraries/animator/index.js +24 -19
- package/dist/lib/libraries/path-finder/path-finder.d.ts +2 -2
- package/dist/lib/libraries/path-finder/path-finder.js +19 -20
- package/dist/lib/path-finder/path-finder.d.ts +2 -2
- package/dist/lib/path-finder/path-finder.js +19 -20
- package/dist/lib/services/keyboard/keyboard.d.ts +4 -4
- package/dist/lib/services/keyboard/keyboard.js +39 -31
- package/dist/lib/services/mouse/mouse.service.d.ts +8 -8
- package/dist/lib/services/mouse/mouse.service.js +65 -53
- package/dist/lib/services/mouse/mouser-target-focus.service.d.ts +11 -11
- package/dist/lib/services/mouse/mouser-target-focus.service.js +83 -81
- package/dist/lib/update-loop.d.ts +10 -10
- package/dist/lib/update-loop.js +35 -27
- package/dist/physics/entitity-types/immovable-physics-entity.d.ts +6 -6
- package/dist/physics/entitity-types/immovable-physics-entity.js +23 -24
- package/dist/physics/entitity-types/movable-entity.d.ts +6 -6
- package/dist/physics/entitity-types/movable-entity.js +21 -22
- package/dist/physics/entitity-types/movable-physics-entity.d.ts +14 -14
- package/dist/physics/entitity-types/movable-physics-entity.js +83 -88
- package/dist/physics/entitity-types/physics-entity.d.ts +23 -23
- package/dist/physics/entitity-types/physics-entity.js +97 -88
- package/dist/physics/helpers/closest-available-space.helper.d.ts +16 -16
- package/dist/physics/helpers/closest-available-space.helper.js +98 -96
- package/dist/physics/helpers/closest-available-space.helper.spec.js +115 -68
- package/dist/physics/helpers/p2js.helper.d.ts +3 -3
- package/dist/physics/helpers/p2js.helper.js +21 -22
- package/dist/physics/helpers/shape-factory.d.ts +9 -4
- package/dist/physics/helpers/shape-factory.js +99 -75
- package/dist/physics/libs/p2js.helper.js +1 -1
- package/dist/physics/libs/position-to-grid-position-converter.d.ts +3 -3
- package/dist/physics/libs/position-to-grid-position-converter.js +15 -13
- package/dist/physics/module//360/237/223/220services/availability-grid.service.d.ts +10 -5
- package/dist/physics/module//360/237/223/220services/availability-grid.service.js +77 -57
- package/dist/physics/module//360/237/223/220services/border.service.d.ts +2 -2
- package/dist/physics/module//360/237/223/220services/border.service.js +57 -37
- package/dist/physics/module//360/237/223/220services/collision/physics-body-group.service.js +1 -1
- package/dist/physics/module//360/237/223/220services/collisions.service.d.ts +7 -7
- package/dist/physics/module//360/237/223/220services/collisions.service.js +110 -98
- package/dist/physics/module//360/237/223/220services/debug-visuals.service.d.ts +28 -6
- package/dist/physics/module//360/237/223/220services/debug-visuals.service.js +121 -89
- package/dist/physics/module//360/237/223/220services/eliptic-explosion.service.d.ts +15 -7
- package/dist/physics/module//360/237/223/220services/eliptic-explosion.service.js +117 -93
- package/dist/physics/module//360/237/223/220services/explosion.service.d.ts +14 -7
- package/dist/physics/module//360/237/223/220services/explosion.service.js +102 -77
- package/dist/physics/module//360/237/223/220services/explosions/eliptic-explosion.service.d.ts +15 -7
- package/dist/physics/module//360/237/223/220services/explosions/eliptic-explosion.service.js +117 -93
- package/dist/physics/module//360/237/223/220services/explosions/explosion.service.d.ts +14 -7
- package/dist/physics/module//360/237/223/220services/explosions/explosion.service.js +102 -77
- package/dist/physics/module//360/237/223/220services/explosions/helpers/ray-cast-hit-converter.d.ts +3 -3
- package/dist/physics/module//360/237/223/220services/explosions/helpers/ray-cast-hit-converter.js +71 -67
- package/dist/physics/module//360/237/223/220services/helpers/ray-cast-hit-converter.d.ts +3 -3
- package/dist/physics/module//360/237/223/220services/helpers/ray-cast-hit-converter.js +71 -67
- package/dist/physics/module//360/237/223/220services/impact/eliptic-explosion.service.js +1 -1
- package/dist/physics/module//360/237/223/220services/materials.service.d.ts +16 -11
- package/dist/physics/module//360/237/223/220services/materials.service.js +118 -108
- package/dist/physics/module//360/237/223/220services/path-finder.service.d.ts +19 -8
- package/dist/physics/module//360/237/223/220services/path-finder.service.js +121 -82
- package/dist/physics/module//360/237/223/220services/physics-world.service.d.ts +30 -15
- package/dist/physics/module//360/237/223/220services/physics-world.service.js +122 -100
- package/dist/physics/module//360/237/223/220services/ray-casting.service.d.ts +3 -3
- package/dist/physics/module//360/237/223/220services/ray-casting.service.js +87 -86
- package/dist/physics/module//360/237/223/220services/shape-creation.service.d.ts +9 -4
- package/dist/physics/module//360/237/223/220services/shape-creation.service.js +113 -84
- package/dist/physics/module//360/237/223/220services/test-visuals/test-visuals.service.js +2 -1
- package/dist/physics/module//360/237/247/212entities/data-structures/availability-grid-cache.d.ts +8 -8
- package/dist/physics/module//360/237/247/212entities/data-structures/availability-grid-cache.js +32 -33
- package/dist/physics/physics-world.d.ts +50 -34
- package/dist/physics/physics-world.js +142 -133
- package/dist/physics/sub-elements/available-spaces/helpers/availability-grid.helper.d.ts +3 -3
- package/dist/physics/sub-elements/available-spaces/helpers/availability-grid.helper.js +15 -13
- package/dist/physics/sub-elements/available-spaces/physics-availability-grid.d.ts +9 -9
- package/dist/physics/sub-elements/available-spaces/physics-availability-grid.js +82 -77
- package/dist/physics/sub-elements/available-spaces/physics-available-spaces.d.ts +18 -14
- package/dist/physics/sub-elements/available-spaces/physics-available-spaces.js +91 -79
- package/dist/physics/sub-elements/collisions/contact-equation-orginiser.d.ts +11 -11
- package/dist/physics/sub-elements/collisions/contact-equation-orginiser.js +84 -76
- package/dist/physics/sub-elements/collisions/physics-collision.d.ts +7 -7
- package/dist/physics/sub-elements/collisions/physics-collision.js +43 -44
- package/dist/physics/sub-elements/elements/physics-body-groups.d.ts +11 -11
- package/dist/physics/sub-elements/elements/physics-body-groups.js +54 -54
- package/dist/physics/sub-elements/elements/physics-materials.d.ts +15 -10
- package/dist/physics/sub-elements/elements/physics-materials.js +101 -100
- package/dist/physics/sub-elements/elements/physics-world-borders.d.ts +3 -3
- package/dist/physics/sub-elements/elements/physics-world-borders.js +69 -45
- package/dist/physics/sub-elements/physics-body-groups.d.ts +8 -8
- package/dist/physics/sub-elements/physics-body-groups.js +41 -42
- package/dist/physics/sub-elements/physics-collision.d.ts +16 -16
- package/dist/physics/sub-elements/physics-collision.js +141 -121
- package/dist/physics/sub-elements/physics-materials.d.ts +15 -10
- package/dist/physics/sub-elements/physics-materials.js +101 -100
- package/dist/physics/sub-elements/physics-world-borders.d.ts +2 -2
- package/dist/physics/sub-elements/physics-world-borders.js +25 -26
- package/dist/physics/sub-elements/raycasting/physics-body-explosion-hit.d.ts +15 -11
- package/dist/physics/sub-elements/raycasting/physics-body-explosion-hit.js +59 -59
- package/dist/physics/sub-elements/raycasting/physics-explosion.d.ts +13 -6
- package/dist/physics/sub-elements/raycasting/physics-explosion.js +108 -73
- package/dist/physics/sub-elements/raycasting/ray-cast.d.ts +19 -19
- package/dist/physics/sub-elements/raycasting/ray-cast.js +93 -98
- package/dist/pixi/display-object/components/filters.d.ts +18 -18
- package/dist/pixi/display-object/components/filters.js +106 -81
- package/dist/pixi/display-object/components/glow-effect.d.ts +8 -8
- package/dist/pixi/display-object/components/glow-effect.js +33 -36
- package/dist/pixi/display-object/components/glow-filter.d.ts +8 -8
- package/dist/pixi/display-object/components/glow-filter.js +33 -36
- package/dist/pixi/display-object/container-attributes.js +1 -1
- package/dist/pixi/display-object/display-object-attributes.d.ts +41 -41
- package/dist/pixi/display-object/display-object-attributes.js +148 -150
- package/dist/pixi/display-object/display-object.d.ts +17 -17
- package/dist/pixi/display-object/display-object.js +79 -75
- package/dist/pixi/display-object/filters/base-filters/alpha-primer-color.filter.d.ts +9 -4
- package/dist/pixi/display-object/filters/base-filters/alpha-primer-color.filter.js +89 -77
- package/dist/pixi/display-object/filters/base-filters/blur.filter.js +30 -30
- package/dist/pixi/display-object/filters/base-filters/contrast-filter.d.ts +9 -4
- package/dist/pixi/display-object/filters/base-filters/contrast-filter.js +62 -53
- package/dist/pixi/display-object/filters/base-filters/expand-with-alpha-color.d.ts +10 -5
- package/dist/pixi/display-object/filters/base-filters/expand-with-alpha-color.js +93 -81
- package/dist/pixi/display-object/filters/base-filters/expand-with-color-gradient.d.ts +12 -7
- package/dist/pixi/display-object/filters/base-filters/expand-with-color-gradient.js +120 -109
- package/dist/pixi/display-object/filters/base-filters/expand-with-color.d.ts +10 -5
- package/dist/pixi/display-object/filters/base-filters/expand-with-color.filter.js +32 -32
- package/dist/pixi/display-object/filters/base-filters/expand-with-color.js +92 -85
- package/dist/pixi/display-object/filters/templates/checking-neighbors.template.js +28 -28
- package/dist/pixi/display-object/filters/templates/plane.template.js +20 -20
- package/dist/pixi/display-object/filters.js +20 -4
- package/dist/pixi/display-object/objects/components/filters.d.ts +18 -18
- package/dist/pixi/display-object/objects/components/filters.js +106 -81
- package/dist/pixi/display-object/objects/container.d.ts +2 -2
- package/dist/pixi/display-object/objects/container.js +39 -30
- package/dist/pixi/display-object/objects/graphics.d.ts +28 -28
- package/dist/pixi/display-object/objects/graphics.js +218 -202
- package/dist/pixi/display-object/objects/helpers/filters.d.ts +25 -25
- package/dist/pixi/display-object/objects/helpers/filters.js +150 -124
- package/dist/pixi/display-object/objects/helpers/glow-sprite-generator.d.ts +7 -7
- package/dist/pixi/display-object/objects/helpers/glow-sprite-generator.js +114 -95
- package/dist/pixi/display-object/objects/premade-objects/sprite-with-glowing-shapes.d.ts +5 -5
- package/dist/pixi/display-object/objects/premade-objects/sprite-with-glowing-shapes.js +81 -57
- package/dist/pixi/display-object/objects/sprite.d.ts +43 -43
- package/dist/pixi/display-object/objects/sprite.js +248 -233
- package/dist/pixi/display-object/objects/text/helpers/process-steps/1-data-in-converter/rich-text-data-in-converter.js +1 -1
- package/dist/pixi/display-object/objects/text/helpers/process-steps/1-data-in-converter/rich-text-data-in-converter.test.js +9 -9
- package/dist/pixi/display-object/objects/text/helpers/rich-text-to-plane-text.d.ts +1 -1
- package/dist/pixi/display-object/objects/text.d.ts +25 -25
- package/dist/pixi/display-object/objects/text.js +111 -102
- package/dist/pixi/display-object/premade-objects/sprite-with-glowing-shapes.d.ts +13 -9
- package/dist/pixi/display-object/premade-objects/sprite-with-glowing-shapes.js +96 -67
- package/dist/pixi/game.d.ts +1 -1
- package/dist/pixi/game.js +2 -2
- package/dist/pixi/helpers/glow-sprite-generator.d.ts +6 -6
- package/dist/pixi/helpers/glow-sprite-generator.js +99 -84
- package/dist/pixi/helpers/pixi-container.helper.d.ts +1 -1
- package/dist/pixi/helpers/pixi-container.helper.js +10 -8
- package/dist/pixi/helpers/screen-position-to-stage.helper.d.ts +1 -1
- package/dist/pixi/helpers/screen-position-to-stage.helper.js +12 -12
- package/dist/pixi/helpers/screen-position-to-stage.helper.test.js +174 -79
- package/dist/pixi/modules/CAMERA/index.d.ts +1 -1
- package/dist/pixi/modules/CAMERA/index.js +3 -3
- package/dist/services/keyboard/keyboard.d.ts +4 -4
- package/dist/services/keyboard/keyboard.js +39 -31
- package/dist/services/mouse/mouse.service.d.ts +8 -8
- package/dist/services/mouse/mouse.service.js +65 -53
- package/dist/services/mouse/mouser-target-focus.service.d.ts +11 -11
- package/dist/services/mouse/mouser-target-focus.service.js +83 -81
- package/dist/utilities/libraries/animator/animating-content/state-animation.d.ts +29 -26
- package/dist/utilities/libraries/animator/animating-content/state-animation.js +159 -165
- package/dist/utilities/libraries/animator/animating-content/state-animation.test.js +386 -375
- package/dist/utilities/libraries/animator/animator.spec.js +765 -656
- package/dist/utilities/libraries/binary-heap/binary-heap.d.ts +11 -11
- package/dist/utilities/libraries/binary-heap/binary-heap.js +79 -81
- package/dist/utilities/libraries/data-structures/binary-heap/binary-heap.d.ts +11 -11
- package/dist/utilities/libraries/data-structures/binary-heap/binary-heap.js +79 -81
- package/dist/utilities/libraries/data-structures/grid/grid.d.ts +35 -31
- package/dist/utilities/libraries/data-structures/grid/grid.js +128 -117
- package/dist/utilities/libraries/data-structures/grid/grid.spec.js +176 -138
- package/dist/utilities/libraries/data-structures/grid/grid.test.js +218 -141
- package/dist/utilities/libraries/data-structures/grid/position-to-grid-position-converter.d.ts +3 -3
- package/dist/utilities/libraries/data-structures/grid/position-to-grid-position-converter.js +15 -13
- package/dist/utilities/libraries/data-structures/queue/queue.d.ts +21 -21
- package/dist/utilities/libraries/data-structures/queue/queue.js +63 -66
- package/dist/utilities/libraries/data-structures/queue/queue.test.js +54 -55
- package/dist/utilities/libraries/grid-algorithms/closest-available-space/closest-available-space.helper.spec.js +122 -68
- package/dist/utilities/libraries/grid-algorithms/path-finder/path-finder.spec.js +140 -135
- package/dist/utilities/libraries/grid-algorithms/vector-field-path-finder/vector-field-path-finder.spec.js +293 -229
- package/dist/utilities/libraries/path-finder/path-finder.d.ts +7 -7
- package/dist/utilities/libraries/path-finder/path-finder.js +113 -109
- package/dist/utilities/libraries/path-finder/path-finder.spec.js +131 -106
- package/dist/utilities/services/keyboard/keyboard.d.ts +4 -4
- package/dist/utilities/services/keyboard/keyboard.js +42 -34
- package/dist/utilities/services/mouse/helpers/mouse-position.helper.d.ts +1 -1
- package/dist/utilities/services/mouse/helpers/mouse-position.helper.js +12 -12
- package/dist/utilities/services/mouse/helpers/mouse-position.helper.test.js +168 -73
- package/dist/utilities/services/mouse/mouse-target-focus.service.d.ts +15 -15
- package/dist/utilities/services/mouse/mouse-target-focus.service.js +79 -76
- package/dist/utilities/services/mouse/mouse.service.d.ts +9 -9
- package/dist/utilities/services/mouse/mouse.service.js +86 -72
- package/dist/utilities/services/mouse/mouser-target-focus.service.d.ts +11 -11
- package/dist/utilities/services/mouse/mouser-target-focus.service.js +83 -81
- package/package.json +4 -10
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
//# sourceMappingURL=index.js.map
|
|
1
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
2
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { Destroyable } from './destroyable';
|
|
2
2
|
import { CanBeAttached, IAttachable } from './interfaces';
|
|
3
3
|
export declare abstract class Attachable extends Destroyable implements IAttachable {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
4
|
+
readonly id: string;
|
|
5
|
+
private attachments;
|
|
6
|
+
constructor();
|
|
7
|
+
protected destroySelf(): void;
|
|
8
|
+
setAttachment(child: CanBeAttached): void;
|
|
9
|
+
removeAttachment(child: CanBeAttached): void;
|
|
10
10
|
}
|
|
@@ -1,36 +1,34 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
3
2
|
exports.Attachable = void 0;
|
|
4
|
-
const attachable_store_1 = require(
|
|
5
|
-
const destroyable_1 = require(
|
|
3
|
+
const attachable_store_1 = require('./attachable.store');
|
|
4
|
+
const destroyable_1 = require('./destroyable');
|
|
6
5
|
class Attachable extends destroyable_1.Destroyable {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
6
|
+
constructor() {
|
|
7
|
+
super();
|
|
8
|
+
this.id = '';
|
|
9
|
+
this.attachments = [];
|
|
10
|
+
this.id = attachable_store_1.AttachableStore.registerAttachable(this);
|
|
11
|
+
}
|
|
12
|
+
destroySelf() {
|
|
13
|
+
super.destroySelf();
|
|
14
|
+
attachable_store_1.AttachableStore.unregisterAttachable(this);
|
|
15
|
+
const attachedEntities = [...this.attachments];
|
|
16
|
+
attachedEntities.forEach(item => this.destroyAttachment(item));
|
|
17
|
+
this.attachments = [];
|
|
18
|
+
}
|
|
19
|
+
setAttachment(child) {
|
|
20
|
+
if (this.destroyed) {
|
|
21
|
+
this.destroyAttachment(child);
|
|
22
|
+
} else {
|
|
23
|
+
this.attachments.push(child);
|
|
12
24
|
}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
this.attachments = [];
|
|
19
|
-
}
|
|
20
|
-
setAttachment(child) {
|
|
21
|
-
if (this.destroyed) {
|
|
22
|
-
this.destroyAttachment(child);
|
|
23
|
-
}
|
|
24
|
-
else {
|
|
25
|
-
this.attachments.push(child);
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
removeAttachment(child) {
|
|
29
|
-
let index = this.attachments.indexOf(child);
|
|
30
|
-
if (index >= 0) {
|
|
31
|
-
this.attachments.splice(index, 1);
|
|
32
|
-
}
|
|
25
|
+
}
|
|
26
|
+
removeAttachment(child) {
|
|
27
|
+
const index = this.attachments.indexOf(child);
|
|
28
|
+
if (index >= 0) {
|
|
29
|
+
this.attachments.splice(index, 1);
|
|
33
30
|
}
|
|
31
|
+
}
|
|
34
32
|
}
|
|
35
33
|
exports.Attachable = Attachable;
|
|
36
|
-
//# sourceMappingURL=attachable.js.map
|
|
34
|
+
//# sourceMappingURL=attachable.js.map
|
|
@@ -1,136 +1,137 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
})
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
1
|
+
var __createBinding =
|
|
2
|
+
(this && this.__createBinding) ||
|
|
3
|
+
(Object.create
|
|
4
|
+
? (o, m, k, k2) => {
|
|
5
|
+
if (k2 === undefined) k2 = k;
|
|
6
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
7
|
+
if (!desc || ('get' in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
8
|
+
desc = { enumerable: true, get: () => m[k] };
|
|
9
|
+
}
|
|
10
|
+
Object.defineProperty(o, k2, desc);
|
|
11
|
+
}
|
|
12
|
+
: (o, m, k, k2) => {
|
|
13
|
+
if (k2 === undefined) k2 = k;
|
|
14
|
+
o[k2] = m[k];
|
|
15
|
+
});
|
|
16
|
+
var __setModuleDefault =
|
|
17
|
+
(this && this.__setModuleDefault) ||
|
|
18
|
+
(Object.create
|
|
19
|
+
? (o, v) => {
|
|
20
|
+
Object.defineProperty(o, 'default', { enumerable: true, value: v });
|
|
21
|
+
}
|
|
22
|
+
: (o, v) => {
|
|
23
|
+
o['default'] = v;
|
|
24
|
+
});
|
|
25
|
+
var __decorate =
|
|
26
|
+
(this && this.__decorate) ||
|
|
27
|
+
((decorators, target, key, desc) => {
|
|
28
|
+
var c = arguments.length,
|
|
29
|
+
r = c < 3 ? target : desc === null ? (desc = Object.getOwnPropertyDescriptor(target, key)) : desc,
|
|
30
|
+
d;
|
|
31
|
+
if (typeof Reflect === 'object' && typeof Reflect.decorate === 'function')
|
|
32
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
33
|
+
else
|
|
34
|
+
for (var i = decorators.length - 1; i >= 0; i--)
|
|
35
|
+
if ((d = decorators[i])) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
22
36
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
23
|
-
};
|
|
24
|
-
var __importStar =
|
|
37
|
+
});
|
|
38
|
+
var __importStar =
|
|
39
|
+
(this && this.__importStar) ||
|
|
40
|
+
(mod => {
|
|
25
41
|
if (mod && mod.__esModule) return mod;
|
|
26
42
|
var result = {};
|
|
27
|
-
if (mod != null) for (var k in mod) if (k !==
|
|
43
|
+
if (mod != null) for (var k in mod) if (k !== 'default' && Object.hasOwn(mod, k)) __createBinding(result, mod, k);
|
|
28
44
|
__setModuleDefault(result, mod);
|
|
29
45
|
return result;
|
|
30
|
-
};
|
|
31
|
-
var __metadata =
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
const
|
|
38
|
-
const
|
|
39
|
-
const
|
|
40
|
-
const
|
|
41
|
-
const
|
|
46
|
+
});
|
|
47
|
+
var __metadata =
|
|
48
|
+
(this && this.__metadata) ||
|
|
49
|
+
((k, v) => {
|
|
50
|
+
if (typeof Reflect === 'object' && typeof Reflect.metadata === 'function') return Reflect.metadata(k, v);
|
|
51
|
+
});
|
|
52
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
53
|
+
const vitest_1 = require('vitest');
|
|
54
|
+
const actions_lib_1 = require('actions-lib');
|
|
55
|
+
const ActionsLib = __importStar(require('actions-lib'));
|
|
56
|
+
const entity_1 = require('../entity/entity');
|
|
57
|
+
const update_loop_1 = require('../update-loop');
|
|
58
|
+
const scene_1 = require('../scene/scene');
|
|
59
|
+
const decorate_actions_lib_1 = require('../attachable/helpers/decorate-actions-lib');
|
|
42
60
|
decorate_actions_lib_1.ActionsLibDecorator.decorate(ActionsLib);
|
|
43
61
|
(0, vitest_1.describe)('ATTACHABLE', () => {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
(0
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
Parent = __decorate([
|
|
119
|
-
(0, entity_1.EntityDecorator)(),
|
|
120
|
-
__metadata("design:paramtypes", [])
|
|
121
|
-
], Parent);
|
|
122
|
-
let Child = class Child extends entity_1.Entity {
|
|
123
|
-
destroy() {
|
|
124
|
-
childDestoyIsCalled = true;
|
|
125
|
-
}
|
|
126
|
-
};
|
|
127
|
-
Child = __decorate([
|
|
128
|
-
(0, entity_1.EntityDecorator)()
|
|
129
|
-
], Child);
|
|
130
|
-
let parent = new Parent().attach(scene_1.Scene.activeScene);
|
|
131
|
-
parent.destroy();
|
|
132
|
-
update_loop_1.UpdateCycle.triggerUpdateTick(0); // Update cycle should take place to destroy functions to be called
|
|
133
|
-
(0, vitest_1.expect)(childDestoyIsCalled).toBeTruthy();
|
|
134
|
-
});
|
|
62
|
+
(0, vitest_1.beforeEach)(() => {
|
|
63
|
+
update_loop_1.UpdateCycle.hardResetAction.trigger();
|
|
64
|
+
let SampleScene = class SampleScene extends scene_1.Scene {};
|
|
65
|
+
SampleScene = __decorate([(0, scene_1.SceneDecorator)()], SampleScene);
|
|
66
|
+
SampleScene.open(undefined);
|
|
67
|
+
});
|
|
68
|
+
(0, vitest_1.test)('destroyable', () => {
|
|
69
|
+
let Sample = class Sample extends entity_1.Entity {};
|
|
70
|
+
Sample = __decorate([(0, entity_1.EntityDecorator)()], Sample);
|
|
71
|
+
class Foo {
|
|
72
|
+
constructor() {
|
|
73
|
+
this.destroyed = false;
|
|
74
|
+
}
|
|
75
|
+
destroy() {
|
|
76
|
+
this.destroyed = true;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
const sample = new Sample().attach(scene_1.Scene.activeScene);
|
|
80
|
+
const foo = new Foo();
|
|
81
|
+
sample['setAttachment'](foo);
|
|
82
|
+
sample.destroy();
|
|
83
|
+
update_loop_1.UpdateCycle.triggerUpdateTick(0); // Update cycle should take place to destroy functions to be called
|
|
84
|
+
(0, vitest_1.expect)(foo.destroyed).toBeTruthy();
|
|
85
|
+
});
|
|
86
|
+
(0, vitest_1.test)('destroyable, delayed', () => {
|
|
87
|
+
let Sample = class Sample extends entity_1.Entity {};
|
|
88
|
+
Sample = __decorate([(0, entity_1.EntityDecorator)()], Sample);
|
|
89
|
+
class Foo {
|
|
90
|
+
constructor() {
|
|
91
|
+
this.destroyed = false;
|
|
92
|
+
}
|
|
93
|
+
destroy() {
|
|
94
|
+
this.destroyed = true;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
const sample = new Sample().attach(scene_1.Scene.activeScene);
|
|
98
|
+
const foo = new Foo();
|
|
99
|
+
sample['setAttachment'](foo);
|
|
100
|
+
sample.destroy();
|
|
101
|
+
update_loop_1.UpdateCycle.triggerUpdateTick(0); // Update cycle should take place to destroy functions to be called
|
|
102
|
+
(0, vitest_1.expect)(foo.destroyed).toBeTruthy();
|
|
103
|
+
});
|
|
104
|
+
(0, vitest_1.test)('subscription', () => {
|
|
105
|
+
let Sample = class Sample extends entity_1.Entity {};
|
|
106
|
+
Sample = __decorate([(0, entity_1.EntityDecorator)()], Sample);
|
|
107
|
+
const foo = new actions_lib_1.Variable();
|
|
108
|
+
const sample = new Sample().attach(scene_1.Scene.activeScene);
|
|
109
|
+
(0, vitest_1.expect)(foo.listenerCount).toEqual(0);
|
|
110
|
+
foo.subscribe(() => {}).attach(sample);
|
|
111
|
+
(0, vitest_1.expect)(foo.listenerCount).toEqual(1);
|
|
112
|
+
sample.destroy();
|
|
113
|
+
update_loop_1.UpdateCycle.triggerUpdateTick(0); // Update cycle should take place to destroy functions to be called
|
|
114
|
+
(0, vitest_1.expect)(foo.listenerCount).toEqual(0);
|
|
115
|
+
});
|
|
116
|
+
(0, vitest_1.test)('entity attachment in constructor', () => {
|
|
117
|
+
let childDestoyIsCalled = false;
|
|
118
|
+
let Parent = class Parent extends entity_1.Entity {
|
|
119
|
+
constructor() {
|
|
120
|
+
super();
|
|
121
|
+
new Child().attach(this);
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
Parent = __decorate([(0, entity_1.EntityDecorator)(), __metadata('design:paramtypes', [])], Parent);
|
|
125
|
+
let Child = class Child extends entity_1.Entity {
|
|
126
|
+
destroy() {
|
|
127
|
+
childDestoyIsCalled = true;
|
|
128
|
+
}
|
|
129
|
+
};
|
|
130
|
+
Child = __decorate([(0, entity_1.EntityDecorator)()], Child);
|
|
131
|
+
const parent = new Parent().attach(scene_1.Scene.activeScene);
|
|
132
|
+
parent.destroy();
|
|
133
|
+
update_loop_1.UpdateCycle.triggerUpdateTick(0); // Update cycle should take place to destroy functions to be called
|
|
134
|
+
(0, vitest_1.expect)(childDestoyIsCalled).toBeTruthy();
|
|
135
|
+
});
|
|
135
136
|
});
|
|
136
|
-
//# sourceMappingURL=attachable.spec.js.map
|
|
137
|
+
//# sourceMappingURL=attachable.spec.js.map
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { IAttachable } from './interfaces';
|
|
2
2
|
export declare class AttachableStore {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
private static nextAvailableIds;
|
|
4
|
+
private static attachables;
|
|
5
|
+
static findAttachableParent(attachableCandidate: IAttachable | string): IAttachable;
|
|
6
|
+
static registerAttachable(attachable: IAttachable): string;
|
|
7
|
+
static unregisterAttachable(attachable: IAttachable): void;
|
|
8
8
|
}
|
|
@@ -1,39 +1,41 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
3
2
|
exports.AttachableStore = void 0;
|
|
4
|
-
const helpers_lib_1 = require(
|
|
5
|
-
const update_cycle_1 = require(
|
|
3
|
+
const helpers_lib_1 = require('helpers-lib');
|
|
4
|
+
const update_cycle_1 = require('../update-cycle');
|
|
6
5
|
class AttachableStore {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
static registerAttachable(attachable) {
|
|
24
|
-
let numberPartOfTheId = AttachableStore.nextAvailableIds.get(attachable.constructor.name) || 1;
|
|
25
|
-
AttachableStore.nextAvailableIds.set(attachable.constructor.name, numberPartOfTheId + 1);
|
|
26
|
-
let id = `${attachable.constructor.name}:${numberPartOfTheId}`;
|
|
27
|
-
AttachableStore.attachables.set(id, attachable);
|
|
28
|
-
return id;
|
|
29
|
-
}
|
|
30
|
-
static unregisterAttachable(attachable) {
|
|
31
|
-
AttachableStore.attachables.delete(attachable.id);
|
|
6
|
+
static {
|
|
7
|
+
AttachableStore.nextAvailableIds = new Map();
|
|
8
|
+
}
|
|
9
|
+
static {
|
|
10
|
+
AttachableStore.attachables = new Map();
|
|
11
|
+
}
|
|
12
|
+
static findAttachableParent(attachableCandidate) {
|
|
13
|
+
let attachable;
|
|
14
|
+
if (helpers_lib_1.Comparator.isString(attachableCandidate)) {
|
|
15
|
+
const attachableId = attachableCandidate;
|
|
16
|
+
attachable = AttachableStore.attachables.get(attachableId);
|
|
17
|
+
if (!attachable) {
|
|
18
|
+
throw new Error(`Attachable: attachable not found by id! id: ${attachableId}`);
|
|
19
|
+
}
|
|
20
|
+
} else {
|
|
21
|
+
attachable = attachableCandidate;
|
|
32
22
|
}
|
|
23
|
+
return attachable;
|
|
24
|
+
}
|
|
25
|
+
static registerAttachable(attachable) {
|
|
26
|
+
const numberPartOfTheId = AttachableStore.nextAvailableIds.get(attachable.constructor.name) || 1;
|
|
27
|
+
AttachableStore.nextAvailableIds.set(attachable.constructor.name, numberPartOfTheId + 1);
|
|
28
|
+
const id = `${attachable.constructor.name}:${numberPartOfTheId}`;
|
|
29
|
+
AttachableStore.attachables.set(id, attachable);
|
|
30
|
+
return id;
|
|
31
|
+
}
|
|
32
|
+
static unregisterAttachable(attachable) {
|
|
33
|
+
AttachableStore.attachables.delete(attachable.id);
|
|
34
|
+
}
|
|
33
35
|
}
|
|
34
36
|
exports.AttachableStore = AttachableStore;
|
|
35
37
|
update_cycle_1.UpdateCycle.hardResetAction.subscribe(() => {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
+
AttachableStore['nextAvailableIds'].clear();
|
|
39
|
+
AttachableStore['attachables'].clear();
|
|
38
40
|
});
|
|
39
|
-
//# sourceMappingURL=attachable.store.js.map
|
|
41
|
+
//# sourceMappingURL=attachable.store.js.map
|