bard-legends-framework 0.10.7 → 0.10.9
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/entity/entity.d.ts +3 -4
- package/dist/game-entities/entity/entity.js +7 -9
- package/dist/game-entities/entity/entity.test.js +25 -23
- package/dist/game-entities/index.d.ts +0 -2
- package/dist/game-entities/index.js +1 -18
- package/dist/game-entities/scene/scene.d.ts +2 -2
- package/dist/game-entities/scene/scene.js +2 -2
- package/dist/game-entities/scene/scene.test.js +10 -4
- package/dist/game-entities/view/view.d.ts +3 -3
- package/dist/game-entities/view/view.js +12 -9
- package/dist/game-entities/view/view.test.js +30 -12
- package/dist/physics/entity-types/physics-entity.d.ts +1 -1
- package/dist/physics/entity-types/physics-entity.js +7 -5
- 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 +1 -1
- package/dist/pixi/components/mouse-wheel-listener.ui.js +6 -4
- 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 +2 -2
- package/dist/pixi/display-object/container-attributes.js +1 -1
- package/dist/pixi/display-object/container.d.ts +3 -4
- package/dist/pixi/display-object/container.js +6 -8
- 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/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/modules/CAMERA//360/237/247/251views/camera.view.d.ts +1 -1
- package/dist/pixi/modules/CAMERA//360/237/247/251views/camera.view.js +5 -3
- 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 +7 -5
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.View = exports.ViewDecorator = void 0;
|
|
4
|
-
const
|
|
4
|
+
const attachable_1 = require("../base/attachable");
|
|
5
|
+
const attachable_store_1 = require("../base/helpers/attachable.store");
|
|
5
6
|
const entity_views_helper_1 = require("../entity/helpers/entity-views.helper");
|
|
6
7
|
const service_1 = require("../service/service");
|
|
7
8
|
const update_cycle_1 = require("../update-cycle");
|
|
@@ -16,25 +17,25 @@ function ViewDecorator(meta) {
|
|
|
16
17
|
ViewClass.$meta = {
|
|
17
18
|
paramtypes: service_1.Service.getParametersMeta(ViewClass),
|
|
18
19
|
viewInstances: new Map(),
|
|
19
|
-
|
|
20
|
+
entity: meta.entity,
|
|
20
21
|
type: 'view'
|
|
21
22
|
};
|
|
22
23
|
entity_views_helper_1.EntityViewsHelper['registerView'](ViewClass, meta.entity);
|
|
23
24
|
};
|
|
24
25
|
}
|
|
25
26
|
exports.ViewDecorator = ViewDecorator;
|
|
26
|
-
class View extends
|
|
27
|
+
class View extends attachable_1.Attachable {
|
|
27
28
|
static { this.viewClassNames = new Set(); }
|
|
28
29
|
static getInstance(entityId) {
|
|
29
|
-
if (
|
|
30
|
+
if (!attachable_store_1.AttachableStore.validateIdForClass(entityId, this.$meta.entity)) {
|
|
30
31
|
return undefined;
|
|
31
32
|
}
|
|
32
33
|
let viewInstances = this.$meta.viewInstances;
|
|
33
34
|
return viewInstances.get(entityId);
|
|
34
35
|
}
|
|
35
36
|
static getInstanceOrFail(entityId) {
|
|
36
|
-
if (
|
|
37
|
-
throw new Error(`View: getInstance is called with entity id: "${entityId}", that is not belonging to the class: "${this.$meta.
|
|
37
|
+
if (!attachable_store_1.AttachableStore.validateIdForClass(entityId, this.$meta.entity)) {
|
|
38
|
+
throw new Error(`View: getInstance is called with entity id: "${entityId}", that is not belonging to the class: "${this.$meta.entity}"`);
|
|
38
39
|
}
|
|
39
40
|
let viewInstances = this.$meta.viewInstances;
|
|
40
41
|
let view = viewInstances.get(entityId);
|
|
@@ -55,9 +56,11 @@ class View extends attachment_target_1.AttachmentTarget {
|
|
|
55
56
|
}
|
|
56
57
|
};
|
|
57
58
|
}
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
59
|
+
destroy() {
|
|
60
|
+
if (!this.destroyed) {
|
|
61
|
+
this.getViewInstances().delete(this._entityId);
|
|
62
|
+
super.destroy();
|
|
63
|
+
}
|
|
61
64
|
}
|
|
62
65
|
update(time, delta) { }
|
|
63
66
|
getViewInstances() {
|
|
@@ -141,8 +141,11 @@ decorate_actions_lib_1.ActionsLibDecorator.decorate(ActionsLib);
|
|
|
141
141
|
super();
|
|
142
142
|
SampleView_3.viewInstanceCount++;
|
|
143
143
|
}
|
|
144
|
-
|
|
145
|
-
|
|
144
|
+
destroy() {
|
|
145
|
+
if (!this.destroyed) {
|
|
146
|
+
SampleView_3.viewInstanceCount--;
|
|
147
|
+
super.destroy();
|
|
148
|
+
}
|
|
146
149
|
}
|
|
147
150
|
};
|
|
148
151
|
SampleView = SampleView_3 = __decorate([
|
|
@@ -167,8 +170,11 @@ decorate_actions_lib_1.ActionsLibDecorator.decorate(ActionsLib);
|
|
|
167
170
|
(0, entity_1.EntityDecorator)()
|
|
168
171
|
], Sample);
|
|
169
172
|
let _SampleView = class _SampleView extends view_1.View {
|
|
170
|
-
|
|
171
|
-
|
|
173
|
+
destroy() {
|
|
174
|
+
if (!this.destroyed) {
|
|
175
|
+
viewDestroyCount++;
|
|
176
|
+
super.destroy();
|
|
177
|
+
}
|
|
172
178
|
}
|
|
173
179
|
};
|
|
174
180
|
_SampleView = __decorate([
|
|
@@ -187,8 +193,11 @@ decorate_actions_lib_1.ActionsLibDecorator.decorate(ActionsLib);
|
|
|
187
193
|
(0, entity_1.EntityDecorator)()
|
|
188
194
|
], Sample);
|
|
189
195
|
let Sample2 = class Sample2 extends entity_1.Entity {
|
|
190
|
-
|
|
191
|
-
|
|
196
|
+
destroy() {
|
|
197
|
+
if (!this.destroyed) {
|
|
198
|
+
viewDestroyCount++;
|
|
199
|
+
super.destroy();
|
|
200
|
+
}
|
|
192
201
|
}
|
|
193
202
|
};
|
|
194
203
|
Sample2 = __decorate([
|
|
@@ -217,8 +226,11 @@ decorate_actions_lib_1.ActionsLibDecorator.decorate(ActionsLib);
|
|
|
217
226
|
(0, entity_1.EntityDecorator)()
|
|
218
227
|
], Sample);
|
|
219
228
|
let _SampleView = class _SampleView extends view_1.View {
|
|
220
|
-
|
|
221
|
-
|
|
229
|
+
destroy() {
|
|
230
|
+
if (!this.destroyed) {
|
|
231
|
+
viewDestroyCount++;
|
|
232
|
+
super.destroy();
|
|
233
|
+
}
|
|
222
234
|
}
|
|
223
235
|
};
|
|
224
236
|
_SampleView = __decorate([
|
|
@@ -476,8 +488,11 @@ decorate_actions_lib_1.ActionsLibDecorator.decorate(ActionsLib);
|
|
|
476
488
|
let Sample = class Sample extends entity_1.Entity {
|
|
477
489
|
static { Sample_2 = this; }
|
|
478
490
|
static { this.destroyed = false; }
|
|
479
|
-
|
|
480
|
-
|
|
491
|
+
destroy() {
|
|
492
|
+
if (!this.destroyed) {
|
|
493
|
+
Sample_2.destroyed = true;
|
|
494
|
+
super.destroy();
|
|
495
|
+
}
|
|
481
496
|
}
|
|
482
497
|
};
|
|
483
498
|
Sample = Sample_2 = __decorate([
|
|
@@ -490,8 +505,11 @@ decorate_actions_lib_1.ActionsLibDecorator.decorate(ActionsLib);
|
|
|
490
505
|
super();
|
|
491
506
|
entity.destroy();
|
|
492
507
|
}
|
|
493
|
-
|
|
494
|
-
|
|
508
|
+
destroy() {
|
|
509
|
+
if (!this.destroyed) {
|
|
510
|
+
SampleView_10.destroyed = true;
|
|
511
|
+
super.destroy();
|
|
512
|
+
}
|
|
495
513
|
}
|
|
496
514
|
};
|
|
497
515
|
SampleView = SampleView_10 = __decorate([
|
|
@@ -27,7 +27,7 @@ export declare abstract class PhysicsEntity extends Entity {
|
|
|
27
27
|
private _collisions;
|
|
28
28
|
constructor(physicsWorldId: string, physicsEntityDefinition: PhysicsEntityDefinition, type: 'dynamic' | 'static');
|
|
29
29
|
abstract convertToDTO(): PhysicsBodyDTO;
|
|
30
|
-
|
|
30
|
+
destroy(): void;
|
|
31
31
|
canCollideWith(target: PhysicsEntity): boolean;
|
|
32
32
|
protected setCollisionReports(collisionReports: CollisionReport[]): void;
|
|
33
33
|
}
|
|
@@ -65,11 +65,13 @@ class PhysicsEntity extends game_entities_1.Entity {
|
|
|
65
65
|
PhysicsEntity.p2BodyIdToPhysicsBody.set(this.p2Body.id, this);
|
|
66
66
|
PhysicsEntity.physicsEntities.set(this.id, this);
|
|
67
67
|
}
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
68
|
+
destroy() {
|
|
69
|
+
if (!this.destroyed) {
|
|
70
|
+
this.physicsInternalGateway.removeBody(this.physicsWorldId, this.p2Body);
|
|
71
|
+
PhysicsEntity.p2BodyIdToPhysicsBody.delete(this.p2Body.id);
|
|
72
|
+
PhysicsEntity.physicsEntities.delete(this.id);
|
|
73
|
+
super.destroy();
|
|
74
|
+
}
|
|
73
75
|
}
|
|
74
76
|
canCollideWith(target) {
|
|
75
77
|
return p2js_helper_1.P2JSHelper.arePhysicsGroupsCollidable(this.physicsGroup, this.physicsMask, target.physicsGroup, target.physicsMask);
|
|
@@ -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
|
|
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
|
|
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')
|
|
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')
|
|
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')
|
|
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')
|
|
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')
|
|
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);
|
|
@@ -50,10 +50,12 @@ class MouseWheelListenerUI extends container_1.Container {
|
|
|
50
50
|
this.pixiContainer.addChild(this.wheelListener);
|
|
51
51
|
window.addEventListener('wheel', this.handler);
|
|
52
52
|
}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
53
|
+
destroy() {
|
|
54
|
+
if (!this.destroyed) {
|
|
55
|
+
this.wheelListener.destroy();
|
|
56
|
+
window.removeEventListener('wheel', this.handler);
|
|
57
|
+
super.destroy();
|
|
58
|
+
}
|
|
57
59
|
}
|
|
58
60
|
}
|
|
59
61
|
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)
|
|
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,7 @@
|
|
|
1
1
|
import { ActionSubscription } from 'actions-lib';
|
|
2
2
|
import { Radian, Vector } from 'helpers-lib';
|
|
3
3
|
import * as PIXI from 'pixi.js';
|
|
4
|
-
import {
|
|
4
|
+
import { Attachable } from '../../game-entities';
|
|
5
5
|
export declare enum ContainerEventType {
|
|
6
6
|
click = "click",
|
|
7
7
|
mouseover = "mouseover",
|
|
@@ -24,7 +24,7 @@ export declare enum Cursor {
|
|
|
24
24
|
default = "default",
|
|
25
25
|
pointer = "pointer"
|
|
26
26
|
}
|
|
27
|
-
export declare abstract class ContainerAttributes extends
|
|
27
|
+
export declare abstract class ContainerAttributes extends Attachable {
|
|
28
28
|
protected pixiContainer: PIXI.Container;
|
|
29
29
|
protected constructor();
|
|
30
30
|
get size(): Vector;
|
|
@@ -52,7 +52,7 @@ var Cursor;
|
|
|
52
52
|
Cursor["default"] = "default";
|
|
53
53
|
Cursor["pointer"] = "pointer";
|
|
54
54
|
})(Cursor || (exports.Cursor = Cursor = {}));
|
|
55
|
-
class ContainerAttributes extends game_entities_1.
|
|
55
|
+
class ContainerAttributes extends game_entities_1.Attachable {
|
|
56
56
|
constructor() {
|
|
57
57
|
super();
|
|
58
58
|
// --------------------- Scale ---------------------
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Rectangle } from 'helpers-lib';
|
|
2
|
-
import {
|
|
2
|
+
import { Attachable } from '../../game-entities';
|
|
3
3
|
import { ContainerAttributes } from './container-attributes';
|
|
4
4
|
import { Filters } from './filters';
|
|
5
5
|
import { Sprite } from './objects/sprite/sprite';
|
|
@@ -16,10 +16,9 @@ export declare class Container extends ContainerAttributes {
|
|
|
16
16
|
cropOverflowingParts: boolean;
|
|
17
17
|
};
|
|
18
18
|
constructor();
|
|
19
|
-
|
|
20
|
-
attach(parent: AttachmentTarget | string): this;
|
|
19
|
+
attach(parent: Attachable | string): this;
|
|
21
20
|
attachToRoot(): this;
|
|
22
|
-
|
|
21
|
+
destroy(): void;
|
|
23
22
|
getBoundingMask(): Sprite;
|
|
24
23
|
displayParent(parent: Container | string, partialOptions?: Partial<SetParentOptions>): this;
|
|
25
24
|
get boundingBox(): Rectangle;
|
|
@@ -16,10 +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 destroy function non-internal
|
|
20
|
-
destroy() {
|
|
21
|
-
super.destroy();
|
|
22
|
-
}
|
|
23
19
|
// make the attach function non-internal
|
|
24
20
|
attach(parent) {
|
|
25
21
|
super.attach(parent);
|
|
@@ -30,10 +26,12 @@ class Container extends container_attributes_1.ContainerAttributes {
|
|
|
30
26
|
super.attachToRoot();
|
|
31
27
|
return this;
|
|
32
28
|
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
29
|
+
destroy() {
|
|
30
|
+
if (!this.destroyed) {
|
|
31
|
+
Container.allContainers.delete(this.id);
|
|
32
|
+
!this.pixiContainer.destroyed && this.pixiContainer.destroy();
|
|
33
|
+
super.destroy();
|
|
34
|
+
}
|
|
37
35
|
}
|
|
38
36
|
getBoundingMask() {
|
|
39
37
|
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
|
-
|
|
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
|
-
|
|
154
|
-
|
|
155
|
-
|
|
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 = {
|
|
@@ -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
|
-
|
|
39
|
-
|
|
40
|
-
|
|
38
|
+
destroy() {
|
|
39
|
+
if (!this.destroyed) {
|
|
40
|
+
this.pixiGraphics.destroy();
|
|
41
|
+
super.destroy();
|
|
42
|
+
}
|
|
41
43
|
}
|
|
42
44
|
}
|
|
43
45
|
exports.Placeholder = Placeholder;
|
|
@@ -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
|
-
|
|
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
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
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
|
-
|
|
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
|
-
|
|
51
|
-
|
|
52
|
-
|
|
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;
|
|
@@ -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 {
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Attachable } from '../../../game-entities/base/attachable';
|
|
1
|
+
import { Attachable } from '../../../game-entities';
|
|
3
2
|
import { AnimatorAnimation } from './animations';
|
|
4
3
|
export interface AnimationState {
|
|
5
4
|
duration: number;
|
|
@@ -43,12 +42,11 @@ export declare class Animator<T> extends Attachable {
|
|
|
43
42
|
private allResolvers;
|
|
44
43
|
get isAnimating(): boolean;
|
|
45
44
|
constructor(target: T, effectOn: string | string[], options?: AnimationOptions);
|
|
46
|
-
|
|
47
|
-
attach(parent: AttachmentTarget | string): this;
|
|
45
|
+
attach(parent: Attachable | string): this;
|
|
48
46
|
attachToRoot(): this;
|
|
49
47
|
onChange(callback: (target: T) => void): Animator<T>;
|
|
50
48
|
onComplete(callback: (key: string, value: number) => void): Animator<T>;
|
|
51
|
-
|
|
49
|
+
destroy(): void;
|
|
52
50
|
getAnimationStateOfKey(key: string): AnimationState | undefined;
|
|
53
51
|
pauseAnimations(): void;
|
|
54
52
|
resumeAnimations(): void;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Animator = exports.CompleteAnimationsHandlingType = exports.ReAnimateHandlingType = void 0;
|
|
4
4
|
const helpers_lib_1 = require("helpers-lib");
|
|
5
|
-
const
|
|
5
|
+
const game_entities_1 = require("../../../game-entities");
|
|
6
6
|
const update_cycle_1 = require("../../../game-entities/update-cycle");
|
|
7
7
|
const animations_1 = require("./animations");
|
|
8
8
|
var ReAnimateHandlingType;
|
|
@@ -22,7 +22,7 @@ const DEFAULT_ANIMATION = new animations_1.AnimationLineer();
|
|
|
22
22
|
const DEFAULT_LOOP = false;
|
|
23
23
|
const DEFAULT_RE_ANIMATE_HANDLING = ReAnimateHandlingType.throwError;
|
|
24
24
|
const DEFAULT_COMPLETE_ANIMATIONS_HANDLING = CompleteAnimationsHandlingType.stayInCurrentState;
|
|
25
|
-
class Animator extends
|
|
25
|
+
class Animator extends game_entities_1.Attachable {
|
|
26
26
|
static { this.animatedObjects = new Map(); }
|
|
27
27
|
get isAnimating() {
|
|
28
28
|
return this.propertyStates.size > 0;
|
|
@@ -67,10 +67,6 @@ class Animator extends attachable_1.Attachable {
|
|
|
67
67
|
}
|
|
68
68
|
});
|
|
69
69
|
}
|
|
70
|
-
// make the destroy function non-internal
|
|
71
|
-
destroy() {
|
|
72
|
-
super.destroy();
|
|
73
|
-
}
|
|
74
70
|
// make the attach function non-internal
|
|
75
71
|
attach(parent) {
|
|
76
72
|
super.attach(parent);
|
|
@@ -97,20 +93,22 @@ class Animator extends attachable_1.Attachable {
|
|
|
97
93
|
this.onCompleteCallback = callback;
|
|
98
94
|
return this;
|
|
99
95
|
}
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
96
|
+
destroy() {
|
|
97
|
+
if (!this.destroyed) {
|
|
98
|
+
this.onChangeCallback = undefined;
|
|
99
|
+
this.onCompleteCallback = undefined;
|
|
100
|
+
this.defaultAnimation = DEFAULT_ANIMATION;
|
|
101
|
+
this.propertyStates.clear();
|
|
102
|
+
let animatedObjectProperties = Animator.animatedObjects.get(this.target);
|
|
103
|
+
this.effectOn.forEach(key => animatedObjectProperties.delete(key));
|
|
104
|
+
if (animatedObjectProperties.size <= 0) {
|
|
105
|
+
Animator.animatedObjects.delete(this.target);
|
|
106
|
+
}
|
|
107
|
+
this.target = undefined;
|
|
108
|
+
this.allResolvers.forEach(resolver => resolver());
|
|
109
|
+
this.allResolvers.clear();
|
|
110
|
+
super.destroy();
|
|
110
111
|
}
|
|
111
|
-
this.target = undefined;
|
|
112
|
-
this.allResolvers.forEach(resolver => resolver());
|
|
113
|
-
this.allResolvers.clear();
|
|
114
112
|
}
|
|
115
113
|
getAnimationStateOfKey(key) {
|
|
116
114
|
let propertyState = this.propertyStates.get(key);
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Attachable } from '../../../../game-entities';
|
|
2
2
|
import { StateAnimationOptions } from './state-animation';
|
|
3
3
|
export declare enum SlideStateAnimationState {
|
|
4
4
|
appear = "appear",
|
|
5
5
|
disappear = "disappear"
|
|
6
6
|
}
|
|
7
|
-
export declare class SlideStateAnimation extends
|
|
7
|
+
export declare class SlideStateAnimation extends Attachable {
|
|
8
8
|
private stateAnimation;
|
|
9
9
|
private options;
|
|
10
10
|
private index;
|
|
@@ -11,7 +11,7 @@ var SlideStateAnimationState;
|
|
|
11
11
|
SlideStateAnimationState["appear"] = "appear";
|
|
12
12
|
SlideStateAnimationState["disappear"] = "disappear";
|
|
13
13
|
})(SlideStateAnimationState || (exports.SlideStateAnimationState = SlideStateAnimationState = {}));
|
|
14
|
-
class SlideStateAnimation extends game_entities_1.
|
|
14
|
+
class SlideStateAnimation extends game_entities_1.Attachable {
|
|
15
15
|
constructor(partialOptions) {
|
|
16
16
|
super();
|
|
17
17
|
this.animationState = 'idle';
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Attachable } from '../../../../game-entities';
|
|
2
2
|
import { AnimatorAnimation } from '../animations';
|
|
3
3
|
export interface StateAnimationOptions {
|
|
4
4
|
readonly duration: number;
|
|
5
5
|
readonly animation: AnimatorAnimation;
|
|
6
6
|
}
|
|
7
7
|
type AnimationState = 'idle' | 'transitioning' | 'reverting';
|
|
8
|
-
export declare class StateAnimation<T> extends
|
|
8
|
+
export declare class StateAnimation<T> extends Attachable {
|
|
9
9
|
private animator;
|
|
10
10
|
private options;
|
|
11
11
|
private value;
|