bard-legends-framework 0.10.1 → 0.10.3
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/destroyable.d.ts +1 -1
- package/dist/game-entities/base/destroyable.js +1 -1
- package/dist/game-entities/base/helpers/decorate-actions-lib.d.ts +2 -2
- package/dist/game-entities/base/helpers/decorate-actions-lib.js +3 -3
- package/dist/game-entities/entity/entity.d.ts +2 -9
- package/dist/game-entities/entity/entity.js +13 -21
- package/dist/game-entities/entity/helpers/entity-views.helper.d.ts +1 -0
- package/dist/game-entities/entity/helpers/entity-views.helper.js +8 -11
- package/dist/game-entities/entity/singleton-entity.js +3 -3
- package/dist/game-entities/scene/scene.d.ts +0 -4
- package/dist/game-entities/scene/scene.js +2 -19
- package/dist/game-entities/update-cycle.js +1 -1
- package/dist/game-entities/view/view.d.ts +3 -8
- package/dist/game-entities/view/view.js +18 -57
- package/dist/game-entities/view/view.test.js +50 -109
- package/dist/physics/module//360/237/223/220services/test-visuals/test-visuals.service.js +6 -6
- package/dist/pixi/components/helpers/smooth-scroller.test.js +5 -5
- package/dist/pixi/display-object/objects/graphics/graphics.js +1 -1
- package/dist/pixi/game.js +1 -2
- package/dist/pixi/modules/CAMERA/camera.d.ts +0 -1
- package/dist/pixi/modules/CAMERA/camera.js +1 -4
- package/dist/pixi/modules/CAMERA//342/232/234/357/270/217gateways/camera-view.gateway.d.ts +1 -1
- package/dist/pixi/modules/CAMERA//342/232/234/357/270/217gateways/camera-view.gateway.js +1 -1
- package/dist/pixi/modules/CAMERA//342/232/234/357/270/217gateways/controllers/camera-view.controller.d.ts +1 -1
- package/dist/pixi/modules/CAMERA//342/232/234/357/270/217gateways/controllers/camera-view.controller.js +3 -3
- package/dist/pixi/modules/CAMERA//360/237/223/220services/camera.service.js +2 -1
- package/dist/pixi/modules/CAMERA//360/237/247/212entities/camera.entity.js +1 -1
- package/dist/pixi/modules/CAMERA//360/237/247/251views/camera.view.d.ts +0 -1
- package/dist/pixi/modules/CAMERA//360/237/247/251views/camera.view.js +0 -2
- package/dist/pixi/services/keyboard/keyboard.js +1 -1
- package/dist/pixi/services/mouse/mouse-target-focus.service.js +1 -1
- package/dist/pixi/services/mouse/mouse.service.js +2 -2
- package/dist/utilities/libraries/animator/animator.js +9 -9
- package/dist/utilities/libraries/animator/animator.test.js +66 -66
- package/dist/utilities/libraries/animator/state-animation/slide-state-animation.test.js +1 -1
- package/dist/utilities/libraries/animator/state-animation/state-animation.test.js +3 -3
- package/dist/utilities/libraries/animator/state-animation/visit-disappear-state-animation.test.js +1 -1
- package/package.json +1 -1
|
@@ -268,7 +268,7 @@ decorate_actions_lib_1.ActionsLibDecorator.decorate(ActionsLib);
|
|
|
268
268
|
], SampleView);
|
|
269
269
|
(0, vitest_1.expect)(SampleView.test).toEqual('test');
|
|
270
270
|
});
|
|
271
|
-
(0, vitest_1.test)('getInstance should wait until creation and return the view object after',
|
|
271
|
+
(0, vitest_1.test)('getInstance should wait until creation and return the view object after', () => {
|
|
272
272
|
var SampleView_4;
|
|
273
273
|
let BaseEntity = class BaseEntity extends entity_1.Entity {
|
|
274
274
|
};
|
|
@@ -287,7 +287,7 @@ decorate_actions_lib_1.ActionsLibDecorator.decorate(ActionsLib);
|
|
|
287
287
|
__metadata("design:paramtypes", [BaseEntity])
|
|
288
288
|
], SampleView);
|
|
289
289
|
let baseEntity = new BaseEntity().attach(scene_1.Scene.getActiveSceneOrFail());
|
|
290
|
-
let view =
|
|
290
|
+
let view = SampleView.getInstance(baseEntity.id);
|
|
291
291
|
(0, vitest_1.expect)(SampleView.instance).toBeDefined();
|
|
292
292
|
(0, vitest_1.expect)(SampleView.instance).toEqual(view);
|
|
293
293
|
});
|
|
@@ -312,15 +312,11 @@ decorate_actions_lib_1.ActionsLibDecorator.decorate(ActionsLib);
|
|
|
312
312
|
let baseEntity = new BaseEntity().attach(scene_1.Scene.getActiveSceneOrFail());
|
|
313
313
|
baseEntity.destroy();
|
|
314
314
|
await update_cycle_1.UpdateCycle.triggerUpdateTick(1); // Update cycle should take place to destroy functions to be called
|
|
315
|
-
let view;
|
|
316
|
-
SampleView.getInstance(baseEntity.id).then(response => {
|
|
317
|
-
view = response;
|
|
318
|
-
});
|
|
319
|
-
await (0, helpers_lib_1.Wait)();
|
|
315
|
+
let view = SampleView.getInstance(baseEntity.id);
|
|
320
316
|
(0, vitest_1.expect)(SampleView.instance).toBeDefined();
|
|
321
317
|
(0, vitest_1.expect)(view).toBe(undefined);
|
|
322
318
|
});
|
|
323
|
-
(0, vitest_1.test)('getInstanceOrFail should wait until creation and return the view object after',
|
|
319
|
+
(0, vitest_1.test)('getInstanceOrFail should wait until creation and return the view object after', () => {
|
|
324
320
|
var SampleView_6;
|
|
325
321
|
let BaseEntity = class BaseEntity extends entity_1.Entity {
|
|
326
322
|
};
|
|
@@ -339,11 +335,11 @@ decorate_actions_lib_1.ActionsLibDecorator.decorate(ActionsLib);
|
|
|
339
335
|
__metadata("design:paramtypes", [BaseEntity])
|
|
340
336
|
], SampleView);
|
|
341
337
|
let baseEntity = new BaseEntity().attach(scene_1.Scene.getActiveSceneOrFail());
|
|
342
|
-
let view =
|
|
338
|
+
let view = SampleView.getInstanceOrFail(baseEntity.id);
|
|
343
339
|
(0, vitest_1.expect)(SampleView.instance).toBeDefined();
|
|
344
340
|
(0, vitest_1.expect)(SampleView.instance).toEqual(view);
|
|
345
341
|
});
|
|
346
|
-
(0, vitest_1.test)('should wait until creation and return the view object after in other views init',
|
|
342
|
+
(0, vitest_1.test)('should wait until creation and return the view object after in other views init', () => {
|
|
347
343
|
var SampleView1_1;
|
|
348
344
|
let BaseEntity = class BaseEntity extends entity_1.Entity {
|
|
349
345
|
};
|
|
@@ -356,7 +352,7 @@ decorate_actions_lib_1.ActionsLibDecorator.decorate(ActionsLib);
|
|
|
356
352
|
this.entity = entity;
|
|
357
353
|
}
|
|
358
354
|
async init() {
|
|
359
|
-
let view =
|
|
355
|
+
let view = SampleView1.getInstanceOrFail(this.entity.id);
|
|
360
356
|
(0, vitest_1.expect)(SampleView1.instance).toBeDefined();
|
|
361
357
|
(0, vitest_1.expect)(SampleView1.instance).toEqual(view);
|
|
362
358
|
}
|
|
@@ -381,7 +377,7 @@ decorate_actions_lib_1.ActionsLibDecorator.decorate(ActionsLib);
|
|
|
381
377
|
], SampleView1);
|
|
382
378
|
new BaseEntity().attach(scene_1.Scene.getActiveSceneOrFail());
|
|
383
379
|
});
|
|
384
|
-
(0, vitest_1.test)('should wait until creation and return the view object after, case entity get created before the view definition',
|
|
380
|
+
(0, vitest_1.test)('should wait until creation and return the view object after, case entity get created before the view definition', () => {
|
|
385
381
|
var SampleView_7;
|
|
386
382
|
let BaseEntity = class BaseEntity extends entity_1.Entity {
|
|
387
383
|
};
|
|
@@ -400,69 +396,17 @@ decorate_actions_lib_1.ActionsLibDecorator.decorate(ActionsLib);
|
|
|
400
396
|
(0, view_1.ViewDecorator)({ entity: BaseEntity }),
|
|
401
397
|
__metadata("design:paramtypes", [BaseEntity])
|
|
402
398
|
], SampleView);
|
|
403
|
-
let view =
|
|
399
|
+
let view = SampleView.getInstanceOrFail(baseEntity.id);
|
|
404
400
|
(0, vitest_1.expect)(SampleView.instance).toBeDefined();
|
|
405
401
|
(0, vitest_1.expect)(SampleView.instance).toEqual(view);
|
|
406
402
|
});
|
|
407
|
-
(0, vitest_1.test)('should
|
|
403
|
+
(0, vitest_1.test)('should throw error if the entity id is belonging to another entity', () => {
|
|
408
404
|
var SampleView_8;
|
|
409
405
|
let BaseEntity = class BaseEntity extends entity_1.Entity {
|
|
410
406
|
};
|
|
411
407
|
BaseEntity = __decorate([
|
|
412
408
|
(0, entity_1.EntityDecorator)()
|
|
413
409
|
], BaseEntity);
|
|
414
|
-
let SampleView = class SampleView extends view_1.View {
|
|
415
|
-
static { SampleView_8 = this; }
|
|
416
|
-
constructor(entity) {
|
|
417
|
-
super();
|
|
418
|
-
}
|
|
419
|
-
async init() {
|
|
420
|
-
await (0, helpers_lib_1.Wait)();
|
|
421
|
-
SampleView_8.instance = this;
|
|
422
|
-
}
|
|
423
|
-
};
|
|
424
|
-
SampleView = SampleView_8 = __decorate([
|
|
425
|
-
(0, view_1.ViewDecorator)({ entity: BaseEntity }),
|
|
426
|
-
__metadata("design:paramtypes", [BaseEntity])
|
|
427
|
-
], SampleView);
|
|
428
|
-
let baseEntity = new BaseEntity().attach(scene_1.Scene.getActiveSceneOrFail());
|
|
429
|
-
let view = await SampleView.getInstanceOrFail(baseEntity.id);
|
|
430
|
-
(0, vitest_1.expect)(SampleView.instance).toBeDefined();
|
|
431
|
-
(0, vitest_1.expect)(SampleView.instance).toEqual(view);
|
|
432
|
-
});
|
|
433
|
-
(0, vitest_1.test)('should wait until creation and return the view object after when there is an async init, case entity get created before the view definition', async () => {
|
|
434
|
-
var SampleView_9;
|
|
435
|
-
let BaseEntity = class BaseEntity extends entity_1.Entity {
|
|
436
|
-
};
|
|
437
|
-
BaseEntity = __decorate([
|
|
438
|
-
(0, entity_1.EntityDecorator)()
|
|
439
|
-
], BaseEntity);
|
|
440
|
-
let baseEntity = new BaseEntity().attach(scene_1.Scene.getActiveSceneOrFail());
|
|
441
|
-
let SampleView = class SampleView extends view_1.View {
|
|
442
|
-
static { SampleView_9 = this; }
|
|
443
|
-
constructor(entity) {
|
|
444
|
-
super();
|
|
445
|
-
}
|
|
446
|
-
async init() {
|
|
447
|
-
await (0, helpers_lib_1.Wait)();
|
|
448
|
-
SampleView_9.instance = this;
|
|
449
|
-
}
|
|
450
|
-
};
|
|
451
|
-
SampleView = SampleView_9 = __decorate([
|
|
452
|
-
(0, view_1.ViewDecorator)({ entity: BaseEntity }),
|
|
453
|
-
__metadata("design:paramtypes", [BaseEntity])
|
|
454
|
-
], SampleView);
|
|
455
|
-
let view = await SampleView.getInstanceOrFail(baseEntity.id);
|
|
456
|
-
(0, vitest_1.expect)(SampleView.instance).toBeDefined();
|
|
457
|
-
(0, vitest_1.expect)(SampleView.instance).toEqual(view);
|
|
458
|
-
});
|
|
459
|
-
(0, vitest_1.test)('should throw error if the entity id is belonging to another entity', async () => {
|
|
460
|
-
var SampleView_10;
|
|
461
|
-
let BaseEntity = class BaseEntity extends entity_1.Entity {
|
|
462
|
-
};
|
|
463
|
-
BaseEntity = __decorate([
|
|
464
|
-
(0, entity_1.EntityDecorator)()
|
|
465
|
-
], BaseEntity);
|
|
466
410
|
let baseEntity = new BaseEntity().attach(scene_1.Scene.getActiveSceneOrFail());
|
|
467
411
|
let SampleEntity = class SampleEntity extends entity_1.Entity {
|
|
468
412
|
};
|
|
@@ -471,53 +415,20 @@ decorate_actions_lib_1.ActionsLibDecorator.decorate(ActionsLib);
|
|
|
471
415
|
], SampleEntity);
|
|
472
416
|
let sampleEntity = new SampleEntity().attach(baseEntity);
|
|
473
417
|
let SampleView = class SampleView extends view_1.View {
|
|
474
|
-
static {
|
|
418
|
+
static { SampleView_8 = this; }
|
|
475
419
|
constructor(entity) {
|
|
476
420
|
super();
|
|
477
|
-
|
|
421
|
+
SampleView_8.instance = this;
|
|
478
422
|
}
|
|
479
423
|
};
|
|
480
|
-
SampleView =
|
|
424
|
+
SampleView = SampleView_8 = __decorate([
|
|
481
425
|
(0, view_1.ViewDecorator)({ entity: BaseEntity }),
|
|
482
426
|
__metadata("design:paramtypes", [BaseEntity])
|
|
483
427
|
], SampleView);
|
|
484
|
-
(0, vitest_1.expect)(async () =>
|
|
485
|
-
});
|
|
486
|
-
(0, vitest_1.test)('update tick should not update view until creation is complete', () => {
|
|
487
|
-
var SampleView_11;
|
|
488
|
-
let viewUpdateCount = 0;
|
|
489
|
-
let Sample = class Sample extends entity_1.Entity {
|
|
490
|
-
};
|
|
491
|
-
Sample = __decorate([
|
|
492
|
-
(0, entity_1.EntityDecorator)()
|
|
493
|
-
], Sample);
|
|
494
|
-
let SampleView = class SampleView extends view_1.View {
|
|
495
|
-
static { SampleView_11 = this; }
|
|
496
|
-
constructor(entity) {
|
|
497
|
-
super();
|
|
498
|
-
SampleView_11.instance = this;
|
|
499
|
-
}
|
|
500
|
-
async init() {
|
|
501
|
-
await (0, helpers_lib_1.Wait)();
|
|
502
|
-
}
|
|
503
|
-
update() {
|
|
504
|
-
viewUpdateCount++;
|
|
505
|
-
}
|
|
506
|
-
};
|
|
507
|
-
SampleView = SampleView_11 = __decorate([
|
|
508
|
-
(0, view_1.ViewDecorator)({ entity: Sample }),
|
|
509
|
-
__metadata("design:paramtypes", [Sample])
|
|
510
|
-
], SampleView);
|
|
511
|
-
new Sample().attach(scene_1.Scene.getActiveSceneOrFail());
|
|
512
|
-
(0, vitest_1.expect)(viewUpdateCount).toEqual(0);
|
|
513
|
-
update_cycle_1.UpdateCycle.triggerUpdateTick(1);
|
|
514
|
-
(0, vitest_1.expect)(viewUpdateCount).toEqual(0);
|
|
515
|
-
SampleView.instance['afterInit']();
|
|
516
|
-
update_cycle_1.UpdateCycle.triggerUpdateTick(1);
|
|
517
|
-
(0, vitest_1.expect)(viewUpdateCount).toEqual(1);
|
|
428
|
+
(0, vitest_1.expect)(async () => SampleView.getInstanceOrFail(sampleEntity.id)).rejects.toThrow();
|
|
518
429
|
});
|
|
519
430
|
(0, vitest_1.test)('destroying entity should not prevent subscription of the view', async () => {
|
|
520
|
-
var Sample_1,
|
|
431
|
+
var Sample_1, SampleView_9;
|
|
521
432
|
let sampleAction = new actions_lib_1.Action();
|
|
522
433
|
let Sample = class Sample extends entity_1.Entity {
|
|
523
434
|
static { Sample_1 = this; }
|
|
@@ -537,20 +448,18 @@ decorate_actions_lib_1.ActionsLibDecorator.decorate(ActionsLib);
|
|
|
537
448
|
__metadata("design:paramtypes", [])
|
|
538
449
|
], Sample);
|
|
539
450
|
let SampleView = class SampleView extends view_1.View {
|
|
540
|
-
static {
|
|
451
|
+
static { SampleView_9 = this; }
|
|
541
452
|
static { this.triggered = false; }
|
|
542
453
|
constructor(entity) {
|
|
543
454
|
super();
|
|
544
|
-
}
|
|
545
|
-
async init() {
|
|
546
455
|
sampleAction
|
|
547
456
|
.subscribe(() => {
|
|
548
|
-
|
|
457
|
+
SampleView_9.triggered = true;
|
|
549
458
|
})
|
|
550
459
|
.attach(this);
|
|
551
460
|
}
|
|
552
461
|
};
|
|
553
|
-
SampleView =
|
|
462
|
+
SampleView = SampleView_9 = __decorate([
|
|
554
463
|
(0, view_1.ViewDecorator)({ entity: Sample }),
|
|
555
464
|
__metadata("design:paramtypes", [Sample])
|
|
556
465
|
], SampleView);
|
|
@@ -559,5 +468,37 @@ decorate_actions_lib_1.ActionsLibDecorator.decorate(ActionsLib);
|
|
|
559
468
|
(0, vitest_1.expect)(Sample.triggered).toEqual(true);
|
|
560
469
|
(0, vitest_1.expect)(SampleView.triggered).toEqual(true);
|
|
561
470
|
});
|
|
471
|
+
(0, vitest_1.test)('if view destroys the entity, the view should also be destroyed', async () => {
|
|
472
|
+
var Sample_2, SampleView_10;
|
|
473
|
+
let Sample = class Sample extends entity_1.Entity {
|
|
474
|
+
static { Sample_2 = this; }
|
|
475
|
+
static { this.destroyed = false; }
|
|
476
|
+
afterDestroy() {
|
|
477
|
+
Sample_2.destroyed = true;
|
|
478
|
+
}
|
|
479
|
+
};
|
|
480
|
+
Sample = Sample_2 = __decorate([
|
|
481
|
+
(0, entity_1.EntityDecorator)()
|
|
482
|
+
], Sample);
|
|
483
|
+
let SampleView = class SampleView extends view_1.View {
|
|
484
|
+
static { SampleView_10 = this; }
|
|
485
|
+
static { this.destroyed = false; }
|
|
486
|
+
constructor(entity) {
|
|
487
|
+
super();
|
|
488
|
+
entity.destroy();
|
|
489
|
+
}
|
|
490
|
+
afterDestroy() {
|
|
491
|
+
SampleView_10.destroyed = true;
|
|
492
|
+
}
|
|
493
|
+
};
|
|
494
|
+
SampleView = SampleView_10 = __decorate([
|
|
495
|
+
(0, view_1.ViewDecorator)({ entity: Sample }),
|
|
496
|
+
__metadata("design:paramtypes", [Sample])
|
|
497
|
+
], SampleView);
|
|
498
|
+
new Sample().attach(scene_1.Scene.getActiveSceneOrFail());
|
|
499
|
+
await update_cycle_1.UpdateCycle.triggerUpdateTick(1); // Update cycle should take place to destroy functions to be called
|
|
500
|
+
(0, vitest_1.expect)(Sample.destroyed).toEqual(true);
|
|
501
|
+
(0, vitest_1.expect)(SampleView.destroyed).toEqual(true);
|
|
502
|
+
});
|
|
562
503
|
});
|
|
563
504
|
//# sourceMappingURL=view.test.js.map
|
|
@@ -51,7 +51,7 @@ let TestVisualsService = class TestVisualsService {
|
|
|
51
51
|
.setRotation(direction)
|
|
52
52
|
.attach(physicsWorldId);
|
|
53
53
|
}
|
|
54
|
-
let animator = new utilities_1.Animator(sprite, 'alpha', { duration: 1000, animation: new utilities_1.AnimationEaseIn() }).
|
|
54
|
+
let animator = new utilities_1.Animator(sprite, 'alpha', { duration: 1000, animation: new utilities_1.AnimationEaseIn() }).attachToRoot();
|
|
55
55
|
animator.animate({ alpha: 0 }).then(() => {
|
|
56
56
|
sprite.destroy();
|
|
57
57
|
animator.destroy();
|
|
@@ -71,7 +71,7 @@ let TestVisualsService = class TestVisualsService {
|
|
|
71
71
|
let color = ray.hits.length > 0 ? helpers_lib_1.ColorHelper.red : helpers_lib_1.ColorHelper.white;
|
|
72
72
|
pixi_1.Graphics.createVector(explosionCenter, ray.line.to, color).toSprite().displayParent(lineContainer).attach(physicsWorld);
|
|
73
73
|
});
|
|
74
|
-
let animator = new utilities_1.Animator(lineContainer, 'alpha', { duration, animation: new utilities_1.AnimationEaseIn() }).
|
|
74
|
+
let animator = new utilities_1.Animator(lineContainer, 'alpha', { duration, animation: new utilities_1.AnimationEaseIn() }).attachToRoot();
|
|
75
75
|
animator.animate({ alpha: 0 }).then(() => {
|
|
76
76
|
lineContainer.destroy();
|
|
77
77
|
animator.destroy();
|
|
@@ -90,7 +90,7 @@ let TestVisualsService = class TestVisualsService {
|
|
|
90
90
|
let color = ray.hits.length > 0 ? helpers_lib_1.ColorHelper.red : helpers_lib_1.ColorHelper.white;
|
|
91
91
|
pixi_1.Graphics.createVector(ray.line.from, ray.line.to, color).toSprite().displayParent(lineContainer).attach(physicsWorld);
|
|
92
92
|
});
|
|
93
|
-
let animator = new utilities_1.Animator(lineContainer, 'alpha', { duration, animation: new utilities_1.AnimationEaseIn() }).
|
|
93
|
+
let animator = new utilities_1.Animator(lineContainer, 'alpha', { duration, animation: new utilities_1.AnimationEaseIn() }).attachToRoot();
|
|
94
94
|
animator.animate({ alpha: 0 }).then(() => {
|
|
95
95
|
lineContainer.destroy();
|
|
96
96
|
animator.destroy();
|
|
@@ -105,12 +105,12 @@ let TestVisualsService = class TestVisualsService {
|
|
|
105
105
|
.setPosition(position, { round: false })
|
|
106
106
|
.setRotation(rotation)
|
|
107
107
|
.setAlpha(0.5)
|
|
108
|
-
.
|
|
108
|
+
.attachToRoot();
|
|
109
109
|
p2Body.shapes.forEach(shape => {
|
|
110
110
|
let displayObject = this.drawShape(shape, color);
|
|
111
|
-
displayObject.displayParent(container).
|
|
111
|
+
displayObject.displayParent(container).attachToRoot();
|
|
112
112
|
});
|
|
113
|
-
let animator = new utilities_1.Animator(container, 'alpha', { duration: 1000, animation: new utilities_1.AnimationEaseIn() }).
|
|
113
|
+
let animator = new utilities_1.Animator(container, 'alpha', { duration: 1000, animation: new utilities_1.AnimationEaseIn() }).attachToRoot();
|
|
114
114
|
animator.animate({ alpha: 0 }).then(() => {
|
|
115
115
|
container.destroy();
|
|
116
116
|
animator.destroy();
|
|
@@ -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').attachToRoot();
|
|
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').attachToRoot();
|
|
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').attachToRoot();
|
|
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').attachToRoot();
|
|
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').attachToRoot();
|
|
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);
|
|
@@ -171,7 +171,7 @@ class Graphics extends container_1.Container {
|
|
|
171
171
|
destroyAssetOnDestroy: !options.cache
|
|
172
172
|
};
|
|
173
173
|
let sprite = new sprite_1.Sprite(spriteDefinition, { texturePosition: textureConversion.bounds, ignoreAnchor: true });
|
|
174
|
-
this.
|
|
174
|
+
this.attachToRoot();
|
|
175
175
|
this.destroy();
|
|
176
176
|
return sprite;
|
|
177
177
|
}
|
package/dist/pixi/game.js
CHANGED
|
@@ -75,7 +75,7 @@ class Game {
|
|
|
75
75
|
await Promise.all([game_assets_1.GameAssets.loadGameAssets(assetDefinitions)]);
|
|
76
76
|
Game._instance = this;
|
|
77
77
|
// @ts-ignore
|
|
78
|
-
this.stage = new _1.Container().
|
|
78
|
+
this.stage = new _1.Container().attachToRoot();
|
|
79
79
|
// @ts-ignore
|
|
80
80
|
this.stage.pixiContainer = this.pixiApp.stage;
|
|
81
81
|
// @ts-ignore
|
|
@@ -90,7 +90,6 @@ class Game {
|
|
|
90
90
|
setTimeout(() => this.setScreenSize());
|
|
91
91
|
});
|
|
92
92
|
Game._camera = new camera_1.Camera();
|
|
93
|
-
await Game._camera.setup();
|
|
94
93
|
this.pixiApp.start();
|
|
95
94
|
this.pixiApp.ticker.add(() => {
|
|
96
95
|
update_cycle_1.UpdateCycle.triggerUpdateTick(this.pixiApp.ticker.deltaMS);
|
|
@@ -6,7 +6,6 @@ export declare class Camera {
|
|
|
6
6
|
private cameraViewGateway;
|
|
7
7
|
get position(): Vector;
|
|
8
8
|
constructor();
|
|
9
|
-
setup(): Promise<void>;
|
|
10
9
|
setPosition(position: Vector): void;
|
|
11
10
|
setTransition(options: FocusingOptions): void;
|
|
12
11
|
appear(on: boolean, type?: CameraAppearTransitionType): Promise<void>;
|
|
@@ -11,10 +11,7 @@ class Camera {
|
|
|
11
11
|
this.cameraGateway = game_entities_1.Service.get(__gateways_1.CameraGateway);
|
|
12
12
|
this.cameraViewGateway = game_entities_1.Service.get(__gateways_1.CameraViewGateway);
|
|
13
13
|
this.cameraGateway.createCamera();
|
|
14
|
-
|
|
15
|
-
async setup() {
|
|
16
|
-
// @ts-ignore
|
|
17
|
-
this.layers = await this.cameraViewGateway.getLayers();
|
|
14
|
+
this.layers = this.cameraViewGateway.getLayers();
|
|
18
15
|
}
|
|
19
16
|
setPosition(position) {
|
|
20
17
|
this.cameraGateway.setPosition(position);
|
|
@@ -2,6 +2,6 @@ import { ControllerLink } from '../../../../game-entities';
|
|
|
2
2
|
import { CameraAppearTransitionType, CameraLayer } from './dtos/requests.dto';
|
|
3
3
|
export declare const CameraViewControllerLink: ControllerLink;
|
|
4
4
|
export declare class CameraViewGateway {
|
|
5
|
-
getLayers():
|
|
5
|
+
getLayers(): Record<CameraLayer, string>;
|
|
6
6
|
appear(on: boolean, type: CameraAppearTransitionType): Promise<void>;
|
|
7
7
|
}
|
|
@@ -10,7 +10,7 @@ exports.CameraViewGateway = exports.CameraViewControllerLink = void 0;
|
|
|
10
10
|
const game_entities_1 = require("../../../../game-entities");
|
|
11
11
|
exports.CameraViewControllerLink = new game_entities_1.ControllerLink();
|
|
12
12
|
let CameraViewGateway = class CameraViewGateway {
|
|
13
|
-
|
|
13
|
+
getLayers() {
|
|
14
14
|
return exports.CameraViewControllerLink.trigger('getLayers');
|
|
15
15
|
}
|
|
16
16
|
async appear(on, type) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CameraAppearTransitionType, CameraLayer } from '../dtos/requests.dto';
|
|
2
2
|
export declare class CameraViewController {
|
|
3
|
-
getLayers():
|
|
3
|
+
getLayers(): Record<CameraLayer, string>;
|
|
4
4
|
appear(on: boolean, type: CameraAppearTransitionType): Promise<void>;
|
|
5
5
|
}
|
|
@@ -12,14 +12,14 @@ const camera_entity_1 = require("../../\uD83E\uDDCAentities/camera.entity");
|
|
|
12
12
|
const camera_view_1 = require("../../\uD83E\uDDE9views/camera.view");
|
|
13
13
|
const camera_view_gateway_1 = require("../camera-view.gateway");
|
|
14
14
|
let CameraViewController = class CameraViewController {
|
|
15
|
-
|
|
15
|
+
getLayers() {
|
|
16
16
|
let cameraEntityId = camera_entity_1.CameraEntity.getInstanceOrFail().id;
|
|
17
|
-
let cameraView =
|
|
17
|
+
let cameraView = camera_view_1.CameraView.getInstanceOrFail(cameraEntityId);
|
|
18
18
|
return cameraView.getLayers();
|
|
19
19
|
}
|
|
20
20
|
async appear(on, type) {
|
|
21
21
|
let cameraEntityId = camera_entity_1.CameraEntity.getInstanceOrFail().id;
|
|
22
|
-
let cameraView =
|
|
22
|
+
let cameraView = camera_view_1.CameraView.getInstanceOrFail(cameraEntityId);
|
|
23
23
|
return cameraView.appear(on, type);
|
|
24
24
|
}
|
|
25
25
|
};
|
|
@@ -16,7 +16,8 @@ const camera_entity_1 = require("../\uD83E\uDDCAentities/camera.entity");
|
|
|
16
16
|
const FOCUS_ANIMATION_DURATION = 1500;
|
|
17
17
|
let CameraService = class CameraService {
|
|
18
18
|
createCamera() {
|
|
19
|
-
|
|
19
|
+
let cameraEntity = new camera_entity_1.CameraEntity().attachToRoot();
|
|
20
|
+
return cameraEntity;
|
|
20
21
|
}
|
|
21
22
|
getCameraPosition() {
|
|
22
23
|
let cameraEntity = camera_entity_1.CameraEntity.getInstanceOrFail();
|
|
@@ -21,6 +21,6 @@ let CameraEntity = class CameraEntity extends game_entities_1.SingletonEntity {
|
|
|
21
21
|
};
|
|
22
22
|
exports.CameraEntity = CameraEntity;
|
|
23
23
|
exports.CameraEntity = CameraEntity = __decorate([
|
|
24
|
-
(0, game_entities_1.EntityDecorator)(
|
|
24
|
+
(0, game_entities_1.EntityDecorator)()
|
|
25
25
|
], CameraEntity);
|
|
26
26
|
//# sourceMappingURL=camera.entity.js.map
|
|
@@ -15,7 +15,6 @@ export declare class CameraView extends View {
|
|
|
15
15
|
private alphaAnimator;
|
|
16
16
|
private blackScreenAnimator;
|
|
17
17
|
constructor(entity: CameraEntity);
|
|
18
|
-
init(): Promise<void>;
|
|
19
18
|
protected destroySelf(): void;
|
|
20
19
|
getLayers(): Record<CameraLayer, string>;
|
|
21
20
|
appear(value: boolean, type: CameraAppearTransitionType): Promise<void>;
|
|
@@ -46,8 +46,6 @@ let CameraView = class CameraView extends game_entities_1.View {
|
|
|
46
46
|
reAnimateHandling: utilities_1.ReAnimateHandlingType.completePrevious,
|
|
47
47
|
completeAnimationsHandling: utilities_1.CompleteAnimationsHandlingType.stayInCurrentState
|
|
48
48
|
}).attach(this);
|
|
49
|
-
}
|
|
50
|
-
async init() {
|
|
51
49
|
game_1.Game.instance.screenSize
|
|
52
50
|
.subscribe(value => {
|
|
53
51
|
this.blackScreen.aspectRatio = value.x / value.y;
|
|
@@ -31,7 +31,7 @@ let MouseTargetFocusService = class MouseTargetFocusService {
|
|
|
31
31
|
this._lastFocusedPosition = undefined;
|
|
32
32
|
update_cycle_1.UpdateCycle.beforeSceneUpdateAction
|
|
33
33
|
.subscribe((event) => this.update(event.delta))
|
|
34
|
-
.
|
|
34
|
+
.attachToRoot();
|
|
35
35
|
}
|
|
36
36
|
update(delta) {
|
|
37
37
|
if (this.mouseStagePositionPrevious) {
|
|
@@ -54,7 +54,7 @@ let MouseService = class MouseService {
|
|
|
54
54
|
.subscribe(() => {
|
|
55
55
|
this.screenPosition.value = mouseScreenPosition;
|
|
56
56
|
})
|
|
57
|
-
.
|
|
57
|
+
.attachToRoot();
|
|
58
58
|
update_cycle_1.UpdateCycle.afterSceneUpdateAction
|
|
59
59
|
.subscribe(() => {
|
|
60
60
|
let newStagePosition = __1.Game.instance.screenPositonToStagePosition(this.screenPosition.value);
|
|
@@ -70,7 +70,7 @@ let MouseService = class MouseService {
|
|
|
70
70
|
this.stagePosition.value = newStagePosition;
|
|
71
71
|
}
|
|
72
72
|
})
|
|
73
|
-
.
|
|
73
|
+
.attachToRoot();
|
|
74
74
|
}
|
|
75
75
|
};
|
|
76
76
|
exports.MouseService = MouseService;
|
|
@@ -34,7 +34,7 @@ class Animator extends destroyable_1.Destroyable {
|
|
|
34
34
|
this.running = true;
|
|
35
35
|
this.propertyStates = new Map();
|
|
36
36
|
if (!helpers_lib_1.Comparator.isObject(target)) {
|
|
37
|
-
this.
|
|
37
|
+
this.attachToRoot();
|
|
38
38
|
throw new Error(`Animator: target is not an object! Target: "${target}"`);
|
|
39
39
|
}
|
|
40
40
|
this.effectOn = helpers_lib_1.Comparator.isArray(effectOn) ? new Set(effectOn) : new Set([effectOn]);
|
|
@@ -45,7 +45,7 @@ class Animator extends destroyable_1.Destroyable {
|
|
|
45
45
|
}
|
|
46
46
|
this.effectOn.forEach(key => {
|
|
47
47
|
if (animatedObjectProperties.has(key)) {
|
|
48
|
-
this.
|
|
48
|
+
this.attachToRoot();
|
|
49
49
|
throw new Error(`Animator: target property is already animated! Target: "${JSON.stringify(target, undefined, 2)}", Property: "${key}"`);
|
|
50
50
|
}
|
|
51
51
|
animatedObjectProperties.add(key);
|
|
@@ -57,18 +57,18 @@ class Animator extends destroyable_1.Destroyable {
|
|
|
57
57
|
this.defaultCompleteAnimationsHandling = options.completeAnimationsHandling ?? DEFAULT_COMPLETE_ANIMATIONS_HANDLING;
|
|
58
58
|
this.effectOn.forEach(key => {
|
|
59
59
|
if (!helpers_lib_1.Comparator.hasProperty(target, key)) {
|
|
60
|
-
this.
|
|
60
|
+
this.attachToRoot();
|
|
61
61
|
throw new Error(`Animator: target does not have property. Target property: "${key}"`);
|
|
62
62
|
}
|
|
63
63
|
else if (!helpers_lib_1.Comparator.isNumber(target[key])) {
|
|
64
|
-
this.
|
|
64
|
+
this.attachToRoot();
|
|
65
65
|
throw new Error(`Animator: target property is not a number. Target property: "${key}"`);
|
|
66
66
|
}
|
|
67
67
|
});
|
|
68
68
|
}
|
|
69
69
|
onChange(callback) {
|
|
70
70
|
if (this.onChangeCallback) {
|
|
71
|
-
this.
|
|
71
|
+
this.attachToRoot();
|
|
72
72
|
throw new Error('Animator: onChangeCallback is already set!');
|
|
73
73
|
}
|
|
74
74
|
this.onChangeCallback = callback;
|
|
@@ -76,7 +76,7 @@ class Animator extends destroyable_1.Destroyable {
|
|
|
76
76
|
}
|
|
77
77
|
onComplete(callback) {
|
|
78
78
|
if (this.onCompleteCallback) {
|
|
79
|
-
this.
|
|
79
|
+
this.attachToRoot();
|
|
80
80
|
throw new Error('Animator: onCompleteCallback is already set!');
|
|
81
81
|
}
|
|
82
82
|
this.onCompleteCallback = callback;
|
|
@@ -208,7 +208,7 @@ class Animator extends destroyable_1.Destroyable {
|
|
|
208
208
|
let previousState = this.propertyStates.get(key);
|
|
209
209
|
if (previousState) {
|
|
210
210
|
if (reAnimateHandling === ReAnimateHandlingType.throwError) {
|
|
211
|
-
this.
|
|
211
|
+
this.attachToRoot();
|
|
212
212
|
throw new Error(`Animator: property is already being animated. Property: "${key}"`);
|
|
213
213
|
}
|
|
214
214
|
else if (reAnimateHandling === ReAnimateHandlingType.ignoreNewAnimation) {
|
|
@@ -280,7 +280,7 @@ class Animator extends destroyable_1.Destroyable {
|
|
|
280
280
|
this.unsubscribeUpdateCycle();
|
|
281
281
|
}
|
|
282
282
|
})
|
|
283
|
-
.
|
|
283
|
+
.attachToRoot();
|
|
284
284
|
}
|
|
285
285
|
}
|
|
286
286
|
unsubscribeUpdateCycle() {
|
|
@@ -289,7 +289,7 @@ class Animator extends destroyable_1.Destroyable {
|
|
|
289
289
|
}
|
|
290
290
|
checkPropertyValidity(key) {
|
|
291
291
|
if (!this.effectOn.has(key)) {
|
|
292
|
-
this.
|
|
292
|
+
this.attachToRoot();
|
|
293
293
|
throw new Error(`Animator: not effected property is tried to update. Key: "${key}", EffectOn: "${this.effectOn}"`);
|
|
294
294
|
}
|
|
295
295
|
}
|