bard-legends-framework 0.10.9 → 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.
- package/dist/game-entities/controller/controller.d.ts +0 -1
- package/dist/game-entities/controller/controller.js +1 -0
- package/dist/game-entities/controller/controller.test.js +2 -2
- package/dist/game-entities/entity/entity.d.ts +8 -6
- package/dist/game-entities/entity/entity.js +5 -7
- package/dist/game-entities/entity/entity.test.js +40 -134
- package/dist/game-entities/entity/helpers/entity-store.helper.d.ts +6 -9
- package/dist/game-entities/entity/helpers/entity-store.helper.js +22 -57
- package/dist/game-entities/entity/helpers/entity-store.helper.test.d.ts +1 -0
- package/dist/game-entities/entity/helpers/entity-store.helper.test.js +136 -0
- package/dist/game-entities/entity/helpers/entity-views.helper.d.ts +1 -1
- package/dist/game-entities/entity/helpers/entity-views.helper.js +5 -3
- package/dist/game-entities/entity/singleton-entity.d.ts +3 -3
- package/dist/game-entities/entity/singleton-entity.js +1 -1
- package/dist/game-entities/entity/singleton-entity.test.js +2 -29
- package/dist/game-entities/index.d.ts +1 -3
- package/dist/game-entities/index.js +3 -7
- package/dist/game-entities/scene/scene.d.ts +3 -3
- package/dist/game-entities/scene/scene.js +31 -25
- package/dist/game-entities/scene/scene.test.js +4 -32
- package/dist/game-entities/service/service.js +5 -3
- package/dist/game-entities/service/service.test.js +2 -28
- package/dist/game-entities/unit-test.helper.d.ts +5 -0
- package/dist/game-entities/unit-test.helper.js +14 -0
- package/dist/game-entities/update-cycle.d.ts +15 -4
- package/dist/game-entities/update-cycle.js +14 -9
- package/dist/game-entities/view/view.d.ts +5 -6
- package/dist/game-entities/view/view.js +5 -17
- package/dist/game-entities/view/view.test.js +36 -244
- package/dist/physics/entity-types/immovable-physics-entity.d.ts +1 -3
- package/dist/physics/entity-types/immovable-physics-entity.js +1 -3
- package/dist/physics/entity-types/movable-entity.js +4 -4
- package/dist/physics/entity-types/movable-physics-entity.d.ts +2 -3
- package/dist/physics/entity-types/movable-physics-entity.js +5 -6
- package/dist/physics/entity-types/physics-entity.d.ts +2 -1
- package/dist/physics/entity-types/physics-entity.js +3 -2
- package/dist/physics/interfaces.d.ts +1 -1
- package/dist/physics/module//342/232/234/357/270/217gateways/controllers/physics-internal.controller.d.ts +3 -3
- package/dist/physics/module//342/232/234/357/270/217gateways/controllers/physics.controller.d.ts +1 -1
- package/dist/physics/module//342/232/234/357/270/217gateways/physics-internal.gateway.d.ts +3 -3
- package/dist/physics/module//342/232/234/357/270/217gateways/physics.gateway.d.ts +1 -1
- package/dist/physics/module//360/237/223/220services/creation/physics-world.service.js +2 -2
- package/dist/physics/module//360/237/223/220services/path-finding/availability-grid.service.js +1 -1
- package/dist/physics/module//360/237/223/220services/path-finding/path-finder.service.js +1 -1
- package/dist/physics/module//360/237/223/220services/query/physics-query.service.d.ts +3 -3
- package/dist/physics/module//360/237/223/220services/test-visuals/test-visuals.service.js +17 -7
- package/dist/physics/module//360/237/247/212entities/physics-world.entity.js +2 -2
- package/dist/pixi/components/mouse-wheel-listener.ui.d.ts +2 -1
- package/dist/pixi/components/mouse-wheel-listener.ui.js +4 -3
- package/dist/pixi/display-object/container-attributes.d.ts +2 -3
- package/dist/pixi/display-object/container-attributes.js +2 -3
- package/dist/pixi/display-object/container.d.ts +0 -3
- package/dist/pixi/display-object/container.js +0 -10
- package/dist/pixi/display-object/objects/sprite/glow-sprite-generator.js +5 -3
- package/dist/pixi/game.d.ts +6 -2
- package/dist/pixi/game.js +14 -5
- package/dist/pixi/modules/CAMERA//360/237/247/212entities/camera.entity.js +4 -4
- package/dist/pixi/modules/CAMERA//360/237/247/251views/camera.view.js +1 -1
- package/dist/pixi/services/keyboard/keyboard.d.ts +4 -2
- package/dist/pixi/services/keyboard/keyboard.js +6 -4
- package/dist/pixi/services/mouse/mouse-target-focus.service.d.ts +2 -1
- package/dist/pixi/services/mouse/mouse-target-focus.service.js +6 -5
- package/dist/pixi/services/mouse/mouse.service.d.ts +15 -5
- package/dist/pixi/services/mouse/mouse.service.js +38 -18
- package/dist/utilities/animator/animating-content/fade-in-content.d.ts +18 -0
- package/dist/utilities/animator/animating-content/fade-in-content.js +37 -0
- package/dist/utilities/animator/animating-content/slide-in-content.d.ts +37 -0
- package/dist/utilities/animator/animating-content/slide-in-content.js +99 -0
- package/dist/utilities/animator/animations.d.ts +37 -0
- package/dist/utilities/animator/animations.js +88 -0
- package/dist/utilities/animator/animator.d.ts +61 -0
- package/dist/utilities/animator/animator.js +315 -0
- package/dist/utilities/animator/animator.test.d.ts +1 -0
- package/dist/utilities/animator/animator.test.js +867 -0
- package/dist/utilities/animator/index.d.ts +7 -0
- package/dist/utilities/animator/index.js +24 -0
- package/dist/utilities/animator/state-animation/slide-state-animation.d.ts +24 -0
- package/dist/utilities/animator/state-animation/slide-state-animation.js +130 -0
- package/dist/utilities/animator/state-animation/slide-state-animation.test.d.ts +1 -0
- package/dist/utilities/animator/state-animation/slide-state-animation.test.js +301 -0
- package/dist/utilities/animator/state-animation/state-animation.d.ts +33 -0
- package/dist/utilities/animator/state-animation/state-animation.js +146 -0
- package/dist/utilities/animator/state-animation/state-animation.test.d.ts +1 -0
- package/dist/utilities/animator/state-animation/state-animation.test.js +335 -0
- package/dist/utilities/animator/state-animation/visit-disappear-state-animation.d.ts +32 -0
- package/dist/utilities/animator/state-animation/visit-disappear-state-animation.js +168 -0
- package/dist/utilities/animator/state-animation/visit-disappear-state-animation.test.d.ts +1 -0
- package/dist/utilities/animator/state-animation/visit-disappear-state-animation.test.js +431 -0
- package/dist/utilities/data-structures/vector-set/vector-set.d.ts +7 -0
- package/dist/utilities/data-structures/vector-set/vector-set.js +26 -0
- package/dist/utilities/delta-time/delta-time.d.ts +3 -0
- package/dist/utilities/delta-time/delta-time.js +10 -0
- package/dist/utilities/grid-algorithms/closest-available-space/closest-available-space.helper.d.ts +6 -0
- package/dist/utilities/grid-algorithms/closest-available-space/closest-available-space.helper.js +55 -0
- package/dist/utilities/grid-algorithms/closest-available-space/closest-available-space.helper.test.d.ts +1 -0
- package/dist/utilities/grid-algorithms/closest-available-space/closest-available-space.helper.test.js +100 -0
- package/dist/utilities/grid-algorithms/path-finder/path-finder.d.ts +8 -0
- package/dist/utilities/grid-algorithms/path-finder/path-finder.js +98 -0
- package/dist/utilities/grid-algorithms/path-finder/path-finder.test.d.ts +1 -0
- package/dist/utilities/grid-algorithms/path-finder/path-finder.test.js +155 -0
- package/dist/utilities/grid-algorithms/position-to-grid-position-converter.d.ts +6 -0
- package/dist/utilities/grid-algorithms/position-to-grid-position-converter.js +17 -0
- package/dist/utilities/grid-algorithms/vector-field-path-finder/vector-field-path-finder.d.ts +18 -0
- package/dist/utilities/grid-algorithms/vector-field-path-finder/vector-field-path-finder.js +129 -0
- package/dist/utilities/grid-algorithms/vector-field-path-finder/vector-field-path-finder.test.d.ts +1 -0
- package/dist/utilities/grid-algorithms/vector-field-path-finder/vector-field-path-finder.test.js +254 -0
- package/dist/utilities/index.d.ts +6 -6
- package/dist/utilities/index.js +6 -6
- package/package.json +3 -3
|
@@ -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/
|
|
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
|
|
38
|
-
.
|
|
37
|
+
physicsWorld
|
|
38
|
+
.onDestroy(() => {
|
|
39
39
|
p2World.clear();
|
|
40
40
|
if (request.modifyUpdateCycle) {
|
|
41
41
|
game_entities_1.UpdateCycle.cleanUpdateModifier();
|
package/dist/physics/module//360/237/223/220services/path-finding/availability-grid.service.js
CHANGED
|
@@ -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/
|
|
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/
|
|
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 {
|
|
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:
|
|
5
|
+
subscribeToPhysicsStep(physicsWorldId: string, callback: NotifierCallbackFunction<{
|
|
6
6
|
time: number;
|
|
7
7
|
delta: number;
|
|
8
|
-
}>):
|
|
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/
|
|
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.
|
|
121
|
-
case
|
|
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
|
|
133
|
+
case p2_1.default.Shape.CAPSULE:
|
|
124
134
|
throw new Error('Not implemented');
|
|
125
|
-
case
|
|
135
|
+
case p2_1.default.Shape.BOX:
|
|
126
136
|
throw new Error('Not implemented');
|
|
127
|
-
case
|
|
137
|
+
case p2_1.default.Shape.HEIGHTFIELD:
|
|
128
138
|
throw new Error('Not implemented');
|
|
129
|
-
case
|
|
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(
|
|
31
|
-
this.lastP2Time = new actions_lib_1.Variable(
|
|
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);
|
|
@@ -2,7 +2,8 @@ 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
|
|
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);
|
|
@@ -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.
|
|
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).
|
|
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.
|
|
44
|
+
this._onWheel.trigger(event.deltaY);
|
|
44
45
|
}
|
|
45
46
|
}).bind(this);
|
|
46
47
|
this.wheelListener = new PIXI.Graphics();
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import {
|
|
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 { Attachable } from '../../game-entities';
|
|
5
4
|
export declare enum ContainerEventType {
|
|
6
5
|
click = "click",
|
|
7
6
|
mouseover = "mouseover",
|
|
@@ -47,7 +46,7 @@ export declare abstract class ContainerAttributes extends Attachable {
|
|
|
47
46
|
set x(value: number);
|
|
48
47
|
get y(): number;
|
|
49
48
|
set y(value: number);
|
|
50
|
-
on(eventType: ContainerEventType, callback: () => void):
|
|
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
|
|
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.Attachable {
|
|
|
121
120
|
this.pixiContainer.on(eventType, handle);
|
|
122
121
|
return new actions_lib_1.ActionSubscription(() => {
|
|
123
122
|
this.pixiContainer.off(eventType, handle);
|
|
124
|
-
})
|
|
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 { Attachable } from '../../game-entities';
|
|
3
2
|
import { ContainerAttributes } from './container-attributes';
|
|
4
3
|
import { Filters } from './filters';
|
|
5
4
|
import { Sprite } from './objects/sprite/sprite';
|
|
@@ -16,8 +15,6 @@ export declare class Container extends ContainerAttributes {
|
|
|
16
15
|
cropOverflowingParts: boolean;
|
|
17
16
|
};
|
|
18
17
|
constructor();
|
|
19
|
-
attach(parent: Attachable | string): this;
|
|
20
|
-
attachToRoot(): this;
|
|
21
18
|
destroy(): void;
|
|
22
19
|
getBoundingMask(): Sprite;
|
|
23
20
|
displayParent(parent: Container | string, partialOptions?: Partial<SetParentOptions>): this;
|
|
@@ -16,16 +16,6 @@ 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 attach function non-internal
|
|
20
|
-
attach(parent) {
|
|
21
|
-
super.attach(parent);
|
|
22
|
-
return this;
|
|
23
|
-
}
|
|
24
|
-
// make the attachToRoot function non-internal
|
|
25
|
-
attachToRoot() {
|
|
26
|
-
super.attachToRoot();
|
|
27
|
-
return this;
|
|
28
|
-
}
|
|
29
19
|
destroy() {
|
|
30
20
|
if (!this.destroyed) {
|
|
31
21
|
Container.allContainers.delete(this.id);
|
|
@@ -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
|
|
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
|
-
|
|
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
|
package/dist/pixi/game.d.ts
CHANGED
|
@@ -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
|
|
25
|
-
readonly
|
|
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.
|
|
49
|
-
this.
|
|
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.
|
|
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
|
-
|
|
119
|
-
this.
|
|
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(
|
|
17
|
-
this.offset = new actions_lib_1.Variable(
|
|
18
|
-
this.targetPosition = new actions_lib_1.Variable();
|
|
19
|
-
this.focusingNewTargetInfo = new actions_lib_1.Variable(
|
|
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;
|
|
@@ -103,7 +103,7 @@ let CameraView = class CameraView extends game_entities_1.View {
|
|
|
103
103
|
}
|
|
104
104
|
}
|
|
105
105
|
convertToCameraPosition(positionInWorld) {
|
|
106
|
-
return helpers_lib_1.Vector.fromTo(positionInWorld, game_1.Game.instance.
|
|
106
|
+
return helpers_lib_1.Vector.fromTo(positionInWorld, game_1.Game.instance.getScreenSizeCenter());
|
|
107
107
|
}
|
|
108
108
|
};
|
|
109
109
|
exports.CameraView = CameraView;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { Action } from 'actions-lib';
|
|
2
2
|
export declare class KeyboardService {
|
|
3
|
-
readonly
|
|
4
|
-
readonly
|
|
3
|
+
readonly _keyPressed: Action<string>;
|
|
4
|
+
readonly keyPressed: import("actions-lib").Notifier<string>;
|
|
5
|
+
readonly _keyReleased: Action<string>;
|
|
6
|
+
readonly keyReleased: import("actions-lib").Notifier<string>;
|
|
5
7
|
private listOfPressedKeys;
|
|
6
8
|
private listOfJustPressedKeys;
|
|
7
9
|
constructor();
|
|
@@ -15,18 +15,20 @@ const game_entities_1 = require("../../../game-entities");
|
|
|
15
15
|
const service_1 = require("../../../game-entities/service/service");
|
|
16
16
|
let KeyboardService = class KeyboardService {
|
|
17
17
|
constructor() {
|
|
18
|
-
this.
|
|
19
|
-
this.
|
|
18
|
+
this._keyPressed = new actions_lib_1.Action();
|
|
19
|
+
this.keyPressed = this._keyPressed.notifier;
|
|
20
|
+
this._keyReleased = new actions_lib_1.Action();
|
|
21
|
+
this.keyReleased = this._keyReleased.notifier;
|
|
20
22
|
this.listOfPressedKeys = new Set();
|
|
21
23
|
this.listOfJustPressedKeys = new Set();
|
|
22
24
|
window.addEventListener('keydown', event => {
|
|
23
25
|
this.listOfPressedKeys.add(event.key);
|
|
24
26
|
this.listOfJustPressedKeys.add(event.key);
|
|
25
|
-
!event.repeat && this.
|
|
27
|
+
!event.repeat && this._keyPressed.trigger(event.key);
|
|
26
28
|
});
|
|
27
29
|
window.addEventListener('keyup', event => {
|
|
28
30
|
this.listOfPressedKeys.delete(event.key);
|
|
29
|
-
this.
|
|
31
|
+
this._keyReleased.trigger(event.key);
|
|
30
32
|
});
|
|
31
33
|
window.addEventListener('blur', () => {
|
|
32
34
|
this.listOfPressedKeys.clear();
|
|
@@ -3,7 +3,8 @@ import { Vector } from 'helpers-lib';
|
|
|
3
3
|
import { MouseService } from './mouse.service';
|
|
4
4
|
export declare class MouseTargetFocusService {
|
|
5
5
|
private mouseService;
|
|
6
|
-
|
|
6
|
+
readonly _onTargetFocus: Action<Vector>;
|
|
7
|
+
readonly onTargetFocus: import("actions-lib").Notifier<Vector>;
|
|
7
8
|
get focusedInLastFrame(): boolean;
|
|
8
9
|
get lastFocusedPosition(): Vector | undefined;
|
|
9
10
|
private mouseStagePositionPrevious;
|
|
@@ -24,7 +24,8 @@ let MouseTargetFocusService = class MouseTargetFocusService {
|
|
|
24
24
|
}
|
|
25
25
|
constructor(mouseService) {
|
|
26
26
|
this.mouseService = mouseService;
|
|
27
|
-
this.
|
|
27
|
+
this._onTargetFocus = new actions_lib_1.Action();
|
|
28
|
+
this.onTargetFocus = this._onTargetFocus.notifier;
|
|
28
29
|
this.timePassFromLastTrigger = 0;
|
|
29
30
|
this.triggerAfterCooldown = false;
|
|
30
31
|
this._focusedInLastFrame = false;
|
|
@@ -35,7 +36,7 @@ let MouseTargetFocusService = class MouseTargetFocusService {
|
|
|
35
36
|
}
|
|
36
37
|
update(delta) {
|
|
37
38
|
if (this.mouseStagePositionPrevious) {
|
|
38
|
-
let mousePositionChange = this.getPositionChange(this.mouseService.
|
|
39
|
+
let mousePositionChange = this.getPositionChange(this.mouseService.getStagePosition(), this.mouseStagePositionPrevious);
|
|
39
40
|
if (this.peakValueChange === undefined) {
|
|
40
41
|
this.peakValueChange = mousePositionChange;
|
|
41
42
|
}
|
|
@@ -43,7 +44,7 @@ let MouseTargetFocusService = class MouseTargetFocusService {
|
|
|
43
44
|
this.check(mousePositionChange, delta);
|
|
44
45
|
}
|
|
45
46
|
}
|
|
46
|
-
this.mouseStagePositionPrevious = this.mouseService.
|
|
47
|
+
this.mouseStagePositionPrevious = this.mouseService.getStagePosition();
|
|
47
48
|
}
|
|
48
49
|
check(mousePositionChange, delta) {
|
|
49
50
|
if (this.peakValueChange - mousePositionChange > 10) {
|
|
@@ -64,8 +65,8 @@ let MouseTargetFocusService = class MouseTargetFocusService {
|
|
|
64
65
|
this.triggerAfterCooldown = false;
|
|
65
66
|
this.timePassFromLastTrigger = 0;
|
|
66
67
|
this._focusedInLastFrame = true;
|
|
67
|
-
this._lastFocusedPosition = this.mouseService.
|
|
68
|
-
this.
|
|
68
|
+
this._lastFocusedPosition = this.mouseService.getStagePosition();
|
|
69
|
+
this._onTargetFocus.trigger(this._lastFocusedPosition);
|
|
69
70
|
}
|
|
70
71
|
else {
|
|
71
72
|
this.timePassFromLastTrigger += delta;
|
|
@@ -1,11 +1,21 @@
|
|
|
1
1
|
import { Variable } from 'actions-lib';
|
|
2
2
|
import { Vector } from 'helpers-lib';
|
|
3
3
|
export declare class MouseService {
|
|
4
|
-
readonly
|
|
5
|
-
readonly
|
|
6
|
-
|
|
7
|
-
readonly
|
|
8
|
-
readonly
|
|
4
|
+
readonly _initialMouseMovementHappened: Variable<boolean>;
|
|
5
|
+
readonly onInitialMouseMove: import("actions-lib").Notifier<boolean>;
|
|
6
|
+
get initialMouseMoveHappened(): boolean;
|
|
7
|
+
readonly _stagePosition: Variable<Vector>;
|
|
8
|
+
readonly stagePosition: import("actions-lib").Notifier<Vector>;
|
|
9
|
+
getStagePosition(): Vector;
|
|
10
|
+
readonly _screenPosition: Variable<Vector>;
|
|
11
|
+
readonly screenPosition: import("actions-lib").Notifier<Vector>;
|
|
12
|
+
getScreenPosition(): Vector;
|
|
13
|
+
readonly _mainButtonState: Variable<boolean>;
|
|
14
|
+
readonly mainButtonState: import("actions-lib").Notifier<boolean>;
|
|
15
|
+
getMainButtonState(): boolean;
|
|
16
|
+
readonly _secondaryButtonState: Variable<boolean>;
|
|
17
|
+
readonly secondaryButtonState: import("actions-lib").Notifier<boolean>;
|
|
18
|
+
getSecondaryButtonState(): boolean;
|
|
9
19
|
constructor();
|
|
10
20
|
private startListeningMouseMove;
|
|
11
21
|
}
|
|
@@ -16,58 +16,78 @@ const service_1 = require("../../../game-entities/service/service");
|
|
|
16
16
|
const update_cycle_1 = require("../../../game-entities/update-cycle");
|
|
17
17
|
const __1 = require("../..");
|
|
18
18
|
let MouseService = class MouseService {
|
|
19
|
+
get initialMouseMoveHappened() {
|
|
20
|
+
return this._initialMouseMovementHappened.value;
|
|
21
|
+
}
|
|
22
|
+
getStagePosition() {
|
|
23
|
+
return this._stagePosition.value;
|
|
24
|
+
}
|
|
25
|
+
getScreenPosition() {
|
|
26
|
+
return this._screenPosition.value;
|
|
27
|
+
}
|
|
28
|
+
getMainButtonState() {
|
|
29
|
+
return this._mainButtonState.value;
|
|
30
|
+
}
|
|
31
|
+
getSecondaryButtonState() {
|
|
32
|
+
return this._secondaryButtonState.value;
|
|
33
|
+
}
|
|
19
34
|
constructor() {
|
|
20
|
-
this.
|
|
21
|
-
this.
|
|
22
|
-
this.
|
|
23
|
-
this.
|
|
24
|
-
this.
|
|
35
|
+
this._initialMouseMovementHappened = new actions_lib_1.Variable(false);
|
|
36
|
+
this.onInitialMouseMove = this._initialMouseMovementHappened.notifier;
|
|
37
|
+
this._stagePosition = new actions_lib_1.Variable(helpers_lib_1.Vector.zero, { notifyOnChange: true });
|
|
38
|
+
this.stagePosition = this._stagePosition.notifier;
|
|
39
|
+
this._screenPosition = new actions_lib_1.Variable(helpers_lib_1.Vector.zero, { notifyOnChange: true });
|
|
40
|
+
this.screenPosition = this._screenPosition.notifier;
|
|
41
|
+
this._mainButtonState = new actions_lib_1.Variable(false);
|
|
42
|
+
this.mainButtonState = this._mainButtonState.notifier;
|
|
43
|
+
this._secondaryButtonState = new actions_lib_1.Variable(false);
|
|
44
|
+
this.secondaryButtonState = this._secondaryButtonState.notifier;
|
|
25
45
|
this.startListeningMouseMove();
|
|
26
46
|
window.addEventListener('mousedown', event => {
|
|
27
47
|
if (event.button === 0) {
|
|
28
|
-
this.
|
|
48
|
+
this._mainButtonState.value = true;
|
|
29
49
|
}
|
|
30
50
|
else if (event.button === 2) {
|
|
31
|
-
this.
|
|
51
|
+
this._secondaryButtonState.value = true;
|
|
32
52
|
}
|
|
33
53
|
});
|
|
34
54
|
window.addEventListener('mouseup', event => {
|
|
35
55
|
if (event.button === 0) {
|
|
36
|
-
this.
|
|
56
|
+
this._mainButtonState.value = false;
|
|
37
57
|
}
|
|
38
58
|
else if (event.button === 2) {
|
|
39
|
-
this.
|
|
59
|
+
this._secondaryButtonState.value = false;
|
|
40
60
|
}
|
|
41
61
|
});
|
|
42
62
|
window.addEventListener('blur', () => {
|
|
43
|
-
this.
|
|
44
|
-
this.
|
|
63
|
+
this._mainButtonState.value = false;
|
|
64
|
+
this._secondaryButtonState.value = false;
|
|
45
65
|
});
|
|
46
66
|
}
|
|
47
67
|
startListeningMouseMove() {
|
|
48
68
|
let mouseScreenPosition = helpers_lib_1.Vector.zero;
|
|
49
69
|
window.addEventListener('mousemove', event => {
|
|
50
70
|
mouseScreenPosition = new helpers_lib_1.Vector(event.clientX, event.clientY);
|
|
51
|
-
this.
|
|
71
|
+
this._initialMouseMovementHappened.value = true;
|
|
52
72
|
});
|
|
53
73
|
update_cycle_1.UpdateCycle.beforeSceneUpdateAction
|
|
54
74
|
.subscribe(() => {
|
|
55
|
-
this.
|
|
75
|
+
this._screenPosition.value = mouseScreenPosition;
|
|
56
76
|
})
|
|
57
77
|
.attachToRoot();
|
|
58
78
|
update_cycle_1.UpdateCycle.afterSceneUpdateAction
|
|
59
79
|
.subscribe(() => {
|
|
60
|
-
let newStagePosition = __1.Game.instance.screenPositonToStagePosition(this.
|
|
61
|
-
if (newStagePosition.isEqual(this.
|
|
80
|
+
let newStagePosition = __1.Game.instance.screenPositonToStagePosition(this._screenPosition.value);
|
|
81
|
+
if (newStagePosition.isEqual(this._stagePosition.value)) {
|
|
62
82
|
// Trigger pointer move event, because content might slide under the mouse cursor
|
|
63
83
|
__1.Game.instance.renderer.events['onPointerMove'](new PointerEvent('pointermove', {
|
|
64
|
-
clientX: this.
|
|
65
|
-
clientY: this.
|
|
84
|
+
clientX: this._screenPosition.value.x,
|
|
85
|
+
clientY: this._screenPosition.value.y,
|
|
66
86
|
pointerType: 'mouse'
|
|
67
87
|
}));
|
|
68
88
|
}
|
|
69
89
|
else {
|
|
70
|
-
this.
|
|
90
|
+
this._stagePosition.value = newStagePosition;
|
|
71
91
|
}
|
|
72
92
|
})
|
|
73
93
|
.attachToRoot();
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Container } from '../../../pixi';
|
|
2
|
+
import { AnimatorAnimation } from '../animations';
|
|
3
|
+
export interface FadeInContentOptions {
|
|
4
|
+
duration: number;
|
|
5
|
+
animation: AnimatorAnimation;
|
|
6
|
+
}
|
|
7
|
+
export declare class FadeInContent<T> extends Container {
|
|
8
|
+
private createFunction;
|
|
9
|
+
private stateAnimation;
|
|
10
|
+
private content;
|
|
11
|
+
constructor(createFunction: (value: {
|
|
12
|
+
state: T;
|
|
13
|
+
container: Container;
|
|
14
|
+
}) => void, partialOptions?: Partial<FadeInContentOptions>);
|
|
15
|
+
setState(state: T | undefined, options?: {
|
|
16
|
+
instant?: boolean;
|
|
17
|
+
}): this;
|
|
18
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FadeInContent = void 0;
|
|
4
|
+
const pixi_1 = require("../../../pixi");
|
|
5
|
+
const animations_1 = require("../animations");
|
|
6
|
+
const visit_disappear_state_animation_1 = require("../state-animation/visit-disappear-state-animation");
|
|
7
|
+
class FadeInContent extends pixi_1.Container {
|
|
8
|
+
constructor(createFunction, partialOptions) {
|
|
9
|
+
super();
|
|
10
|
+
this.createFunction = createFunction;
|
|
11
|
+
let options = {
|
|
12
|
+
duration: 200,
|
|
13
|
+
animation: new animations_1.AnimationEaseInOut(),
|
|
14
|
+
...partialOptions
|
|
15
|
+
};
|
|
16
|
+
this.alpha = 0;
|
|
17
|
+
this.stateAnimation = new visit_disappear_state_animation_1.VisitDisappearStateAnimation(options)
|
|
18
|
+
.onStateChange(state => {
|
|
19
|
+
this.content?.destroy();
|
|
20
|
+
this.content = undefined;
|
|
21
|
+
if (state !== undefined) {
|
|
22
|
+
this.content = new pixi_1.Container().displayParent(this).attach(this);
|
|
23
|
+
this.createFunction({ state, container: this.content });
|
|
24
|
+
}
|
|
25
|
+
})
|
|
26
|
+
.onValueChange(value => {
|
|
27
|
+
this.alpha = value;
|
|
28
|
+
})
|
|
29
|
+
.attach(this);
|
|
30
|
+
}
|
|
31
|
+
setState(state, options) {
|
|
32
|
+
this.stateAnimation.setState(state, options);
|
|
33
|
+
return this;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
exports.FadeInContent = FadeInContent;
|
|
37
|
+
//# sourceMappingURL=fade-in-content.js.map
|