bard-legends-framework 0.10.8 → 0.11.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.
Files changed (142) hide show
  1. package/dist/game-entities/base/attachable.d.ts +10 -3
  2. package/dist/game-entities/base/attachable.js +50 -18
  3. package/dist/game-entities/base/attachable.test.js +81 -95
  4. package/dist/game-entities/base/helpers/attachable.store.d.ts +2 -8
  5. package/dist/game-entities/base/helpers/attachable.store.js +46 -17
  6. package/dist/game-entities/base/helpers/attachable.store.test.d.ts +1 -0
  7. package/dist/game-entities/base/helpers/attachable.store.test.js +234 -0
  8. package/dist/game-entities/base/helpers/decorate-actions-lib.d.ts +3 -3
  9. package/dist/game-entities/base/helpers/decorate-actions-lib.js +5 -5
  10. package/dist/game-entities/base/helpers/referance-variable.d.ts +2 -2
  11. package/dist/game-entities/base/helpers/referance-variable.js +2 -2
  12. package/dist/game-entities/controller/controller.d.ts +0 -1
  13. package/dist/game-entities/controller/controller.js +1 -0
  14. package/dist/game-entities/controller/controller.test.js +2 -2
  15. package/dist/game-entities/entity/entity.d.ts +10 -9
  16. package/dist/game-entities/entity/entity.js +9 -13
  17. package/dist/game-entities/entity/entity.test.js +47 -139
  18. package/dist/game-entities/entity/helpers/entity-store.helper.d.ts +6 -9
  19. package/dist/game-entities/entity/helpers/entity-store.helper.js +22 -57
  20. package/dist/game-entities/entity/helpers/entity-store.helper.test.d.ts +1 -0
  21. package/dist/game-entities/entity/helpers/entity-store.helper.test.js +136 -0
  22. package/dist/game-entities/entity/helpers/entity-views.helper.d.ts +1 -1
  23. package/dist/game-entities/entity/helpers/entity-views.helper.js +5 -3
  24. package/dist/game-entities/entity/singleton-entity.d.ts +3 -3
  25. package/dist/game-entities/entity/singleton-entity.js +1 -1
  26. package/dist/game-entities/entity/singleton-entity.test.js +2 -29
  27. package/dist/game-entities/index.d.ts +1 -5
  28. package/dist/game-entities/index.js +3 -24
  29. package/dist/game-entities/scene/scene.d.ts +4 -4
  30. package/dist/game-entities/scene/scene.js +31 -25
  31. package/dist/game-entities/scene/scene.test.js +14 -36
  32. package/dist/game-entities/service/service.js +5 -3
  33. package/dist/game-entities/service/service.test.js +2 -28
  34. package/dist/game-entities/unit-test.helper.d.ts +5 -0
  35. package/dist/game-entities/unit-test.helper.js +14 -0
  36. package/dist/game-entities/update-cycle.d.ts +15 -4
  37. package/dist/game-entities/update-cycle.js +14 -9
  38. package/dist/game-entities/view/view.d.ts +7 -8
  39. package/dist/game-entities/view/view.js +12 -21
  40. package/dist/game-entities/view/view.test.js +54 -244
  41. package/dist/physics/entity-types/immovable-physics-entity.d.ts +1 -3
  42. package/dist/physics/entity-types/immovable-physics-entity.js +1 -3
  43. package/dist/physics/entity-types/movable-entity.js +4 -4
  44. package/dist/physics/entity-types/movable-physics-entity.d.ts +2 -3
  45. package/dist/physics/entity-types/movable-physics-entity.js +5 -6
  46. package/dist/physics/entity-types/physics-entity.d.ts +3 -2
  47. package/dist/physics/entity-types/physics-entity.js +10 -7
  48. package/dist/physics/interfaces.d.ts +1 -1
  49. package/dist/physics/module//342/232/234/357/270/217gateways/controllers/physics-internal.controller.d.ts +3 -3
  50. package/dist/physics/module//342/232/234/357/270/217gateways/controllers/physics.controller.d.ts +1 -1
  51. package/dist/physics/module//342/232/234/357/270/217gateways/physics-internal.gateway.d.ts +3 -3
  52. package/dist/physics/module//342/232/234/357/270/217gateways/physics.gateway.d.ts +1 -1
  53. package/dist/physics/module//360/237/223/220services/creation/physics-world.service.js +2 -2
  54. package/dist/physics/module//360/237/223/220services/path-finding/availability-grid.service.js +1 -1
  55. package/dist/physics/module//360/237/223/220services/path-finding/path-finder.service.js +1 -1
  56. package/dist/physics/module//360/237/223/220services/query/physics-query.service.d.ts +3 -3
  57. package/dist/physics/module//360/237/223/220services/test-visuals/test-visuals.service.js +17 -7
  58. package/dist/physics/module//360/237/247/212entities/physics-world.entity.js +2 -2
  59. package/dist/pixi/components/helpers/smooth-scroller.d.ts +1 -2
  60. package/dist/pixi/components/helpers/smooth-scroller.js +1 -3
  61. package/dist/pixi/components/helpers/smooth-scroller.test.js +5 -5
  62. package/dist/pixi/components/mouse-wheel-listener.ui.d.ts +3 -2
  63. package/dist/pixi/components/mouse-wheel-listener.ui.js +10 -7
  64. package/dist/pixi/components/scroll-area.ui.d.ts +0 -1
  65. package/dist/pixi/components/scroll-area.ui.js +1 -4
  66. package/dist/pixi/display-object/container-attributes.d.ts +3 -4
  67. package/dist/pixi/display-object/container-attributes.js +2 -3
  68. package/dist/pixi/display-object/container.d.ts +0 -4
  69. package/dist/pixi/display-object/container.js +5 -17
  70. package/dist/pixi/display-object/objects/graphics/graphics.d.ts +1 -1
  71. package/dist/pixi/display-object/objects/graphics/graphics.js +5 -3
  72. package/dist/pixi/display-object/objects/placeholder.d.ts +1 -1
  73. package/dist/pixi/display-object/objects/placeholder.js +5 -3
  74. package/dist/pixi/display-object/objects/sprite/glow-sprite-generator.js +5 -3
  75. package/dist/pixi/display-object/objects/sprite/sprite.d.ts +1 -1
  76. package/dist/pixi/display-object/objects/sprite/sprite.js +12 -10
  77. package/dist/pixi/display-object/objects/text/text.d.ts +1 -1
  78. package/dist/pixi/display-object/objects/text/text.js +5 -3
  79. package/dist/pixi/game.d.ts +6 -2
  80. package/dist/pixi/game.js +14 -5
  81. package/dist/pixi/modules/CAMERA//360/237/247/212entities/camera.entity.js +4 -4
  82. package/dist/pixi/modules/CAMERA//360/237/247/251views/camera.view.d.ts +1 -1
  83. package/dist/pixi/modules/CAMERA//360/237/247/251views/camera.view.js +6 -4
  84. package/dist/pixi/services/keyboard/keyboard.d.ts +4 -2
  85. package/dist/pixi/services/keyboard/keyboard.js +6 -4
  86. package/dist/pixi/services/mouse/mouse-target-focus.service.d.ts +2 -1
  87. package/dist/pixi/services/mouse/mouse-target-focus.service.js +6 -5
  88. package/dist/pixi/services/mouse/mouse.service.d.ts +15 -5
  89. package/dist/pixi/services/mouse/mouse.service.js +38 -18
  90. package/dist/utilities/animator/animating-content/fade-in-content.d.ts +18 -0
  91. package/dist/utilities/animator/animating-content/fade-in-content.js +37 -0
  92. package/dist/utilities/animator/animating-content/slide-in-content.d.ts +37 -0
  93. package/dist/utilities/animator/animating-content/slide-in-content.js +99 -0
  94. package/dist/utilities/animator/animations.d.ts +37 -0
  95. package/dist/utilities/animator/animations.js +88 -0
  96. package/dist/utilities/animator/animator.d.ts +61 -0
  97. package/dist/utilities/animator/animator.js +315 -0
  98. package/dist/utilities/animator/animator.test.d.ts +1 -0
  99. package/dist/utilities/animator/animator.test.js +867 -0
  100. package/dist/utilities/animator/index.d.ts +7 -0
  101. package/dist/utilities/animator/index.js +24 -0
  102. package/dist/utilities/animator/state-animation/slide-state-animation.d.ts +24 -0
  103. package/dist/utilities/animator/state-animation/slide-state-animation.js +130 -0
  104. package/dist/utilities/animator/state-animation/slide-state-animation.test.d.ts +1 -0
  105. package/dist/utilities/animator/state-animation/slide-state-animation.test.js +301 -0
  106. package/dist/utilities/animator/state-animation/state-animation.d.ts +33 -0
  107. package/dist/utilities/animator/state-animation/state-animation.js +146 -0
  108. package/dist/utilities/animator/state-animation/state-animation.test.d.ts +1 -0
  109. package/dist/utilities/animator/state-animation/state-animation.test.js +335 -0
  110. package/dist/utilities/animator/state-animation/visit-disappear-state-animation.d.ts +32 -0
  111. package/dist/utilities/animator/state-animation/visit-disappear-state-animation.js +168 -0
  112. package/dist/utilities/animator/state-animation/visit-disappear-state-animation.test.d.ts +1 -0
  113. package/dist/utilities/animator/state-animation/visit-disappear-state-animation.test.js +431 -0
  114. package/dist/utilities/data-structures/vector-set/vector-set.d.ts +7 -0
  115. package/dist/utilities/data-structures/vector-set/vector-set.js +26 -0
  116. package/dist/utilities/delta-time/delta-time.d.ts +3 -0
  117. package/dist/utilities/delta-time/delta-time.js +10 -0
  118. package/dist/utilities/grid-algorithms/closest-available-space/closest-available-space.helper.d.ts +6 -0
  119. package/dist/utilities/grid-algorithms/closest-available-space/closest-available-space.helper.js +55 -0
  120. package/dist/utilities/grid-algorithms/closest-available-space/closest-available-space.helper.test.d.ts +1 -0
  121. package/dist/utilities/grid-algorithms/closest-available-space/closest-available-space.helper.test.js +100 -0
  122. package/dist/utilities/grid-algorithms/path-finder/path-finder.d.ts +8 -0
  123. package/dist/utilities/grid-algorithms/path-finder/path-finder.js +98 -0
  124. package/dist/utilities/grid-algorithms/path-finder/path-finder.test.d.ts +1 -0
  125. package/dist/utilities/grid-algorithms/path-finder/path-finder.test.js +155 -0
  126. package/dist/utilities/grid-algorithms/position-to-grid-position-converter.d.ts +6 -0
  127. package/dist/utilities/grid-algorithms/position-to-grid-position-converter.js +17 -0
  128. package/dist/utilities/grid-algorithms/vector-field-path-finder/vector-field-path-finder.d.ts +18 -0
  129. package/dist/utilities/grid-algorithms/vector-field-path-finder/vector-field-path-finder.js +129 -0
  130. package/dist/utilities/grid-algorithms/vector-field-path-finder/vector-field-path-finder.test.d.ts +1 -0
  131. package/dist/utilities/grid-algorithms/vector-field-path-finder/vector-field-path-finder.test.js +254 -0
  132. package/dist/utilities/index.d.ts +6 -6
  133. package/dist/utilities/index.js +6 -6
  134. package/dist/utilities/libraries/animator/animator.d.ts +3 -5
  135. package/dist/utilities/libraries/animator/animator.js +17 -19
  136. package/dist/utilities/libraries/animator/state-animation/slide-state-animation.d.ts +2 -2
  137. package/dist/utilities/libraries/animator/state-animation/slide-state-animation.js +1 -1
  138. package/dist/utilities/libraries/animator/state-animation/state-animation.d.ts +2 -2
  139. package/dist/utilities/libraries/animator/state-animation/state-animation.js +1 -1
  140. package/dist/utilities/libraries/animator/state-animation/visit-disappear-state-animation.d.ts +2 -2
  141. package/dist/utilities/libraries/animator/state-animation/visit-disappear-state-animation.js +1 -1
  142. package/package.json +6 -6
@@ -1,5 +1,5 @@
1
1
  /// <reference types="p2" />
2
- import { ActionListenerCallbackFunction, ActionSubscription } from 'actions-lib';
2
+ import { IAttachable, NotifierCallbackFunction } from 'actions-lib';
3
3
  import { PhysicsEntityDefinition } from '../../../interfaces';
4
4
  import { PhysicsBodyGroup } from '../../../libs/physics-body-groups';
5
5
  import { PhysicsBodyGroupService } from '../../📐services/collision/physics-body-group.service';
@@ -22,8 +22,8 @@ export declare class PhysicsInternalController {
22
22
  getMaskConstant(physicsWorldId: string, group: PhysicsBodyGroup): number;
23
23
  addBody(physicsWorldId: string, body: p2.Body, addInEmptySpace: boolean, physicsBodyGroup: PhysicsBodyGroup, includeOnPathfinding: boolean): boolean;
24
24
  removeBody(physicsWorldId: string, p2Body: p2.Body): void;
25
- subscribeToPhysicsStep(physicsWorldId: string, callback: ActionListenerCallbackFunction<{
25
+ subscribeToPhysicsStep(physicsWorldId: string, callback: NotifierCallbackFunction<{
26
26
  time: number;
27
27
  delta: number;
28
- }>): ActionSubscription;
28
+ }>): IAttachable;
29
29
  }
@@ -1,5 +1,5 @@
1
1
  import { GridNeighborType, Radian, Rectangle, Vector } from 'helpers-lib';
2
- import { PathFinderResult } from '../../../../utilities/libraries/grid-algorithms/path-finder/path-finder';
2
+ import { PathFinderResult } from '../../../../utilities/grid-algorithms/path-finder/path-finder';
3
3
  import { PhysicsBodyGroup } from '../../../libs/physics-body-groups';
4
4
  import { HitTestService } from '../../📐services/collision/hit-test.service';
5
5
  import { PhysicsWorldService } from '../../📐services/creation/physics-world.service';
@@ -1,5 +1,5 @@
1
1
  /// <reference types="p2" />
2
- import { ActionListenerCallbackFunction, ActionSubscription } from 'actions-lib';
2
+ import { IAttachable, NotifierCallbackFunction } from 'actions-lib';
3
3
  import { ControllerLink } from '../../../game-entities';
4
4
  import { PhysicsEntityDefinition } from '../../interfaces';
5
5
  import { PhysicsBodyGroup } from '../../libs/physics-body-groups';
@@ -13,8 +13,8 @@ export declare class PhysicsInternalGateway {
13
13
  getMaskConstant(physicsWorldId: string, group: PhysicsBodyGroup): number;
14
14
  addBody(physicsWorldId: string, body: p2.Body, addInEmptySpace: boolean, physicsBodyGroup: PhysicsBodyGroup, includeOnPathfinding: boolean): boolean;
15
15
  removeBody(physicsWorldId: string, p2Body: p2.Body): void;
16
- subscribeToPhysicsStep(physicsWorldId: string, callback: ActionListenerCallbackFunction<{
16
+ subscribeToPhysicsStep(physicsWorldId: string, callback: NotifierCallbackFunction<{
17
17
  time: number;
18
18
  delta: number;
19
- }>): ActionSubscription;
19
+ }>): IAttachable;
20
20
  }
@@ -1,6 +1,6 @@
1
1
  import { GridNeighborType, Radian, Rectangle, Vector } from 'helpers-lib';
2
2
  import { ControllerLink } from '../../../game-entities';
3
- import { PathFinderResult } from '../../../utilities/libraries/grid-algorithms/path-finder/path-finder';
3
+ import { PathFinderResult } from '../../../utilities/grid-algorithms/path-finder/path-finder';
4
4
  import { PhysicsBodyGroup } from '../../libs/physics-body-groups';
5
5
  import { CreatePhysicsWorldRequestDTO, HitTestOptions, PhysicsExplosionOptions } from './dtos/requests.dto';
6
6
  import { ExplosionHit, MapSizeDTO } from './dtos/responses.dto';
@@ -34,8 +34,8 @@ let PhysicsWorldService = class PhysicsWorldService {
34
34
  let { materials, materialDefinitions } = this.materialsService.createMaterials(p2World, request.borderProperties, request.materialDefinitions, request.materialContactDefinitions);
35
35
  let { physicsBodyGroupToP2Group, physicsBodyGroupToP2Mask } = this.physicsBodyGroupService.createBodyGroupsAndMasks(request.physicsBodyGroups, request.interactingBodyGroups);
36
36
  let physicsWorld = new physics_world_entity_1.PhysicsWorldEntity(request.mapSize, request.modifyUpdateCycle, p2World, materials, materialDefinitions, physicsBodyGroupToP2Group, physicsBodyGroupToP2Mask).attach(request.attachTo);
37
- physicsWorld.onDestroy
38
- .subscribe(() => {
37
+ physicsWorld
38
+ .onDestroy(() => {
39
39
  p2World.clear();
40
40
  if (request.modifyUpdateCycle) {
41
41
  game_entities_1.UpdateCycle.cleanUpdateModifier();
@@ -13,7 +13,7 @@ exports.AvailabilityGridService = void 0;
13
13
  const helpers_lib_1 = require("helpers-lib");
14
14
  const game_entities_1 = require("../../../../game-entities");
15
15
  const utilities_1 = require("../../../../utilities");
16
- const position_to_grid_position_converter_1 = require("../../../../utilities/libraries/grid-algorithms/position-to-grid-position-converter");
16
+ const position_to_grid_position_converter_1 = require("../../../../utilities/grid-algorithms/position-to-grid-position-converter");
17
17
  const physics_entity_1 = require("../../../entity-types/physics-entity");
18
18
  const p2js_helper_1 = require("../../../libs/p2js.helper");
19
19
  const physics_body_group_service_1 = require("../collision/physics-body-group.service");
@@ -13,7 +13,7 @@ exports.PathFinderService = exports.DEFAULT_GRID_CELL_SIZE = void 0;
13
13
  const helpers_lib_1 = require("helpers-lib");
14
14
  const game_entities_1 = require("../../../../game-entities");
15
15
  const utilities_1 = require("../../../../utilities");
16
- const position_to_grid_position_converter_1 = require("../../../../utilities/libraries/grid-algorithms/position-to-grid-position-converter");
16
+ const position_to_grid_position_converter_1 = require("../../../../utilities/grid-algorithms/position-to-grid-position-converter");
17
17
  const physics_entity_1 = require("../../../entity-types/physics-entity");
18
18
  const p2js_helper_1 = require("../../../libs/p2js.helper");
19
19
  const physics_world_entity_1 = require("../../\uD83E\uDDCAentities/physics-world.entity");
@@ -1,9 +1,9 @@
1
- import { ActionListenerCallbackFunction, ActionSubscription } from 'actions-lib';
1
+ import { IAttachable, NotifierCallbackFunction } from 'actions-lib';
2
2
  import { MapSizeDTO } from '../../⚜️gateways';
3
3
  export declare class PhysicsQueryService {
4
4
  getMapSize(physicsWorldId: string): MapSizeDTO;
5
- subscribeToPhysicsStep(physicsWorldId: string, callback: ActionListenerCallbackFunction<{
5
+ subscribeToPhysicsStep(physicsWorldId: string, callback: NotifierCallbackFunction<{
6
6
  time: number;
7
7
  delta: number;
8
- }>): ActionSubscription;
8
+ }>): IAttachable;
9
9
  }
@@ -8,13 +8,17 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
8
8
  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
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
11
14
  Object.defineProperty(exports, "__esModule", { value: true });
12
15
  exports.TestVisualsService = void 0;
13
16
  const helpers_lib_1 = require("helpers-lib");
17
+ const p2_1 = __importDefault(require("p2"));
14
18
  const game_entities_1 = require("../../../../game-entities");
15
19
  const pixi_1 = require("../../../../pixi");
16
20
  const utilities_1 = require("../../../../utilities");
17
- const position_to_grid_position_converter_1 = require("../../../../utilities/libraries/grid-algorithms/position-to-grid-position-converter");
21
+ const position_to_grid_position_converter_1 = require("../../../../utilities/grid-algorithms/position-to-grid-position-converter");
18
22
  const p2js_helper_1 = require("../../../libs/p2js.helper");
19
23
  const physics_world_entity_1 = require("../../\uD83E\uDDCAentities/physics-world.entity");
20
24
  const availability_grid_service_1 = require("../path-finding/availability-grid.service");
@@ -117,16 +121,22 @@ let TestVisualsService = class TestVisualsService {
117
121
  });
118
122
  }
119
123
  drawShape(shape, color) {
120
- switch (shape.constructor.name) {
121
- case 'Circle':
124
+ switch (shape.type) {
125
+ case p2_1.default.Shape.PARTICLE:
126
+ throw new Error('Not implemented');
127
+ case p2_1.default.Shape.LINE:
128
+ throw new Error('Not implemented');
129
+ case p2_1.default.Shape.PLANE:
130
+ throw new Error('Not implemented');
131
+ case p2_1.default.Shape.CIRCLE:
122
132
  throw new Error('Not implemented');
123
- case 'Plane':
133
+ case p2_1.default.Shape.CAPSULE:
124
134
  throw new Error('Not implemented');
125
- case 'Capsule':
135
+ case p2_1.default.Shape.BOX:
126
136
  throw new Error('Not implemented');
127
- case 'Rectangle':
137
+ case p2_1.default.Shape.HEIGHTFIELD:
128
138
  throw new Error('Not implemented');
129
- case 'Convex':
139
+ case p2_1.default.Shape.CONVEX:
130
140
  return this.drawConvexShape(shape, color);
131
141
  default:
132
142
  throw new Error('Not implemented');
@@ -27,8 +27,8 @@ let PhysicsWorldEntity = class PhysicsWorldEntity extends game_entities_1.Entity
27
27
  this.vectorFieldCache = new Map();
28
28
  this.bodiesInContactWith = new Map();
29
29
  this.collisionReports = new Map();
30
- this.paused = new actions_lib_1.Variable().set(false);
31
- this.lastP2Time = new actions_lib_1.Variable().set(0);
30
+ this.paused = new actions_lib_1.Variable(false);
31
+ this.lastP2Time = new actions_lib_1.Variable(0);
32
32
  this.onPhysicsStep = new actions_lib_1.Action();
33
33
  this.mapSize = mapSize;
34
34
  this.mapSizeCenter = this.mapSize.multiplyNumber(0.5);
@@ -1,11 +1,10 @@
1
1
  import { Vector } from 'helpers-lib';
2
- import { Attachable } from '../../../game-entities';
3
2
  interface ContainerFrame {
4
3
  x: number;
5
4
  y: number;
6
5
  size: Vector;
7
6
  }
8
- export declare class SmoothScroller extends Attachable {
7
+ export declare class SmoothScroller {
9
8
  private content;
10
9
  private areaHeight;
11
10
  private padding;
@@ -2,10 +2,9 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SmoothScroller = void 0;
4
4
  const helpers_lib_1 = require("helpers-lib");
5
- const game_entities_1 = require("../../../game-entities");
6
5
  const SCROLL_SPEED = 0.65;
7
6
  const SCROLL_SPEED_DECAY_RATE = 0.01;
8
- class SmoothScroller extends game_entities_1.Attachable {
7
+ class SmoothScroller {
9
8
  get scrollHeight() {
10
9
  return this._scrollHeight;
11
10
  }
@@ -13,7 +12,6 @@ class SmoothScroller extends game_entities_1.Attachable {
13
12
  return this.content.size.ceil();
14
13
  }
15
14
  constructor(content, areaHeight, padding, smallContentAlign) {
16
- super();
17
15
  this.content = content;
18
16
  this.areaHeight = areaHeight;
19
17
  this.padding = padding;
@@ -21,7 +21,7 @@ class Container {
21
21
  let bottom = areaHeight - padding - container.size.y;
22
22
  (0, vitest_1.beforeEach)(() => {
23
23
  container = new Container();
24
- scroller = new smooth_scroller_1.SmoothScroller(container, areaHeight, padding, 'start').attachToRoot();
24
+ scroller = new smooth_scroller_1.SmoothScroller(container, areaHeight, padding, 'start');
25
25
  });
26
26
  (0, vitest_1.describe)('Big Content', () => {
27
27
  (0, vitest_1.describe)('Starting Top', () => {
@@ -108,22 +108,22 @@ class Container {
108
108
  container.size = new helpers_lib_1.Vector(0, 100);
109
109
  });
110
110
  (0, vitest_1.test)('sample 1 - start', () => {
111
- scroller = new smooth_scroller_1.SmoothScroller(container, areaHeight, padding, 'start').attachToRoot();
111
+ scroller = new smooth_scroller_1.SmoothScroller(container, areaHeight, padding, 'start');
112
112
  scroller.update(10);
113
113
  (0, vitest_1.expect)(container.y).toEqual(padding);
114
114
  });
115
115
  (0, vitest_1.test)('sample 2 - center', () => {
116
- scroller = new smooth_scroller_1.SmoothScroller(container, areaHeight, padding, 'center').attachToRoot();
116
+ scroller = new smooth_scroller_1.SmoothScroller(container, areaHeight, padding, 'center');
117
117
  scroller.update(10);
118
118
  (0, vitest_1.expect)(container.y).toEqual((areaHeight - 100) * 0.5);
119
119
  });
120
120
  (0, vitest_1.test)('sample 3 - bottom', () => {
121
- scroller = new smooth_scroller_1.SmoothScroller(container, areaHeight, padding, 'end').attachToRoot();
121
+ scroller = new smooth_scroller_1.SmoothScroller(container, areaHeight, padding, 'end');
122
122
  scroller.update(10);
123
123
  (0, vitest_1.expect)(container.y).toEqual(areaHeight - 100 - padding);
124
124
  });
125
125
  (0, vitest_1.test)('sample 4 - size change smooth scrolling', () => {
126
- scroller = new smooth_scroller_1.SmoothScroller(container, areaHeight, padding, 'end').attachToRoot();
126
+ scroller = new smooth_scroller_1.SmoothScroller(container, areaHeight, padding, 'end');
127
127
  scroller.update(10);
128
128
  (0, vitest_1.expect)(container.y).toEqual(areaHeight - 100 - padding);
129
129
  container.size = new helpers_lib_1.Vector(0, 200);
@@ -2,9 +2,10 @@ import { Action } from 'actions-lib';
2
2
  import { Vector } from 'helpers-lib';
3
3
  import { Container } from '../display-object/container';
4
4
  export declare class MouseWheelListenerUI extends Container {
5
- readonly onWheel: Action<number>;
5
+ readonly _onWheel: Action<number>;
6
+ readonly onWheel: import("actions-lib").Notifier<number>;
6
7
  private wheelListener;
7
8
  private handler;
8
9
  constructor(size: Vector);
9
- protected destroySelf(): void;
10
+ destroy(): void;
10
11
  }
@@ -32,15 +32,16 @@ const mouse_service_1 = require("../services/mouse/mouse.service");
32
32
  class MouseWheelListenerUI extends container_1.Container {
33
33
  constructor(size) {
34
34
  super();
35
- this.onWheel = new actions_lib_1.Action();
35
+ this._onWheel = new actions_lib_1.Action();
36
+ this.onWheel = this._onWheel.notifier;
36
37
  this.handler = ((event) => {
37
- let mouseScreenPosition = game_entities_1.Service.get(mouse_service_1.MouseService).screenPosition.value;
38
+ let mouseScreenPosition = game_entities_1.Service.get(mouse_service_1.MouseService).getScreenPosition();
38
39
  let bounds = this.wheelListener.getBounds();
39
40
  if (mouseScreenPosition.x >= bounds.x &&
40
41
  mouseScreenPosition.x <= bounds.x + bounds.width &&
41
42
  mouseScreenPosition.y >= bounds.y &&
42
43
  mouseScreenPosition.y <= bounds.y + bounds.height) {
43
- this.onWheel.trigger(event.deltaY);
44
+ this._onWheel.trigger(event.deltaY);
44
45
  }
45
46
  }).bind(this);
46
47
  this.wheelListener = new PIXI.Graphics();
@@ -50,10 +51,12 @@ class MouseWheelListenerUI extends container_1.Container {
50
51
  this.pixiContainer.addChild(this.wheelListener);
51
52
  window.addEventListener('wheel', this.handler);
52
53
  }
53
- destroySelf() {
54
- super.destroySelf();
55
- this.wheelListener.destroy();
56
- window.removeEventListener('wheel', this.handler);
54
+ destroy() {
55
+ if (!this.destroyed) {
56
+ this.wheelListener.destroy();
57
+ window.removeEventListener('wheel', this.handler);
58
+ super.destroy();
59
+ }
57
60
  }
58
61
  }
59
62
  exports.MouseWheelListenerUI = MouseWheelListenerUI;
@@ -15,5 +15,4 @@ export declare class ScrollAreaUI extends Container {
15
15
  constructor(scrollAreaSize: Vector, partialOptions?: Partial<ScrollAreaUIOptions>);
16
16
  scrollToTop(options?: ScrollingOptions): void;
17
17
  scrollToBottom(options?: ScrollingOptions): void;
18
- protected destroySelf(): void;
19
18
  }
@@ -32,7 +32,7 @@ class ScrollAreaUI extends container_1.Container {
32
32
  let wrapper = new container_1.Container().displayParent(this).attach(this);
33
33
  new scroll_mask_ui_1.ScrollMaskUI(wrapper, scrollAreaSize, options.padding).attach(this);
34
34
  let content = new container_1.Container().displayParent(wrapper).attach(this);
35
- this.scroller = new smooth_scroller_1.SmoothScroller(content, scrollAreaSize.y, options.padding, options.smallContentAlign).attach(this);
35
+ this.scroller = new smooth_scroller_1.SmoothScroller(content, scrollAreaSize.y, options.padding, options.smallContentAlign);
36
36
  this._contentAreaSize = new helpers_lib_1.Vector(scrollAreaSize.x, this.scroller.scrollHeight);
37
37
  let scrollArea = new mouse_wheel_listener_ui_1.MouseWheelListenerUI(scrollAreaSize).displayParent(wrapper).attach(this);
38
38
  scrollArea.onWheel.subscribe(scrollDelta => this.scroller.onWheel(scrollDelta)).attach(this);
@@ -51,9 +51,6 @@ class ScrollAreaUI extends container_1.Container {
51
51
  this.scroller.jumpToTarget();
52
52
  }
53
53
  }
54
- destroySelf() {
55
- super.destroySelf();
56
- }
57
54
  }
58
55
  exports.ScrollAreaUI = ScrollAreaUI;
59
56
  //# sourceMappingURL=scroll-area.ui.js.map
@@ -1,7 +1,6 @@
1
- import { ActionSubscription } from 'actions-lib';
1
+ import { Attachable, IAttachable } from 'actions-lib';
2
2
  import { Radian, Vector } from 'helpers-lib';
3
3
  import * as PIXI from 'pixi.js';
4
- import { AttachmentTarget } from '../../game-entities';
5
4
  export declare enum ContainerEventType {
6
5
  click = "click",
7
6
  mouseover = "mouseover",
@@ -24,7 +23,7 @@ export declare enum Cursor {
24
23
  default = "default",
25
24
  pointer = "pointer"
26
25
  }
27
- export declare abstract class ContainerAttributes extends AttachmentTarget {
26
+ export declare abstract class ContainerAttributes extends Attachable {
28
27
  protected pixiContainer: PIXI.Container;
29
28
  protected constructor();
30
29
  get size(): Vector;
@@ -47,7 +46,7 @@ export declare abstract class ContainerAttributes extends AttachmentTarget {
47
46
  set x(value: number);
48
47
  get y(): number;
49
48
  set y(value: number);
50
- on(eventType: ContainerEventType, callback: () => void): ActionSubscription;
49
+ on(eventType: ContainerEventType, callback: () => void): IAttachable;
51
50
  setRotation(value: Radian): this;
52
51
  get rotation(): Radian;
53
52
  set rotation(value: Radian);
@@ -27,7 +27,6 @@ exports.ContainerAttributes = exports.Cursor = exports.ContainerEventType = void
27
27
  const actions_lib_1 = require("actions-lib");
28
28
  const helpers_lib_1 = require("helpers-lib");
29
29
  const PIXI = __importStar(require("pixi.js"));
30
- const game_entities_1 = require("../../game-entities");
31
30
  var ContainerEventType;
32
31
  (function (ContainerEventType) {
33
32
  ContainerEventType["click"] = "click";
@@ -52,7 +51,7 @@ var Cursor;
52
51
  Cursor["default"] = "default";
53
52
  Cursor["pointer"] = "pointer";
54
53
  })(Cursor || (exports.Cursor = Cursor = {}));
55
- class ContainerAttributes extends game_entities_1.AttachmentTarget {
54
+ class ContainerAttributes extends actions_lib_1.Attachable {
56
55
  constructor() {
57
56
  super();
58
57
  // --------------------- Scale ---------------------
@@ -121,7 +120,7 @@ class ContainerAttributes extends game_entities_1.AttachmentTarget {
121
120
  this.pixiContainer.on(eventType, handle);
122
121
  return new actions_lib_1.ActionSubscription(() => {
123
122
  this.pixiContainer.off(eventType, handle);
124
- }).decorateActionSubscription();
123
+ });
125
124
  }
126
125
  setRotation(value) {
127
126
  this.rotation = value;
@@ -1,5 +1,4 @@
1
1
  import { Rectangle } from 'helpers-lib';
2
- import { AttachmentTarget } from '../../game-entities';
3
2
  import { ContainerAttributes } from './container-attributes';
4
3
  import { Filters } from './filters';
5
4
  import { Sprite } from './objects/sprite/sprite';
@@ -17,9 +16,6 @@ export declare class Container extends ContainerAttributes {
17
16
  };
18
17
  constructor();
19
18
  destroy(): void;
20
- attach(parent: AttachmentTarget | string): this;
21
- attachToRoot(): this;
22
- protected destroySelf(): void;
23
19
  getBoundingMask(): Sprite;
24
20
  displayParent(parent: Container | string, partialOptions?: Partial<SetParentOptions>): this;
25
21
  get boundingBox(): Rectangle;
@@ -16,24 +16,12 @@ class Container extends container_attributes_1.ContainerAttributes {
16
16
  Container.allContainers.set(this.id, this);
17
17
  this.filters = new filters_1.Filters(this.pixiContainer);
18
18
  }
19
- // make the destroy function non-internal
20
19
  destroy() {
21
- super.destroy();
22
- }
23
- // make the attach function non-internal
24
- attach(parent) {
25
- super.attach(parent);
26
- return this;
27
- }
28
- // make the attachToRoot function non-internal
29
- attachToRoot() {
30
- super.attachToRoot();
31
- return this;
32
- }
33
- destroySelf() {
34
- super.destroySelf();
35
- Container.allContainers.delete(this.id);
36
- !this.pixiContainer.destroyed && this.pixiContainer.destroy();
20
+ if (!this.destroyed) {
21
+ Container.allContainers.delete(this.id);
22
+ !this.pixiContainer.destroyed && this.pixiContainer.destroy();
23
+ super.destroy();
24
+ }
37
25
  }
38
26
  getBoundingMask() {
39
27
  if (this.addChildTo !== this) {
@@ -27,7 +27,7 @@ export declare class Graphics extends Container {
27
27
  readonly pixiGraphics: PIXI.Graphics;
28
28
  private cacheName;
29
29
  protected constructor(pixiGraphics: PIXI.Graphics, cacheName: string);
30
- protected destroySelf(): void;
30
+ destroy(): void;
31
31
  toSprite(partialOptions?: Partial<ToSpriteOptions>): Sprite;
32
32
  private getTexture;
33
33
  private createTextureFromGraphics;
@@ -150,9 +150,11 @@ class Graphics extends container_1.Container {
150
150
  this.pixiGraphics = pixiGraphics;
151
151
  this.cacheName = cacheName;
152
152
  }
153
- destroySelf() {
154
- super.destroySelf();
155
- !this.pixiGraphics.destroyed && this.pixiGraphics.destroy();
153
+ destroy() {
154
+ if (!this.destroyed) {
155
+ !this.pixiGraphics.destroyed && this.pixiGraphics.destroy();
156
+ super.destroy();
157
+ }
156
158
  }
157
159
  toSprite(partialOptions) {
158
160
  let options = {
@@ -3,5 +3,5 @@ import { Container } from '../container';
3
3
  export declare class Placeholder extends Container {
4
4
  private pixiGraphics;
5
5
  constructor(size: Vector);
6
- protected destroySelf(): void;
6
+ destroy(): void;
7
7
  }
@@ -35,9 +35,11 @@ class Placeholder extends container_1.Container {
35
35
  this.pixiGraphics.endFill();
36
36
  this.pixiContainer.addChild(this.pixiGraphics);
37
37
  }
38
- destroySelf() {
39
- super.destroySelf();
40
- this.pixiContainer.destroy();
38
+ destroy() {
39
+ if (!this.destroyed) {
40
+ this.pixiGraphics.destroy();
41
+ super.destroy();
42
+ }
41
43
  }
42
44
  }
43
45
  exports.Placeholder = Placeholder;
@@ -26,7 +26,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
26
26
  exports.GlowSpriteGenerator = void 0;
27
27
  const helpers_lib_1 = require("helpers-lib");
28
28
  const PIXI = __importStar(require("pixi.js"));
29
- const update_cycle_1 = require("../../../../game-entities/update-cycle");
29
+ const unit_test_helper_1 = require("../../../../game-entities/unit-test.helper");
30
30
  const __1 = require("../../..");
31
31
  const game_assets_1 = require("../../../helpers/game-assets");
32
32
  const glow_filter_1 = require("../../filters/composite-filters/glow-filter");
@@ -104,7 +104,9 @@ class GlowSpriteGenerator {
104
104
  }
105
105
  }
106
106
  exports.GlowSpriteGenerator = GlowSpriteGenerator;
107
- update_cycle_1.UpdateCycle.hardResetAction.subscribe(() => {
107
+ unit_test_helper_1.UnitTestHelper.onHardReset
108
+ .subscribe(() => {
108
109
  GlowSpriteGenerator['glowTextureCache'].clear();
109
- });
110
+ })
111
+ .attachToRoot();
110
112
  //# sourceMappingURL=glow-sprite-generator.js.map
@@ -15,7 +15,7 @@ export declare class Sprite extends Container {
15
15
  private boundingShape;
16
16
  private pixiGlowSprite;
17
17
  constructor(spriteDefinition: SpriteDefinition, options?: SpriteOptions);
18
- protected destroySelf(): void;
18
+ destroy(): void;
19
19
  private _textureScale;
20
20
  setTextureScale(value: number): this;
21
21
  get textureScale(): number;
@@ -81,16 +81,18 @@ class Sprite extends container_1.Container {
81
81
  this.pixiSprite.anchor.set(spriteDefinition.anchor.x, spriteDefinition.anchor.y);
82
82
  }
83
83
  }
84
- destroySelf() {
85
- super.destroySelf();
86
- !this.pixiGlowSprite?.destroyed && this.pixiGlowSprite?.destroy();
87
- this.pixiGlowSprite = undefined;
88
- this.mask?.destroy();
89
- this.mask = undefined;
90
- this.boundingShape?.destroy();
91
- this.boundingShape = undefined;
92
- if (this.spriteDefinition.destroyAssetOnDestroy) {
93
- game_assets_1.GameAssets.destroyAsset(this.spriteDefinition.id);
84
+ destroy() {
85
+ if (!this.destroyed) {
86
+ !this.pixiGlowSprite?.destroyed && this.pixiGlowSprite?.destroy();
87
+ this.pixiGlowSprite = undefined;
88
+ this.mask?.destroy();
89
+ this.mask = undefined;
90
+ this.boundingShape?.destroy();
91
+ this.boundingShape = undefined;
92
+ if (this.spriteDefinition.destroyAssetOnDestroy) {
93
+ game_assets_1.GameAssets.destroyAsset(this.spriteDefinition.id);
94
+ }
95
+ super.destroy();
94
96
  }
95
97
  }
96
98
  setTextureScale(value) {
@@ -11,7 +11,7 @@ export declare class Text extends Container {
11
11
  private get textMetrics();
12
12
  get ascent(): number;
13
13
  constructor(text: string, partialOptions?: PartialTextOptions | undefined);
14
- protected destroySelf(): void;
14
+ destroy(): void;
15
15
  setAnchor(value: Vector): this;
16
16
  get anchor(): Vector;
17
17
  set anchor(value: Vector);
@@ -47,9 +47,11 @@ class Text extends container_1.Container {
47
47
  this.pixiTextStyle = pixi_text_style_converter_1.TextStyleConverter.getPixiTextStyle(partialOptions);
48
48
  this.setText(text);
49
49
  }
50
- destroySelf() {
51
- super.destroySelf();
52
- !this.pixiText.destroyed && this.pixiText.destroy();
50
+ destroy() {
51
+ if (!this.destroyed) {
52
+ !this.pixiText.destroyed && this.pixiText.destroy();
53
+ super.destroy();
54
+ }
53
55
  }
54
56
  setAnchor(value) {
55
57
  this.anchor = value;
@@ -21,8 +21,12 @@ export declare class Game {
21
21
  static get time(): number;
22
22
  readonly stage: Container;
23
23
  readonly renderer: PIXI.Renderer;
24
- readonly screenSize: Variable<Vector>;
25
- readonly screenSizeCenter: Variable<Vector>;
24
+ readonly _screenSize: Variable<Vector>;
25
+ readonly screenSize: import("actions-lib").Notifier<Vector>;
26
+ getScreenSize(): Vector;
27
+ readonly _screenSizeCenter: Variable<Vector>;
28
+ readonly screenSizeCenter: import("actions-lib").Notifier<Vector>;
29
+ getScreenSizeCenter(): Vector;
26
30
  readonly devMode: boolean;
27
31
  private readonly pixiApp;
28
32
  private readonly configuration;
package/dist/pixi/game.js CHANGED
@@ -44,9 +44,17 @@ class Game {
44
44
  static get time() {
45
45
  return update_cycle_1.UpdateCycle['time'];
46
46
  }
47
+ getScreenSize() {
48
+ return this._screenSize.value;
49
+ }
50
+ getScreenSizeCenter() {
51
+ return this._screenSizeCenter.value;
52
+ }
47
53
  constructor(partialConfiguration) {
48
- this.screenSize = new actions_lib_1.Variable();
49
- this.screenSizeCenter = new actions_lib_1.Variable();
54
+ this._screenSize = new actions_lib_1.Variable(helpers_lib_1.Vector.zero);
55
+ this.screenSize = this._screenSize.notifier;
56
+ this._screenSizeCenter = new actions_lib_1.Variable(helpers_lib_1.Vector.zero);
57
+ this.screenSizeCenter = this._screenSizeCenter.notifier;
50
58
  this.devMode = false;
51
59
  this.resetScreenPositionToStagePositionFunction();
52
60
  if (Game._instance) {
@@ -102,7 +110,7 @@ class Game {
102
110
  this.pixiApp.renderer.resize(this.pixiApp.screen.width, this.pixiApp.screen.height);
103
111
  }
104
112
  screenPositonToStagePosition(screenPosition) {
105
- let adjustedScreenPositionWithScale = position_conversion_helper_1.PositionConversionHelper.includeScaleInScreenPosition(screenPosition, Game.instance.stage.scale, Game.instance.screenSizeCenter.value);
113
+ let adjustedScreenPositionWithScale = position_conversion_helper_1.PositionConversionHelper.includeScaleInScreenPosition(screenPosition, Game.instance.stage.scale, Game.instance.getScreenSizeCenter());
106
114
  return this.screenPositionToStagePositionConverter(adjustedScreenPositionWithScale);
107
115
  }
108
116
  setScreenPositionToStagePositionFunction(converterFunction) {
@@ -115,8 +123,9 @@ class Game {
115
123
  game_assets_1.GameAssets.destroyAsset(assetId);
116
124
  }
117
125
  setScreenSize() {
118
- this.screenSize.value = new helpers_lib_1.Vector(this.pixiApp.screen.width, this.pixiApp.screen.height);
119
- this.screenSizeCenter.value = this.screenSize.value.multiplyNumber(0.5).round();
126
+ let screenSize = new helpers_lib_1.Vector(this.pixiApp.screen.width, this.pixiApp.screen.height);
127
+ this._screenSize.value = screenSize;
128
+ this._screenSizeCenter.value = screenSize.multiplyNumber(0.5).round();
120
129
  }
121
130
  }
122
131
  exports.Game = Game;
@@ -13,10 +13,10 @@ const game_entities_1 = require("../../../../game-entities");
13
13
  let CameraEntity = class CameraEntity extends game_entities_1.SingletonEntity {
14
14
  constructor() {
15
15
  super(...arguments);
16
- this.position = new actions_lib_1.Variable().set(helpers_lib_1.Vector.zero);
17
- this.offset = new actions_lib_1.Variable().set(helpers_lib_1.Vector.zero);
18
- this.targetPosition = new actions_lib_1.Variable();
19
- this.focusingNewTargetInfo = new actions_lib_1.Variable().set(undefined);
16
+ this.position = new actions_lib_1.Variable(helpers_lib_1.Vector.zero);
17
+ this.offset = new actions_lib_1.Variable(helpers_lib_1.Vector.zero);
18
+ this.targetPosition = new actions_lib_1.Variable(undefined);
19
+ this.focusingNewTargetInfo = new actions_lib_1.Variable(undefined);
20
20
  }
21
21
  };
22
22
  exports.CameraEntity = CameraEntity;