bard-legends-framework 0.10.4 → 0.10.6
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 -0
- package/dist/game-entities/_base/attachable.js +47 -0
- package/dist/game-entities/_base/attachable.store.d.ts +8 -0
- package/dist/game-entities/_base/attachable.store.js +43 -0
- package/dist/game-entities/_base/attachment-target.d.ts +16 -0
- package/dist/game-entities/_base/attachment-target.js +53 -0
- package/dist/game-entities/_base/destroyable.d.ts +3 -0
- package/dist/game-entities/_base/destroyable.js +10 -0
- package/dist/game-entities/_base/interfaces.d.ts +3 -0
- package/dist/game-entities/_base/interfaces.js +3 -0
- package/dist/game-entities/_base/mixins.d.ts +22 -0
- package/dist/game-entities/_base/mixins.js +60 -0
- package/dist/game-entities/base/attachable.d.ts +8 -7
- package/dist/game-entities/base/attachable.js +47 -21
- package/dist/game-entities/base/attachment-target.d.ts +9 -0
- package/dist/game-entities/base/attachment-target.js +53 -0
- package/dist/game-entities/base/attachment-target.test.d.ts +1 -0
- package/dist/game-entities/base/attachment-target.test.js +131 -0
- package/dist/game-entities/base/destroyable.d.ts +2 -3
- package/dist/game-entities/base/destroyable.js +0 -21
- package/dist/game-entities/base/helpers/attachable.store.d.ts +4 -4
- package/dist/game-entities/base/helpers/attachment-target.store.d.ts +1 -0
- package/dist/game-entities/base/helpers/attachment-target.store.js +40 -0
- package/dist/game-entities/base/helpers/decorate-actions-lib.d.ts +3 -3
- package/dist/game-entities/base/helpers/decorate-actions-lib.js +3 -3
- 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/base/interfaces.d.ts +8 -8
- package/dist/game-entities/entity/entity.d.ts +4 -4
- package/dist/game-entities/entity/entity.js +9 -2
- package/dist/game-entities/entity/entity.test.js +14 -3
- package/dist/game-entities/entity/singleton-entity.d.ts +0 -9
- package/dist/game-entities/entity/singleton-entity.js +0 -55
- package/dist/game-entities/entity/singleton-entity.test.js +4 -1
- package/dist/game-entities/index.d.ts +1 -1
- package/dist/game-entities/index.js +3 -3
- package/dist/game-entities/scene/scene.d.ts +22 -15
- package/dist/game-entities/scene/scene.js +56 -40
- package/dist/game-entities/scene/scene.test.js +45 -37
- package/dist/game-entities/service/service.test.js +20 -5
- package/dist/game-entities/view/view.d.ts +2 -3
- package/dist/game-entities/view/view.js +4 -4
- package/dist/game-entities/view/view.test.js +5 -2
- package/dist/pixi/components/helpers/smooth-scroller.d.ts +2 -2
- package/dist/pixi/components/helpers/smooth-scroller.js +1 -1
- 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 +1 -0
- package/dist/pixi/display-object/container.js +4 -0
- package/dist/pixi/display-object/objects/text/helpers/process-steps/1-data-in-converter/pixi-text-style-converter.d.ts +7 -3
- package/dist/pixi/display-object/objects/text/helpers/process-steps/1-data-in-converter/pixi-text-style-converter.js +6 -3
- package/dist/pixi/display-object/objects/text/helpers/process-steps/1-data-in-converter/rich-text-data-in-converter.d.ts +2 -3
- package/dist/pixi/display-object/objects/text/helpers/process-steps/1-data-in-converter/rich-text-data-in-converter.js +5 -4
- package/dist/pixi/display-object/objects/text/helpers/process-steps/1-data-in-converter/rich-text-data-in-converter.test.js +8 -32
- package/dist/pixi/display-object/objects/text/helpers/rich-text-to-plane-text.test.js +1 -1
- package/dist/pixi/display-object/objects/text/text.d.ts +5 -2
- package/dist/pixi/display-object/objects/text/text.js +40 -6
- package/dist/pixi/game.d.ts +2 -1
- package/dist/pixi/game.js +2 -0
- package/dist/utilities/libraries/animator/animator.d.ts +3 -2
- package/dist/utilities/libraries/animator/animator.js +9 -2
- package/dist/utilities/libraries/animator/animator.test.js +12 -3
- 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 +5 -12
|
@@ -48,11 +48,14 @@ decorate_actions_lib_1.ActionsLibDecorator.decorate(ActionsLib);
|
|
|
48
48
|
});
|
|
49
49
|
(0, vitest_1.test)('create scene', () => {
|
|
50
50
|
let SampleScene = class SampleScene extends scene_1.Scene {
|
|
51
|
+
async init() { }
|
|
52
|
+
update() { }
|
|
53
|
+
async prepareToClose() { }
|
|
51
54
|
};
|
|
52
55
|
SampleScene = __decorate([
|
|
53
56
|
(0, scene_1.SceneDecorator)()
|
|
54
57
|
], SampleScene);
|
|
55
|
-
SampleScene.open(
|
|
58
|
+
SampleScene.open();
|
|
56
59
|
(0, vitest_1.expect)(scene_1.Scene.activeScene.value).toBeDefined();
|
|
57
60
|
(0, vitest_1.expect)(scene_1.Scene.activeScene.value).toBeInstanceOf(SampleScene);
|
|
58
61
|
});
|
|
@@ -62,6 +65,8 @@ decorate_actions_lib_1.ActionsLibDecorator.decorate(ActionsLib);
|
|
|
62
65
|
(0, vitest_1.expect)(input.arg1).toEqual('test');
|
|
63
66
|
(0, vitest_1.expect)(input.arg2).toEqual(1);
|
|
64
67
|
}
|
|
68
|
+
update() { }
|
|
69
|
+
async prepareToClose() { }
|
|
65
70
|
};
|
|
66
71
|
SampleScene = __decorate([
|
|
67
72
|
(0, scene_1.SceneDecorator)()
|
|
@@ -85,49 +90,32 @@ decorate_actions_lib_1.ActionsLibDecorator.decorate(ActionsLib);
|
|
|
85
90
|
async init() {
|
|
86
91
|
(0, vitest_1.expect)(this.sampleService.value).toEqual('test');
|
|
87
92
|
}
|
|
93
|
+
update() { }
|
|
94
|
+
async prepareToClose() { }
|
|
88
95
|
};
|
|
89
96
|
SampleScene = __decorate([
|
|
90
97
|
(0, scene_1.SceneDecorator)(),
|
|
91
98
|
__metadata("design:paramtypes", [SampleService])
|
|
92
99
|
], SampleScene);
|
|
93
|
-
SampleScene.open(
|
|
94
|
-
});
|
|
95
|
-
(0, vitest_1.test)('open scene should destroy the previous scene', async () => {
|
|
96
|
-
var SampleScene1_1;
|
|
97
|
-
let SampleScene1 = class SampleScene1 extends scene_1.Scene {
|
|
98
|
-
static { SampleScene1_1 = this; }
|
|
99
|
-
static { this.destroyCalled = false; }
|
|
100
|
-
afterDestroy() {
|
|
101
|
-
SampleScene1_1.destroyCalled = true;
|
|
102
|
-
}
|
|
103
|
-
};
|
|
104
|
-
SampleScene1 = SampleScene1_1 = __decorate([
|
|
105
|
-
(0, scene_1.SceneDecorator)()
|
|
106
|
-
], SampleScene1);
|
|
107
|
-
let SampleScene2 = class SampleScene2 extends scene_1.Scene {
|
|
108
|
-
};
|
|
109
|
-
SampleScene2 = __decorate([
|
|
110
|
-
(0, scene_1.SceneDecorator)()
|
|
111
|
-
], SampleScene2);
|
|
112
|
-
SampleScene1.open(undefined);
|
|
113
|
-
await update_cycle_1.UpdateCycle.triggerUpdateTick(1); // Update cycle should take place to destroy functions to be called
|
|
114
|
-
(0, vitest_1.expect)(SampleScene1.destroyCalled).toBeFalsy();
|
|
115
|
-
SampleScene2.open(undefined);
|
|
116
|
-
await update_cycle_1.UpdateCycle.triggerUpdateTick(1); // Update cycle should take place to destroy functions to be called
|
|
117
|
-
(0, vitest_1.expect)(scene_1.Scene.activeScene.value).toBeInstanceOf(SampleScene2);
|
|
118
|
-
(0, vitest_1.expect)(SampleScene1.destroyCalled).toBeTruthy();
|
|
100
|
+
SampleScene.open();
|
|
119
101
|
});
|
|
120
102
|
(0, vitest_1.test)('get instance should return the scene with its type', () => {
|
|
121
103
|
let SampleScene = class SampleScene extends scene_1.Scene {
|
|
104
|
+
async init() { }
|
|
105
|
+
update() { }
|
|
106
|
+
async prepareToClose() { }
|
|
122
107
|
};
|
|
123
108
|
SampleScene = __decorate([
|
|
124
109
|
(0, scene_1.SceneDecorator)()
|
|
125
110
|
], SampleScene);
|
|
126
|
-
SampleScene.open(
|
|
111
|
+
SampleScene.open();
|
|
127
112
|
(0, vitest_1.expect)(SampleScene.getInstanceOrFail()).toBeInstanceOf(SampleScene);
|
|
128
113
|
});
|
|
129
114
|
(0, vitest_1.test)('getInstance should throw error when there is no active scene', () => {
|
|
130
115
|
let SampleScene = class SampleScene extends scene_1.Scene {
|
|
116
|
+
async init() { }
|
|
117
|
+
update() { }
|
|
118
|
+
async prepareToClose() { }
|
|
131
119
|
};
|
|
132
120
|
SampleScene = __decorate([
|
|
133
121
|
(0, scene_1.SceneDecorator)()
|
|
@@ -136,30 +124,34 @@ decorate_actions_lib_1.ActionsLibDecorator.decorate(ActionsLib);
|
|
|
136
124
|
});
|
|
137
125
|
(0, vitest_1.test)('getInstance should throw error when called while the open scene belongs to another class', () => {
|
|
138
126
|
let SampleScene = class SampleScene extends scene_1.Scene {
|
|
127
|
+
async init() { }
|
|
128
|
+
update() { }
|
|
129
|
+
async prepareToClose() { }
|
|
139
130
|
};
|
|
140
131
|
SampleScene = __decorate([
|
|
141
132
|
(0, scene_1.SceneDecorator)()
|
|
142
133
|
], SampleScene);
|
|
143
134
|
let SampleScene2 = class SampleScene2 extends scene_1.Scene {
|
|
135
|
+
async init() { }
|
|
136
|
+
update() { }
|
|
137
|
+
async prepareToClose() { }
|
|
144
138
|
};
|
|
145
139
|
SampleScene2 = __decorate([
|
|
146
140
|
(0, scene_1.SceneDecorator)()
|
|
147
141
|
], SampleScene2);
|
|
148
|
-
SampleScene.open(
|
|
142
|
+
SampleScene.open();
|
|
149
143
|
(0, vitest_1.expect)(() => SampleScene2.getInstanceOrFail()).toThrow();
|
|
150
144
|
});
|
|
151
145
|
(0, vitest_1.test)('destroyed scenes should destroy its entities and its views', async () => {
|
|
152
146
|
var SampleEntity_1;
|
|
153
147
|
let SampleScene = class SampleScene extends scene_1.Scene {
|
|
148
|
+
async init() { }
|
|
149
|
+
update() { }
|
|
150
|
+
async prepareToClose() { }
|
|
154
151
|
};
|
|
155
152
|
SampleScene = __decorate([
|
|
156
153
|
(0, scene_1.SceneDecorator)()
|
|
157
154
|
], SampleScene);
|
|
158
|
-
let SampleScene2 = class SampleScene2 extends scene_1.Scene {
|
|
159
|
-
};
|
|
160
|
-
SampleScene2 = __decorate([
|
|
161
|
-
(0, scene_1.SceneDecorator)()
|
|
162
|
-
], SampleScene2);
|
|
163
155
|
let SampleEntity = class SampleEntity extends entity_1.Entity {
|
|
164
156
|
static { SampleEntity_1 = this; }
|
|
165
157
|
static { this.entityDestroyCalled = false; }
|
|
@@ -181,9 +173,9 @@ decorate_actions_lib_1.ActionsLibDecorator.decorate(ActionsLib);
|
|
|
181
173
|
entity: SampleEntity
|
|
182
174
|
})
|
|
183
175
|
], _SampleView);
|
|
184
|
-
await SampleScene.open(
|
|
176
|
+
await SampleScene.open().onOpen;
|
|
185
177
|
new SampleEntity().attach(scene_1.Scene.getActiveSceneOrFail());
|
|
186
|
-
|
|
178
|
+
await SampleScene.getInstanceOrFail().close();
|
|
187
179
|
await update_cycle_1.UpdateCycle.triggerUpdateTick(1); // Update cycle should take place to destroy functions to be called
|
|
188
180
|
(0, vitest_1.expect)(SampleEntity.entityDestroyCalled).toBeTruthy();
|
|
189
181
|
(0, vitest_1.expect)(viewDestroyCalled).toBeTruthy();
|
|
@@ -193,9 +185,11 @@ decorate_actions_lib_1.ActionsLibDecorator.decorate(ActionsLib);
|
|
|
193
185
|
let SampleScene = class SampleScene extends scene_1.Scene {
|
|
194
186
|
static { SampleScene_1 = this; }
|
|
195
187
|
static { this.sceneUpdateCalled = false; }
|
|
188
|
+
async init() { }
|
|
196
189
|
update(time, delta) {
|
|
197
190
|
SampleScene_1.sceneUpdateCalled = true;
|
|
198
191
|
}
|
|
192
|
+
async prepareToClose() { }
|
|
199
193
|
};
|
|
200
194
|
SampleScene = SampleScene_1 = __decorate([
|
|
201
195
|
(0, scene_1.SceneDecorator)()
|
|
@@ -220,12 +214,26 @@ decorate_actions_lib_1.ActionsLibDecorator.decorate(ActionsLib);
|
|
|
220
214
|
}),
|
|
221
215
|
__metadata("design:paramtypes", [SampleEntity])
|
|
222
216
|
], _SampleView);
|
|
223
|
-
SampleScene.open(
|
|
217
|
+
SampleScene.open();
|
|
224
218
|
new SampleEntity().attach(scene_1.Scene.getActiveSceneOrFail());
|
|
225
219
|
await (0, helpers_lib_1.Wait)(); // Wait for the async view init to expect the update call
|
|
226
220
|
update_cycle_1.UpdateCycle.triggerUpdateTick(1);
|
|
227
221
|
(0, vitest_1.expect)(SampleScene.sceneUpdateCalled).toBeTruthy();
|
|
228
222
|
(0, vitest_1.expect)(viewUpdateCalled).toBeTruthy();
|
|
229
223
|
});
|
|
224
|
+
(0, vitest_1.test)('closing scene should destroy it', async () => {
|
|
225
|
+
let SampleScene = class SampleScene extends scene_1.Scene {
|
|
226
|
+
async init() { }
|
|
227
|
+
update() { }
|
|
228
|
+
async prepareToClose() { }
|
|
229
|
+
};
|
|
230
|
+
SampleScene = __decorate([
|
|
231
|
+
(0, scene_1.SceneDecorator)()
|
|
232
|
+
], SampleScene);
|
|
233
|
+
await SampleScene.open().onOpen;
|
|
234
|
+
let scene = SampleScene.getInstanceOrFail();
|
|
235
|
+
await scene.close();
|
|
236
|
+
(0, vitest_1.expect)(scene.destroyed).toBeTruthy();
|
|
237
|
+
});
|
|
230
238
|
});
|
|
231
239
|
//# sourceMappingURL=scene.test.js.map
|
|
@@ -64,11 +64,14 @@ decorate_actions_lib_1.ActionsLibDecorator.decorate(ActionsLib);
|
|
|
64
64
|
(0, vitest_1.test)('inject services to views', () => {
|
|
65
65
|
var SampleService_2, SampleView_1;
|
|
66
66
|
let SampleScene = class SampleScene extends scene_1.Scene {
|
|
67
|
+
async init() { }
|
|
68
|
+
update() { }
|
|
69
|
+
async prepareToClose() { }
|
|
67
70
|
};
|
|
68
71
|
SampleScene = __decorate([
|
|
69
72
|
(0, scene_1.SceneDecorator)()
|
|
70
73
|
], SampleScene);
|
|
71
|
-
SampleScene.open(
|
|
74
|
+
SampleScene.open();
|
|
72
75
|
let SampleService = class SampleService {
|
|
73
76
|
static { SampleService_2 = this; }
|
|
74
77
|
constructor() {
|
|
@@ -130,12 +133,15 @@ decorate_actions_lib_1.ActionsLibDecorator.decorate(ActionsLib);
|
|
|
130
133
|
super();
|
|
131
134
|
this.service2 = service2;
|
|
132
135
|
}
|
|
136
|
+
async init() { }
|
|
137
|
+
update() { }
|
|
138
|
+
async prepareToClose() { }
|
|
133
139
|
};
|
|
134
140
|
SampleScene = __decorate([
|
|
135
141
|
(0, scene_1.SceneDecorator)(),
|
|
136
142
|
__metadata("design:paramtypes", [SampleService2])
|
|
137
143
|
], SampleScene);
|
|
138
|
-
SampleScene.open(
|
|
144
|
+
SampleScene.open();
|
|
139
145
|
(0, vitest_1.expect)(SampleService1.instance).toBeDefined();
|
|
140
146
|
(0, vitest_1.expect)(SampleService2.instance).toBeDefined();
|
|
141
147
|
(0, vitest_1.expect)(SampleScene.getInstanceOrFail().service2).toEqual(SampleService2.instance);
|
|
@@ -184,13 +190,16 @@ decorate_actions_lib_1.ActionsLibDecorator.decorate(ActionsLib);
|
|
|
184
190
|
this.service2 = service2;
|
|
185
191
|
this.service3 = service3;
|
|
186
192
|
}
|
|
193
|
+
async init() { }
|
|
194
|
+
update() { }
|
|
195
|
+
async prepareToClose() { }
|
|
187
196
|
};
|
|
188
197
|
SampleScene = __decorate([
|
|
189
198
|
(0, scene_1.SceneDecorator)(),
|
|
190
199
|
__metadata("design:paramtypes", [SampleService2,
|
|
191
200
|
SampleService3])
|
|
192
201
|
], SampleScene);
|
|
193
|
-
SampleScene.open(
|
|
202
|
+
SampleScene.open();
|
|
194
203
|
(0, vitest_1.expect)(SampleService1.instanceCount).toEqual(1);
|
|
195
204
|
(0, vitest_1.expect)(SampleService2.instanceCount).toEqual(1);
|
|
196
205
|
(0, vitest_1.expect)(SampleService3.instanceCount).toEqual(1);
|
|
@@ -215,23 +224,29 @@ decorate_actions_lib_1.ActionsLibDecorator.decorate(ActionsLib);
|
|
|
215
224
|
super();
|
|
216
225
|
this.service = service;
|
|
217
226
|
}
|
|
227
|
+
async init() { }
|
|
228
|
+
update() { }
|
|
229
|
+
async prepareToClose() { }
|
|
218
230
|
};
|
|
219
231
|
SampleScene = __decorate([
|
|
220
232
|
(0, scene_1.SceneDecorator)(),
|
|
221
233
|
__metadata("design:paramtypes", [SampleService])
|
|
222
234
|
], SampleScene);
|
|
223
|
-
SampleScene.open(
|
|
235
|
+
SampleScene.open();
|
|
224
236
|
(0, vitest_1.expect)(SampleService.instance).toBeDefined();
|
|
225
237
|
(0, vitest_1.expect)(SampleScene.getInstanceOrFail().service).toEqual(SampleService.instance);
|
|
226
238
|
});
|
|
227
239
|
(0, vitest_1.test)('resolve parameters should pass known parameters with falsely values', () => {
|
|
228
240
|
var Parent_1;
|
|
229
241
|
let SampleScene = class SampleScene extends scene_1.Scene {
|
|
242
|
+
async init() { }
|
|
243
|
+
update() { }
|
|
244
|
+
async prepareToClose() { }
|
|
230
245
|
};
|
|
231
246
|
SampleScene = __decorate([
|
|
232
247
|
(0, scene_1.SceneDecorator)()
|
|
233
248
|
], SampleScene);
|
|
234
|
-
SampleScene.open(
|
|
249
|
+
SampleScene.open();
|
|
235
250
|
let Parent = class Parent extends entity_1.Entity {
|
|
236
251
|
static { Parent_1 = this; }
|
|
237
252
|
static { this.receivedArgs = []; }
|
|
@@ -1,15 +1,14 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AttachmentTarget } from '../base/attachment-target';
|
|
2
2
|
import { Entity } from '../entity/entity';
|
|
3
3
|
export type ViewClassType<EntityType> = new (entity: EntityType, ...services: any[]) => View;
|
|
4
4
|
export interface ViewDecoratorMeta<EntityType> {
|
|
5
5
|
entity: new (...args: any[]) => EntityType;
|
|
6
6
|
}
|
|
7
7
|
export declare function ViewDecorator<EntityType extends Entity>(meta: ViewDecoratorMeta<EntityType>): (ViewClass: ViewClassType<EntityType>) => any;
|
|
8
|
-
export declare abstract class View extends
|
|
8
|
+
export declare abstract class View extends AttachmentTarget {
|
|
9
9
|
private static viewClassNames;
|
|
10
10
|
static getInstance<T extends View>(this: new (...args: any[]) => T, entityId: string): T | undefined;
|
|
11
11
|
static getInstanceOrFail<T extends View>(this: new (...args: any[]) => T, entityId: string): T;
|
|
12
|
-
protected childUpdate: (time: number, delta: number) => void;
|
|
13
12
|
private _entityId;
|
|
14
13
|
constructor();
|
|
15
14
|
protected destroySelf(): void;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.View = exports.ViewDecorator = void 0;
|
|
4
|
-
const
|
|
4
|
+
const attachment_target_1 = require("../base/attachment-target");
|
|
5
5
|
const entity_views_helper_1 = require("../entity/helpers/entity-views.helper");
|
|
6
6
|
const service_1 = require("../service/service");
|
|
7
7
|
const update_cycle_1 = require("../update-cycle");
|
|
@@ -23,7 +23,7 @@ function ViewDecorator(meta) {
|
|
|
23
23
|
};
|
|
24
24
|
}
|
|
25
25
|
exports.ViewDecorator = ViewDecorator;
|
|
26
|
-
class View extends
|
|
26
|
+
class View extends attachment_target_1.AttachmentTarget {
|
|
27
27
|
static { this.viewClassNames = new Set(); }
|
|
28
28
|
static getInstance(entityId) {
|
|
29
29
|
if (entityId.substring(0, entityId.indexOf(':')) !== this.$meta.entityName) {
|
|
@@ -45,13 +45,13 @@ class View extends attachable_1.Attachable {
|
|
|
45
45
|
}
|
|
46
46
|
constructor() {
|
|
47
47
|
super();
|
|
48
|
-
this.childUpdate = this.update.bind(this);
|
|
49
48
|
this.attachToRoot(); // View is always attached to its entity
|
|
50
49
|
this._entityId = entity_views_helper_1.EntityViewsHelper.currentEntityId;
|
|
51
50
|
this.getViewInstances().set(this._entityId, this);
|
|
51
|
+
let originalUpdate = this.update.bind(this);
|
|
52
52
|
this.update = function (time, delta) {
|
|
53
53
|
if (!this.destroyed) {
|
|
54
|
-
|
|
54
|
+
originalUpdate(time, delta);
|
|
55
55
|
}
|
|
56
56
|
};
|
|
57
57
|
}
|
|
@@ -46,11 +46,14 @@ decorate_actions_lib_1.ActionsLibDecorator.decorate(ActionsLib);
|
|
|
46
46
|
(0, vitest_1.beforeEach)(() => {
|
|
47
47
|
update_cycle_1.UpdateCycle.hardResetAction.trigger();
|
|
48
48
|
let SampleScene = class SampleScene extends scene_1.Scene {
|
|
49
|
+
async init() { }
|
|
50
|
+
update() { }
|
|
51
|
+
async prepareToClose() { }
|
|
49
52
|
};
|
|
50
53
|
SampleScene = __decorate([
|
|
51
54
|
(0, scene_1.SceneDecorator)()
|
|
52
55
|
], SampleScene);
|
|
53
|
-
SampleScene.open(
|
|
56
|
+
SampleScene.open();
|
|
54
57
|
});
|
|
55
58
|
(0, vitest_1.test)('entity creation should create related view', () => {
|
|
56
59
|
var SampleView_1;
|
|
@@ -425,7 +428,7 @@ decorate_actions_lib_1.ActionsLibDecorator.decorate(ActionsLib);
|
|
|
425
428
|
(0, view_1.ViewDecorator)({ entity: BaseEntity }),
|
|
426
429
|
__metadata("design:paramtypes", [BaseEntity])
|
|
427
430
|
], SampleView);
|
|
428
|
-
(0, vitest_1.expect)(
|
|
431
|
+
(0, vitest_1.expect)(() => SampleView.getInstanceOrFail(sampleEntity.id)).toThrowError();
|
|
429
432
|
});
|
|
430
433
|
(0, vitest_1.test)('destroying entity should not prevent subscription of the view', async () => {
|
|
431
434
|
var Sample_1, SampleView_9;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { Vector } from 'helpers-lib';
|
|
2
|
-
import {
|
|
2
|
+
import { Attachable } from '../../../game-entities';
|
|
3
3
|
interface ContainerFrame {
|
|
4
4
|
x: number;
|
|
5
5
|
y: number;
|
|
6
6
|
size: Vector;
|
|
7
7
|
}
|
|
8
|
-
export declare class SmoothScroller extends
|
|
8
|
+
export declare class SmoothScroller extends Attachable {
|
|
9
9
|
private content;
|
|
10
10
|
private areaHeight;
|
|
11
11
|
private padding;
|
|
@@ -5,7 +5,7 @@ const helpers_lib_1 = require("helpers-lib");
|
|
|
5
5
|
const game_entities_1 = require("../../../game-entities");
|
|
6
6
|
const SCROLL_SPEED = 0.65;
|
|
7
7
|
const SCROLL_SPEED_DECAY_RATE = 0.01;
|
|
8
|
-
class SmoothScroller extends game_entities_1.
|
|
8
|
+
class SmoothScroller extends game_entities_1.Attachable {
|
|
9
9
|
get scrollHeight() {
|
|
10
10
|
return this._scrollHeight;
|
|
11
11
|
}
|
|
@@ -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 { AttachmentTarget } 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 AttachmentTarget {
|
|
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.AttachmentTarget {
|
|
56
56
|
constructor() {
|
|
57
57
|
super();
|
|
58
58
|
// --------------------- Scale ---------------------
|
|
@@ -15,6 +15,7 @@ export declare class Container extends ContainerAttributes {
|
|
|
15
15
|
cropOverflowingParts: boolean;
|
|
16
16
|
};
|
|
17
17
|
constructor();
|
|
18
|
+
destroy(): void;
|
|
18
19
|
protected destroySelf(): void;
|
|
19
20
|
getBoundingMask(): Sprite;
|
|
20
21
|
displayParent(parent: Container | string, partialOptions?: Partial<SetParentOptions>): this;
|
|
@@ -16,6 +16,10 @@ 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
|
+
}
|
|
19
23
|
destroySelf() {
|
|
20
24
|
super.destroySelf();
|
|
21
25
|
Container.allContainers.delete(this.id);
|
|
@@ -15,11 +15,15 @@ export interface TextOptions {
|
|
|
15
15
|
readonly fontStyle: 'normal' | 'italic' | 'oblique';
|
|
16
16
|
readonly lineHeight: number | undefined;
|
|
17
17
|
readonly dropShadow: DropShadowOptions | undefined;
|
|
18
|
-
readonly wordWrapWidth
|
|
18
|
+
readonly wordWrapWidth: number | undefined;
|
|
19
|
+
readonly lineThrough: boolean;
|
|
19
20
|
}
|
|
20
21
|
export type PartialTextOptions = Partial<Omit<TextOptions, 'dropShadow'>> & {
|
|
21
22
|
dropShadow?: Partial<DropShadowOptions> | true;
|
|
22
23
|
};
|
|
23
|
-
export
|
|
24
|
-
|
|
24
|
+
export interface ExtendedPixiTextStyle extends Partial<PIXI.ITextStyle> {
|
|
25
|
+
readonly lineThrough: boolean;
|
|
26
|
+
}
|
|
27
|
+
export declare class TextStyleConverter {
|
|
28
|
+
static getPixiTextStyle(partialOptions?: PartialTextOptions): ExtendedPixiTextStyle;
|
|
25
29
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.TextStyleConverter = void 0;
|
|
4
4
|
const helpers_lib_1 = require("helpers-lib");
|
|
5
|
-
class
|
|
5
|
+
class TextStyleConverter {
|
|
6
6
|
static getPixiTextStyle(partialOptions) {
|
|
7
7
|
let options = {
|
|
8
8
|
color: helpers_lib_1.ColorHelper.white,
|
|
@@ -11,6 +11,8 @@ class PixiTextStyleConverter {
|
|
|
11
11
|
fontStyle: 'normal',
|
|
12
12
|
fontSize: 18,
|
|
13
13
|
lineHeight: undefined,
|
|
14
|
+
wordWrapWidth: undefined,
|
|
15
|
+
lineThrough: false,
|
|
14
16
|
...partialOptions
|
|
15
17
|
};
|
|
16
18
|
let partialDropShadowOptions = partialOptions?.dropShadow === true ? {} : partialOptions?.dropShadow;
|
|
@@ -42,9 +44,10 @@ class PixiTextStyleConverter {
|
|
|
42
44
|
lineHeight: options.lineHeight,
|
|
43
45
|
wordWrapWidth: options.wordWrapWidth,
|
|
44
46
|
wordWrap: options.wordWrapWidth !== undefined,
|
|
47
|
+
lineThrough: options.lineThrough,
|
|
45
48
|
...shadowOptions
|
|
46
49
|
};
|
|
47
50
|
}
|
|
48
51
|
}
|
|
49
|
-
exports.
|
|
52
|
+
exports.TextStyleConverter = TextStyleConverter;
|
|
50
53
|
//# sourceMappingURL=pixi-text-style-converter.js.map
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import * as PIXI from 'pixi.js';
|
|
2
1
|
import { RichTextOptions } from '../../../rich-text';
|
|
3
2
|
import { ChunkData } from '../../rich-text-to-plane-text';
|
|
4
|
-
import { PartialTextOptions } from './pixi-text-style-converter';
|
|
3
|
+
import { ExtendedPixiTextStyle, PartialTextOptions } from './pixi-text-style-converter';
|
|
5
4
|
export interface TagsWithStyles {
|
|
6
5
|
readonly text: string;
|
|
7
6
|
readonly cacheKey: string;
|
|
8
7
|
readonly style: PartialTextOptions;
|
|
9
|
-
readonly pixiStyle:
|
|
8
|
+
readonly pixiStyle: ExtendedPixiTextStyle;
|
|
10
9
|
readonly spaceWidth: number;
|
|
11
10
|
}
|
|
12
11
|
export declare class RichTextDataInConverter {
|
|
@@ -43,14 +43,14 @@ class RichTextDataInConverter {
|
|
|
43
43
|
if (pixiStyleCache.has(cacheKey)) {
|
|
44
44
|
return pixiStyleCache.get(cacheKey);
|
|
45
45
|
}
|
|
46
|
-
let pixiStyle =
|
|
46
|
+
let pixiStyle = pixi_text_style_converter_1.TextStyleConverter.getPixiTextStyle(style);
|
|
47
47
|
pixiStyleCache.set(cacheKey, pixiStyle);
|
|
48
48
|
return pixiStyle;
|
|
49
49
|
};
|
|
50
50
|
let tagsWithStyles = textSegments.map(segment => {
|
|
51
51
|
let { style, cacheKey } = this.getCombinedStyle(segment.tags, options, styleCache);
|
|
52
52
|
let pixiStyle = GetPixiStyle(style, cacheKey);
|
|
53
|
-
let spaceMeasurement = PIXI.TextMetrics.measureText(' ', pixiStyle, false);
|
|
53
|
+
let spaceMeasurement = PIXI.TextMetrics.measureText(' ', new PIXI.TextStyle(pixiStyle), false);
|
|
54
54
|
let data = {
|
|
55
55
|
text: segment.text,
|
|
56
56
|
cacheKey,
|
|
@@ -112,14 +112,15 @@ class RichTextDataInConverter {
|
|
|
112
112
|
let chunkData = line.flatMap(data => {
|
|
113
113
|
let chunkStrings = this.splitToChunks(data.text);
|
|
114
114
|
return chunkStrings.map(chunkString => {
|
|
115
|
-
let
|
|
115
|
+
let pixiStyle = new PIXI.TextStyle(data.pixiStyle);
|
|
116
|
+
let metrics = PIXI.TextMetrics.measureText(chunkString, pixiStyle, false);
|
|
116
117
|
let chunkDatum = {
|
|
117
118
|
text: chunkString,
|
|
118
119
|
whitespace: chunkString.trim() === '',
|
|
119
120
|
style: {
|
|
120
121
|
cacheKey: data.cacheKey,
|
|
121
122
|
style: data.style,
|
|
122
|
-
pixiStyle
|
|
123
|
+
pixiStyle,
|
|
123
124
|
height: metrics.height,
|
|
124
125
|
ascent: metrics.fontProperties.ascent,
|
|
125
126
|
descent: metrics.fontProperties.descent,
|
|
@@ -1,29 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
const PIXI = __importStar(require("pixi.js"));
|
|
27
3
|
const script_engine_lib_1 = require("script-engine-lib");
|
|
28
4
|
const vitest_1 = require("vitest");
|
|
29
5
|
const rich_text_to_plane_text_test_1 = require("../../rich-text-to-plane-text.test");
|
|
@@ -47,11 +23,11 @@ const ExpectedResults = {
|
|
|
47
23
|
'style1+style2': { fontFamily: 'Arial', color: Style2Color, fontSize: 22, lineHeight: 25 }
|
|
48
24
|
};
|
|
49
25
|
const ExpectedPixiStyles = {
|
|
50
|
-
empty:
|
|
51
|
-
default:
|
|
52
|
-
style1:
|
|
53
|
-
style2:
|
|
54
|
-
'style1+style2':
|
|
26
|
+
empty: pixi_text_style_converter_1.TextStyleConverter.getPixiTextStyle({}),
|
|
27
|
+
default: pixi_text_style_converter_1.TextStyleConverter.getPixiTextStyle(ExpectedResults.default),
|
|
28
|
+
style1: pixi_text_style_converter_1.TextStyleConverter.getPixiTextStyle(ExpectedResults.style1),
|
|
29
|
+
style2: pixi_text_style_converter_1.TextStyleConverter.getPixiTextStyle(ExpectedResults.style2),
|
|
30
|
+
'style1+style2': pixi_text_style_converter_1.TextStyleConverter.getPixiTextStyle(ExpectedResults['style1+style2'])
|
|
55
31
|
};
|
|
56
32
|
(0, vitest_1.describe)('RichTextDataInConverter', () => {
|
|
57
33
|
(0, rich_text_to_plane_text_test_1.MockPixiMeasureText)();
|
|
@@ -242,9 +218,9 @@ const ExpectedPixiStyles = {
|
|
|
242
218
|
b: { fontSize: 14 }
|
|
243
219
|
};
|
|
244
220
|
const PixiStyles = {
|
|
245
|
-
default:
|
|
246
|
-
red:
|
|
247
|
-
b:
|
|
221
|
+
default: pixi_text_style_converter_1.TextStyleConverter.getPixiTextStyle(mockStyles.default),
|
|
222
|
+
red: pixi_text_style_converter_1.TextStyleConverter.getPixiTextStyle(mockStyles.red),
|
|
223
|
+
b: pixi_text_style_converter_1.TextStyleConverter.getPixiTextStyle(mockStyles.b)
|
|
248
224
|
};
|
|
249
225
|
const GetTagsWithStyles = (text, style = 'default') => {
|
|
250
226
|
let result = {
|
|
@@ -34,7 +34,7 @@ const CreateSampleChunkData = (text, options) => ({
|
|
|
34
34
|
style: {
|
|
35
35
|
cacheKey: JSON.stringify(options) ?? 'empty',
|
|
36
36
|
style: { fontSize: options?.fontSize ?? 16, fontFamily: 'Arial' },
|
|
37
|
-
pixiStyle: { fontSize: options?.fontSize ?? 16, fontFamily: 'Arial' },
|
|
37
|
+
pixiStyle: new PIXI.TextStyle({ fontSize: options?.fontSize ?? 16, fontFamily: 'Arial' }),
|
|
38
38
|
height: options?.fontSize ?? 16,
|
|
39
39
|
ascent: options?.fontSize ? options.fontSize - 4 : 12,
|
|
40
40
|
descent: 4,
|
|
@@ -2,13 +2,15 @@ import { RGBColor, Vector } from 'helpers-lib';
|
|
|
2
2
|
import { Container } from '../../container';
|
|
3
3
|
import { PartialTextOptions } from './helpers/process-steps/1-data-in-converter/pixi-text-style-converter';
|
|
4
4
|
export declare class Text extends Container {
|
|
5
|
+
private readonly partialOptions?;
|
|
5
6
|
private pixiText;
|
|
6
|
-
private
|
|
7
|
+
private strikethroughGraphics?;
|
|
8
|
+
private pixiTextStyle;
|
|
7
9
|
private text;
|
|
8
10
|
private _textMetrics?;
|
|
9
11
|
private get textMetrics();
|
|
10
12
|
get ascent(): number;
|
|
11
|
-
constructor(text: string, partialOptions?: PartialTextOptions);
|
|
13
|
+
constructor(text: string, partialOptions?: PartialTextOptions | undefined);
|
|
12
14
|
protected destroySelf(): void;
|
|
13
15
|
setAnchor(value: Vector): this;
|
|
14
16
|
get anchor(): Vector;
|
|
@@ -20,4 +22,5 @@ export declare class Text extends Container {
|
|
|
20
22
|
setText(text: string): this;
|
|
21
23
|
setColor(color: RGBColor): this;
|
|
22
24
|
private regeneratePixiText;
|
|
25
|
+
private addStrikethroughToText;
|
|
23
26
|
}
|