@woosh/meep-engine 2.131.11 → 2.131.12
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/package.json +1 -1
- package/src/engine/asset/preloader/AssetPreloader.d.ts +22 -6
- package/src/engine/asset/preloader/AssetPreloader.d.ts.map +1 -1
- package/src/engine/asset/preloader/AssetPreloader.js +24 -5
- package/src/engine/ecs/storage/BinaryBufferDeSerializer.js +1 -1
- package/src/view/asset/PreloaderView.d.ts +5 -1
- package/src/view/asset/PreloaderView.d.ts.map +1 -1
- package/src/view/asset/PreloaderView.js +4 -0
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"description": "Pure JavaScript game engine. Fully featured and production ready.",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"author": "Alexander Goldring",
|
|
8
|
-
"version": "2.131.
|
|
8
|
+
"version": "2.131.12",
|
|
9
9
|
"main": "build/meep.module.js",
|
|
10
10
|
"module": "build/meep.module.js",
|
|
11
11
|
"exports": {
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
* const assetManager:AssetManager = ...; // Obtain your asset manager
|
|
13
13
|
*
|
|
14
14
|
* loader.on.progress.add(({global}) => console.log(`loaded ${global.ratio*100}%`));
|
|
15
|
-
* loader.on.
|
|
15
|
+
* loader.on.succeeded.add(()=> console.log("preload complete"));
|
|
16
16
|
*
|
|
17
17
|
* loader.load(assetManager);
|
|
18
18
|
*/
|
|
@@ -31,17 +31,33 @@ export class AssetPreloader {
|
|
|
31
31
|
* @readonly
|
|
32
32
|
*/
|
|
33
33
|
readonly on: {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
34
|
+
/**
|
|
35
|
+
* @type {Signal<AssetLoadSpec,number>}
|
|
36
|
+
*/
|
|
37
|
+
added: Signal<AssetLoadSpec, number>;
|
|
38
|
+
/**
|
|
39
|
+
* Progress event
|
|
40
|
+
* @type {Signal<?>}
|
|
41
|
+
*/
|
|
42
|
+
progress: Signal<unknown>;
|
|
43
|
+
/**
|
|
44
|
+
* Single priority has finished loading
|
|
45
|
+
* @type {Signal}
|
|
46
|
+
*/
|
|
47
|
+
levelFinished: Signal;
|
|
48
|
+
/**
|
|
49
|
+
* An asset has failed to load
|
|
50
|
+
*/
|
|
37
51
|
error: Signal<any, any, any, any, any, any, any, any>;
|
|
38
52
|
started: Signal<any, any, any, any, any, any, any, any>;
|
|
39
53
|
/**
|
|
54
|
+
* Dispatched when all scheduled assets have been successfully loaded (no errors).
|
|
40
55
|
* @type {Signal<number>}
|
|
41
56
|
*/
|
|
42
|
-
|
|
57
|
+
succeeded: Signal<number>;
|
|
43
58
|
/**
|
|
44
|
-
* All assets are processed, even if some have errored out
|
|
59
|
+
* All assets are processed, even if some have errored out.
|
|
60
|
+
* This is a more permissive version of {@link succeeded} signal.
|
|
45
61
|
* @type {Signal<number,number>}
|
|
46
62
|
*/
|
|
47
63
|
resolved: Signal<number, number>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AssetPreloader.d.ts","sourceRoot":"","sources":["../../../../../src/engine/asset/preloader/AssetPreloader.js"],"names":[],"mappings":"AAsDA;;;;;;;;;;;;;;;;;GAiBG;AACH;IACI;;;OAGG;IACH,iBAFU,MAAM,CAEI;IAEpB;;;OAGG;IACH,iBAFU,aAAa,EAAE,EAAE,CAEf;IAEZ;;OAEG;IACH
|
|
1
|
+
{"version":3,"file":"AssetPreloader.d.ts","sourceRoot":"","sources":["../../../../../src/engine/asset/preloader/AssetPreloader.js"],"names":[],"mappings":"AAsDA;;;;;;;;;;;;;;;;;GAiBG;AACH;IACI;;;OAGG;IACH,iBAFU,MAAM,CAEI;IAEpB;;;OAGG;IACH,iBAFU,aAAa,EAAE,EAAE,CAEf;IAEZ;;OAEG;IACH;QACI;;WAEG;eADO,OAAO,aAAa,EAAC,MAAM,CAAC;QAGtC;;;WAGG;kBADO,eAAS;QAGnB;;;WAGG;uBADO,MAAM;QAGhB;;WAEG;;;QAGH;;;WAGG;mBADO,OAAO,MAAM,CAAC;QAGxB;;;;WAIG;kBADO,OAAO,MAAM,EAAC,MAAM,CAAC;MAGjC;IAaF;;;;;;;OAOG;IACH,SANW,MAAM,QACN,MAAM,UACN,MAAM,aACN,MAAM,GACL,cAAc,CAqCzB;IAED;;;OAGG;IACH,aAFW;QAAC,GAAG,EAAC,MAAM,CAAC;QAAC,IAAI,EAAC,MAAM,CAAC;QAAC,KAAK,CAAC,EAAC,MAAM,CAAA;KAAC,EAAE,QAQpD;IAED;;;;OAIG;IACH,kCAFY,cAAc,CAkKzB;CACJ;AAED;;;GAGG;AACH,wBAFU,cAAc,CAEgB;AAnWxC;;GAEG;AACH;IA+BI;;;;OAIG;IACH,4BAFY,aAAa,CAQxB;IAxCG;;;OAGG;IACH,YAAe;IACf;;;OAGG;IACH,aAAgB;IAChB;;;OAGG;IACH,OAFU,MAAM,GAAC,UAAU,CAEK;IAChC;;;OAGG;IACH,UAFU,MAAM,CAEC;IAGrB;;;;;aAKC;CAcJ;mBAlDkB,uCAAuC;uBAEnC,iBAAiB"}
|
|
@@ -66,7 +66,7 @@ class AssetLoadSpec {
|
|
|
66
66
|
* const assetManager:AssetManager = ...; // Obtain your asset manager
|
|
67
67
|
*
|
|
68
68
|
* loader.on.progress.add(({global}) => console.log(`loaded ${global.ratio*100}%`));
|
|
69
|
-
* loader.on.
|
|
69
|
+
* loader.on.succeeded.add(()=> console.log("preload complete"));
|
|
70
70
|
*
|
|
71
71
|
* loader.load(assetManager);
|
|
72
72
|
*/
|
|
@@ -87,17 +87,33 @@ export class AssetPreloader {
|
|
|
87
87
|
* @readonly
|
|
88
88
|
*/
|
|
89
89
|
on = {
|
|
90
|
+
/**
|
|
91
|
+
* @type {Signal<AssetLoadSpec,number>}
|
|
92
|
+
*/
|
|
90
93
|
added: new Signal(),
|
|
94
|
+
/**
|
|
95
|
+
* Progress event
|
|
96
|
+
* @type {Signal<?>}
|
|
97
|
+
*/
|
|
91
98
|
progress: new Signal(),
|
|
99
|
+
/**
|
|
100
|
+
* Single priority has finished loading
|
|
101
|
+
* @type {Signal}
|
|
102
|
+
*/
|
|
92
103
|
levelFinished: new Signal(),
|
|
104
|
+
/**
|
|
105
|
+
* An asset has failed to load
|
|
106
|
+
*/
|
|
93
107
|
error: new Signal(),
|
|
94
108
|
started: new Signal(),
|
|
95
109
|
/**
|
|
110
|
+
* Dispatched when all scheduled assets have been successfully loaded (no errors).
|
|
96
111
|
* @type {Signal<number>}
|
|
97
112
|
*/
|
|
98
|
-
|
|
113
|
+
succeeded: new Signal(),
|
|
99
114
|
/**
|
|
100
|
-
* All assets are processed, even if some have errored out
|
|
115
|
+
* All assets are processed, even if some have errored out.
|
|
116
|
+
* This is a more permissive version of {@link succeeded} signal.
|
|
101
117
|
* @type {Signal<number,number>}
|
|
102
118
|
*/
|
|
103
119
|
resolved: new Signal(),
|
|
@@ -215,7 +231,7 @@ export class AssetPreloader {
|
|
|
215
231
|
}
|
|
216
232
|
|
|
217
233
|
if (numAssetsFailed === 0) {
|
|
218
|
-
on.
|
|
234
|
+
on.succeeded.send1(numAssetsLoaded);
|
|
219
235
|
}
|
|
220
236
|
|
|
221
237
|
on.resolved.send2(numAssetsLoaded, numAssetsFailed);
|
|
@@ -242,6 +258,7 @@ export class AssetPreloader {
|
|
|
242
258
|
}
|
|
243
259
|
|
|
244
260
|
let batchElementLoadedCount = 0;
|
|
261
|
+
let batchElementFailedCount = 0;
|
|
245
262
|
|
|
246
263
|
function assetLoadSuccess(asset) {
|
|
247
264
|
batchElementLoadedCount++;
|
|
@@ -267,7 +284,7 @@ export class AssetPreloader {
|
|
|
267
284
|
});
|
|
268
285
|
|
|
269
286
|
//monitor completion
|
|
270
|
-
if (batchElementLoadedCount >= batchElementCount) {
|
|
287
|
+
if ((batchElementLoadedCount + batchElementFailedCount) >= batchElementCount) {
|
|
271
288
|
on.levelFinished.dispatch(level);
|
|
272
289
|
}
|
|
273
290
|
|
|
@@ -276,6 +293,8 @@ export class AssetPreloader {
|
|
|
276
293
|
|
|
277
294
|
function assetLoadFailed(e) {
|
|
278
295
|
numAssetsFailed++;
|
|
296
|
+
batchElementFailedCount++;
|
|
297
|
+
|
|
279
298
|
on.error.dispatch(e);
|
|
280
299
|
|
|
281
300
|
try_finish();
|
|
@@ -61,7 +61,7 @@ class BinaryBufferDeSerializer {
|
|
|
61
61
|
task = deserializeTask(numSerializedTypes, buffer, context, dataset, this.registry);
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
-
task.on.
|
|
64
|
+
task.on.succeeded.add(function () {
|
|
65
65
|
const entity_count_after = dataset.entityCount;
|
|
66
66
|
|
|
67
67
|
const execution_time = task.getExecutedCpuTime();
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
export default PreloaderView;
|
|
2
2
|
declare class PreloaderView extends View<HTMLElement> {
|
|
3
|
-
|
|
3
|
+
/**
|
|
4
|
+
*
|
|
5
|
+
* @param {AssetPreloader} preloader
|
|
6
|
+
*/
|
|
7
|
+
constructor(preloader: AssetPreloader);
|
|
4
8
|
el: HTMLDivElement;
|
|
5
9
|
}
|
|
6
10
|
import View from "../View.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PreloaderView.d.ts","sourceRoot":"","sources":["../../../../src/view/asset/PreloaderView.js"],"names":[],"mappings":";AAGA;IACI,
|
|
1
|
+
{"version":3,"file":"PreloaderView.d.ts","sourceRoot":"","sources":["../../../../src/view/asset/PreloaderView.js"],"names":[],"mappings":";AAGA;IACI;;;OAGG;IACH,uCAiDC;IA9Cc,mBAAuC;CA+CzD;iBAzDgB,YAAY"}
|