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.
- package/dist/game-entities/base/attachable.d.ts +10 -3
- package/dist/game-entities/base/attachable.js +50 -18
- package/dist/game-entities/base/attachable.test.js +81 -95
- package/dist/game-entities/base/helpers/attachable.store.d.ts +2 -8
- package/dist/game-entities/base/helpers/attachable.store.js +46 -17
- package/dist/game-entities/base/helpers/attachable.store.test.d.ts +1 -0
- package/dist/game-entities/base/helpers/attachable.store.test.js +234 -0
- package/dist/game-entities/base/helpers/decorate-actions-lib.d.ts +3 -3
- package/dist/game-entities/base/helpers/decorate-actions-lib.js +5 -5
- package/dist/game-entities/base/helpers/referance-variable.d.ts +2 -2
- package/dist/game-entities/base/helpers/referance-variable.js +2 -2
- 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 +10 -9
- package/dist/game-entities/entity/entity.js +9 -13
- package/dist/game-entities/entity/entity.test.js +47 -139
- 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 -5
- package/dist/game-entities/index.js +3 -24
- package/dist/game-entities/scene/scene.d.ts +4 -4
- package/dist/game-entities/scene/scene.js +31 -25
- package/dist/game-entities/scene/scene.test.js +14 -36
- 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 +7 -8
- package/dist/game-entities/view/view.js +12 -21
- package/dist/game-entities/view/view.test.js +54 -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 +3 -2
- package/dist/physics/entity-types/physics-entity.js +10 -7
- 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/helpers/smooth-scroller.d.ts +1 -2
- package/dist/pixi/components/helpers/smooth-scroller.js +1 -3
- package/dist/pixi/components/helpers/smooth-scroller.test.js +5 -5
- package/dist/pixi/components/mouse-wheel-listener.ui.d.ts +3 -2
- package/dist/pixi/components/mouse-wheel-listener.ui.js +10 -7
- package/dist/pixi/components/scroll-area.ui.d.ts +0 -1
- package/dist/pixi/components/scroll-area.ui.js +1 -4
- package/dist/pixi/display-object/container-attributes.d.ts +3 -4
- package/dist/pixi/display-object/container-attributes.js +2 -3
- package/dist/pixi/display-object/container.d.ts +0 -4
- package/dist/pixi/display-object/container.js +5 -17
- package/dist/pixi/display-object/objects/graphics/graphics.d.ts +1 -1
- package/dist/pixi/display-object/objects/graphics/graphics.js +5 -3
- package/dist/pixi/display-object/objects/placeholder.d.ts +1 -1
- package/dist/pixi/display-object/objects/placeholder.js +5 -3
- package/dist/pixi/display-object/objects/sprite/glow-sprite-generator.js +5 -3
- package/dist/pixi/display-object/objects/sprite/sprite.d.ts +1 -1
- package/dist/pixi/display-object/objects/sprite/sprite.js +12 -10
- package/dist/pixi/display-object/objects/text/text.d.ts +1 -1
- package/dist/pixi/display-object/objects/text/text.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.d.ts +1 -1
- package/dist/pixi/modules/CAMERA//360/237/247/251views/camera.view.js +6 -4
- 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/dist/utilities/libraries/animator/animator.d.ts +3 -5
- package/dist/utilities/libraries/animator/animator.js +17 -19
- package/dist/utilities/libraries/animator/state-animation/slide-state-animation.d.ts +2 -2
- package/dist/utilities/libraries/animator/state-animation/slide-state-animation.js +1 -1
- package/dist/utilities/libraries/animator/state-animation/state-animation.d.ts +2 -2
- package/dist/utilities/libraries/animator/state-animation/state-animation.js +1 -1
- package/dist/utilities/libraries/animator/state-animation/visit-disappear-state-animation.d.ts +2 -2
- package/dist/utilities/libraries/animator/state-animation/visit-disappear-state-animation.js +1 -1
- package/package.json +6 -6
|
@@ -15,7 +15,7 @@ export declare class CameraView extends View {
|
|
|
15
15
|
private alphaAnimator;
|
|
16
16
|
private blackScreenAnimator;
|
|
17
17
|
constructor(entity: CameraEntity);
|
|
18
|
-
|
|
18
|
+
destroy(): void;
|
|
19
19
|
getLayers(): Record<CameraLayer, string>;
|
|
20
20
|
appear(value: boolean, type: CameraAppearTransitionType): Promise<void>;
|
|
21
21
|
private convertToCameraPosition;
|
|
@@ -66,9 +66,11 @@ let CameraView = class CameraView extends game_entities_1.View {
|
|
|
66
66
|
.attach(this);
|
|
67
67
|
this.appear(true, 'alpha');
|
|
68
68
|
}
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
69
|
+
destroy() {
|
|
70
|
+
if (!this.destroyed) {
|
|
71
|
+
game_1.Game.instance.resetScreenPositionToStagePositionFunction();
|
|
72
|
+
super.destroy();
|
|
73
|
+
}
|
|
72
74
|
}
|
|
73
75
|
getLayers() {
|
|
74
76
|
return {
|
|
@@ -101,7 +103,7 @@ let CameraView = class CameraView extends game_entities_1.View {
|
|
|
101
103
|
}
|
|
102
104
|
}
|
|
103
105
|
convertToCameraPosition(positionInWorld) {
|
|
104
|
-
return helpers_lib_1.Vector.fromTo(positionInWorld, game_1.Game.instance.
|
|
106
|
+
return helpers_lib_1.Vector.fromTo(positionInWorld, game_1.Game.instance.getScreenSizeCenter());
|
|
105
107
|
}
|
|
106
108
|
};
|
|
107
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
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { Vector } from 'helpers-lib';
|
|
2
|
+
import { Container } from '../../../pixi';
|
|
3
|
+
import { AnimatorAnimation } from '../animations';
|
|
4
|
+
export interface ScrollInContentOptions {
|
|
5
|
+
readonly duration: number;
|
|
6
|
+
readonly animation: AnimatorAnimation;
|
|
7
|
+
readonly size: Vector;
|
|
8
|
+
readonly margin: number;
|
|
9
|
+
readonly direction: 'horizontal' | 'vertical';
|
|
10
|
+
}
|
|
11
|
+
export declare class SlideInContentByIndex extends Container {
|
|
12
|
+
private createFunction;
|
|
13
|
+
private options;
|
|
14
|
+
private directionProperty;
|
|
15
|
+
private stateAnimation;
|
|
16
|
+
private contents;
|
|
17
|
+
constructor(createFunction: (value: {
|
|
18
|
+
index: number;
|
|
19
|
+
container: Container;
|
|
20
|
+
}) => void, partialOptions?: Partial<ScrollInContentOptions>);
|
|
21
|
+
setIndex(index: number, options?: {
|
|
22
|
+
instant?: boolean;
|
|
23
|
+
}): this;
|
|
24
|
+
private createMask;
|
|
25
|
+
}
|
|
26
|
+
export declare class SlideInContent<T> extends SlideInContentByIndex {
|
|
27
|
+
readonly itemToIndex: Map<T, number>;
|
|
28
|
+
readonly indexToItem: Map<number, T>;
|
|
29
|
+
constructor(items: T[], createFunction: (value: {
|
|
30
|
+
index: number;
|
|
31
|
+
item: T;
|
|
32
|
+
container: Container;
|
|
33
|
+
}) => void, partialOptions?: Partial<ScrollInContentOptions>);
|
|
34
|
+
setItem(item: T, options?: {
|
|
35
|
+
instant?: boolean;
|
|
36
|
+
}): this;
|
|
37
|
+
}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SlideInContent = exports.SlideInContentByIndex = void 0;
|
|
4
|
+
const helpers_lib_1 = require("helpers-lib");
|
|
5
|
+
const pixi_1 = require("../../../pixi");
|
|
6
|
+
const animations_1 = require("../animations");
|
|
7
|
+
const slide_state_animation_1 = require("../state-animation/slide-state-animation");
|
|
8
|
+
class SlideInContentByIndex extends pixi_1.Container {
|
|
9
|
+
constructor(createFunction, partialOptions) {
|
|
10
|
+
super();
|
|
11
|
+
this.createFunction = createFunction;
|
|
12
|
+
this.directionProperty = 'x';
|
|
13
|
+
this.contents = new Map();
|
|
14
|
+
this.options = {
|
|
15
|
+
duration: 300,
|
|
16
|
+
animation: new animations_1.AnimationEaseInOutCubic(),
|
|
17
|
+
size: new helpers_lib_1.Vector(500, 500),
|
|
18
|
+
margin: 20,
|
|
19
|
+
direction: 'horizontal',
|
|
20
|
+
...partialOptions
|
|
21
|
+
};
|
|
22
|
+
let fullSize = this.options.direction === 'horizontal'
|
|
23
|
+
? new helpers_lib_1.Vector(this.options.size.x + this.options.margin * 2, this.options.size.y)
|
|
24
|
+
: new helpers_lib_1.Vector(this.options.size.x, this.options.size.y + this.options.margin * 2);
|
|
25
|
+
let wrapper = new pixi_1.Container()
|
|
26
|
+
.setPosition(this.options.direction === 'horizontal' ? new helpers_lib_1.Vector(-this.options.margin, 0) : new helpers_lib_1.Vector(0, -this.options.margin), { round: false })
|
|
27
|
+
.displayParent(this)
|
|
28
|
+
.attach(this);
|
|
29
|
+
this.createMask(fullSize, this.options.margin, this.options.direction, wrapper);
|
|
30
|
+
this.directionProperty = this.options.direction === 'horizontal' ? 'x' : 'y';
|
|
31
|
+
this.stateAnimation = new slide_state_animation_1.SlideStateAnimation({
|
|
32
|
+
duration: this.options.duration,
|
|
33
|
+
animation: this.options.animation
|
|
34
|
+
})
|
|
35
|
+
.onStateChange((state, index) => {
|
|
36
|
+
if (state === slide_state_animation_1.SlideStateAnimationState.appear) {
|
|
37
|
+
let container = new pixi_1.Container().displayParent(this).attach(this);
|
|
38
|
+
this.contents.set(index, container);
|
|
39
|
+
this.createFunction({ index, container });
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
let container = this.contents.get(index);
|
|
43
|
+
if (container) {
|
|
44
|
+
container.destroy();
|
|
45
|
+
this.contents.delete(index);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
})
|
|
49
|
+
.onValueChange((value, index) => {
|
|
50
|
+
let container = this.contents.get(index);
|
|
51
|
+
if (container) {
|
|
52
|
+
let vec = { x: 0, y: 0 };
|
|
53
|
+
vec[this.directionProperty] = fullSize[this.directionProperty] * value + this.options.margin;
|
|
54
|
+
container.setPosition(helpers_lib_1.Vector.fromVec2(vec), { round: false });
|
|
55
|
+
}
|
|
56
|
+
})
|
|
57
|
+
.attach(this);
|
|
58
|
+
this.addChildTo = wrapper;
|
|
59
|
+
}
|
|
60
|
+
setIndex(index, options) {
|
|
61
|
+
this.stateAnimation.setIndex(index, options);
|
|
62
|
+
return this;
|
|
63
|
+
}
|
|
64
|
+
createMask(size, padding, direction, container) {
|
|
65
|
+
new pixi_1.ScrollMaskUI(container, new helpers_lib_1.Vector(size.x, size.y), padding, direction).attach(this);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
exports.SlideInContentByIndex = SlideInContentByIndex;
|
|
69
|
+
class SlideInContent extends SlideInContentByIndex {
|
|
70
|
+
constructor(items, createFunction, partialOptions) {
|
|
71
|
+
super((value) => {
|
|
72
|
+
let item = this.indexToItem.get(value.index);
|
|
73
|
+
if (item) {
|
|
74
|
+
createFunction({ index: value.index, item, container: value.container });
|
|
75
|
+
}
|
|
76
|
+
else {
|
|
77
|
+
throw new Error(`SlideInContent: The item with index '${value.index}' is not part of the items list`);
|
|
78
|
+
}
|
|
79
|
+
}, partialOptions);
|
|
80
|
+
this.itemToIndex = new Map();
|
|
81
|
+
this.indexToItem = new Map();
|
|
82
|
+
items.forEach((item, index) => {
|
|
83
|
+
this.itemToIndex.set(item, index);
|
|
84
|
+
this.indexToItem.set(index, item);
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
setItem(item, options) {
|
|
88
|
+
let index = this.itemToIndex.get(item);
|
|
89
|
+
if (index !== undefined) {
|
|
90
|
+
this.setIndex(index, options);
|
|
91
|
+
}
|
|
92
|
+
else {
|
|
93
|
+
throw new Error(`SlideInContent: The item '${item}' is not part of the items list`);
|
|
94
|
+
}
|
|
95
|
+
return this;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
exports.SlideInContent = SlideInContent;
|
|
99
|
+
//# sourceMappingURL=slide-in-content.js.map
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
export interface AnimatorAnimation {
|
|
2
|
+
start(): void;
|
|
3
|
+
multiplierFunction(t: number): number;
|
|
4
|
+
}
|
|
5
|
+
export declare class AnimationInterpolationFunctions {
|
|
6
|
+
static boomerangTime(time: number): number;
|
|
7
|
+
static lineer(time: number): number;
|
|
8
|
+
static easeIn(time: number): number;
|
|
9
|
+
static easeOut(time: number): number;
|
|
10
|
+
static easeInOut(time: number): number;
|
|
11
|
+
static easeInOutCubic(t: number): number;
|
|
12
|
+
}
|
|
13
|
+
export declare class AnimationLineer implements AnimatorAnimation {
|
|
14
|
+
start(): void;
|
|
15
|
+
multiplierFunction(t: number): number;
|
|
16
|
+
}
|
|
17
|
+
export declare class AnimationEaseIn implements AnimatorAnimation {
|
|
18
|
+
start(): void;
|
|
19
|
+
multiplierFunction(t: number): number;
|
|
20
|
+
}
|
|
21
|
+
export declare class AnimationEaseOut implements AnimatorAnimation {
|
|
22
|
+
start(): void;
|
|
23
|
+
multiplierFunction(t: number): number;
|
|
24
|
+
}
|
|
25
|
+
export declare class AnimationEaseInOut implements AnimatorAnimation {
|
|
26
|
+
start(): void;
|
|
27
|
+
multiplierFunction(t: number): number;
|
|
28
|
+
}
|
|
29
|
+
export declare class AnimationEaseInOutCubic implements AnimatorAnimation {
|
|
30
|
+
start(): void;
|
|
31
|
+
multiplierFunction(t: number): number;
|
|
32
|
+
}
|
|
33
|
+
export declare class AnimationFlicker implements AnimatorAnimation {
|
|
34
|
+
private timeGrid;
|
|
35
|
+
start(): void;
|
|
36
|
+
multiplierFunction(t: number): number;
|
|
37
|
+
}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AnimationFlicker = exports.AnimationEaseInOutCubic = exports.AnimationEaseInOut = exports.AnimationEaseOut = exports.AnimationEaseIn = exports.AnimationLineer = exports.AnimationInterpolationFunctions = void 0;
|
|
4
|
+
const helpers_lib_1 = require("helpers-lib");
|
|
5
|
+
class AnimationInterpolationFunctions {
|
|
6
|
+
static boomerangTime(time) {
|
|
7
|
+
return 1 - Math.abs(time - 0.5) * 2;
|
|
8
|
+
}
|
|
9
|
+
static lineer(time) {
|
|
10
|
+
return time;
|
|
11
|
+
}
|
|
12
|
+
static easeIn(time) {
|
|
13
|
+
return Math.pow(time, 2);
|
|
14
|
+
}
|
|
15
|
+
static easeOut(time) {
|
|
16
|
+
return 1 - Math.pow(1 - time, 2);
|
|
17
|
+
}
|
|
18
|
+
static easeInOut(time) {
|
|
19
|
+
if (time < 0.5) {
|
|
20
|
+
return 2 * time * time;
|
|
21
|
+
}
|
|
22
|
+
else {
|
|
23
|
+
time -= 1;
|
|
24
|
+
return 1 - 2 * time * time;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
static easeInOutCubic(t) {
|
|
28
|
+
let a = 2 * t - 2;
|
|
29
|
+
return t < 0.5 ? 4 * Math.pow(t, 3) : (t - 1) * Math.pow(a, 2) + 1;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
exports.AnimationInterpolationFunctions = AnimationInterpolationFunctions;
|
|
33
|
+
class AnimationLineer {
|
|
34
|
+
start() { }
|
|
35
|
+
multiplierFunction(t) {
|
|
36
|
+
return AnimationInterpolationFunctions.lineer(t);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
exports.AnimationLineer = AnimationLineer;
|
|
40
|
+
class AnimationEaseIn {
|
|
41
|
+
start() { }
|
|
42
|
+
multiplierFunction(t) {
|
|
43
|
+
return AnimationInterpolationFunctions.easeIn(t);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
exports.AnimationEaseIn = AnimationEaseIn;
|
|
47
|
+
class AnimationEaseOut {
|
|
48
|
+
start() { }
|
|
49
|
+
multiplierFunction(t) {
|
|
50
|
+
return AnimationInterpolationFunctions.easeOut(t);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
exports.AnimationEaseOut = AnimationEaseOut;
|
|
54
|
+
class AnimationEaseInOut {
|
|
55
|
+
start() { }
|
|
56
|
+
multiplierFunction(t) {
|
|
57
|
+
return AnimationInterpolationFunctions.easeInOut(t);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
exports.AnimationEaseInOut = AnimationEaseInOut;
|
|
61
|
+
class AnimationEaseInOutCubic {
|
|
62
|
+
start() { }
|
|
63
|
+
multiplierFunction(t) {
|
|
64
|
+
return AnimationInterpolationFunctions.easeInOutCubic(t);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
exports.AnimationEaseInOutCubic = AnimationEaseInOutCubic;
|
|
68
|
+
class AnimationFlicker {
|
|
69
|
+
start() {
|
|
70
|
+
this.timeGrid = new Array(10).fill(0);
|
|
71
|
+
helpers_lib_1.Random.integerBetween(0, 9);
|
|
72
|
+
this.timeGrid[helpers_lib_1.Random.integerBetween(0, 9)] = Math.random();
|
|
73
|
+
if (Math.random() < 0.3) {
|
|
74
|
+
helpers_lib_1.Random.integerBetween(0, 9);
|
|
75
|
+
this.timeGrid[helpers_lib_1.Random.integerBetween(0, 9)] = Math.random();
|
|
76
|
+
}
|
|
77
|
+
if (Math.random() < 0.2) {
|
|
78
|
+
helpers_lib_1.Random.integerBetween(0, 9);
|
|
79
|
+
this.timeGrid[helpers_lib_1.Random.integerBetween(0, 9)] = Math.random();
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
multiplierFunction(t) {
|
|
83
|
+
let index = Math.floor(t * 10);
|
|
84
|
+
return this.timeGrid[index];
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
exports.AnimationFlicker = AnimationFlicker;
|
|
88
|
+
//# sourceMappingURL=animations.js.map
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { Attachable } from 'actions-lib';
|
|
2
|
+
import { AnimatorAnimation } from './animations';
|
|
3
|
+
export interface AnimationState {
|
|
4
|
+
duration: number;
|
|
5
|
+
elapsedTime: number;
|
|
6
|
+
startingValue: number;
|
|
7
|
+
targetValue: number;
|
|
8
|
+
loop: boolean;
|
|
9
|
+
completeAnimationsHandling: CompleteAnimationsHandlingType;
|
|
10
|
+
}
|
|
11
|
+
export declare enum ReAnimateHandlingType {
|
|
12
|
+
throwError = "throwError",
|
|
13
|
+
ignoreNewAnimation = "ignoreNewAnimation",
|
|
14
|
+
completePrevious = "completePrevious"
|
|
15
|
+
}
|
|
16
|
+
export declare enum CompleteAnimationsHandlingType {
|
|
17
|
+
returnToOriginal = "returnToOriginal",
|
|
18
|
+
stayInCurrentState = "stayInCurrentState",
|
|
19
|
+
jumpToEnd = "jumpToEnd"
|
|
20
|
+
}
|
|
21
|
+
export interface AnimationOptions {
|
|
22
|
+
duration?: number;
|
|
23
|
+
animation?: AnimatorAnimation;
|
|
24
|
+
loop?: boolean;
|
|
25
|
+
reAnimateHandling?: ReAnimateHandlingType;
|
|
26
|
+
completeAnimationsHandling?: CompleteAnimationsHandlingType;
|
|
27
|
+
}
|
|
28
|
+
export declare class Animator<T> extends Attachable {
|
|
29
|
+
private target;
|
|
30
|
+
private static animatedObjects;
|
|
31
|
+
private effectOn;
|
|
32
|
+
private defaultDuration;
|
|
33
|
+
private defaultAnimation;
|
|
34
|
+
private defaultLoop;
|
|
35
|
+
private defaultReAnimateHandling;
|
|
36
|
+
private defaultCompleteAnimationsHandling;
|
|
37
|
+
private onChangeCallback?;
|
|
38
|
+
private onCompleteCallback?;
|
|
39
|
+
private running;
|
|
40
|
+
private propertyStates;
|
|
41
|
+
private updateCycleSubscription;
|
|
42
|
+
private allResolvers;
|
|
43
|
+
get isAnimating(): boolean;
|
|
44
|
+
constructor(target: T, effectOn: string | string[], options?: AnimationOptions);
|
|
45
|
+
onChange(callback: (target: T) => void): Animator<T>;
|
|
46
|
+
onComplete(callback: (key: string, value: number) => void): Animator<T>;
|
|
47
|
+
destroy(): void;
|
|
48
|
+
getAnimationStateOfKey(key: string): AnimationState | undefined;
|
|
49
|
+
pauseAnimations(): void;
|
|
50
|
+
resumeAnimations(): void;
|
|
51
|
+
completeAnimations(completeAnimationsHandling?: CompleteAnimationsHandlingType): void;
|
|
52
|
+
set(values: Record<string, any>): void;
|
|
53
|
+
animate(values: Record<string, any>, options?: AnimationOptions): Promise<void>;
|
|
54
|
+
private completeAnimationOfProperty;
|
|
55
|
+
private checkOngoingAnimations;
|
|
56
|
+
private update;
|
|
57
|
+
private subscribeUpdateCycle;
|
|
58
|
+
private unsubscribeUpdateCycle;
|
|
59
|
+
private checkPropertyValidity;
|
|
60
|
+
private triggerOnChange;
|
|
61
|
+
}
|