@woosh/meep-engine 2.131.11 → 2.131.13
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 +29 -6
- package/src/engine/asset/preloader/AssetPreloader.d.ts.map +1 -1
- package/src/engine/asset/preloader/AssetPreloader.js +26 -6
- 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.13",
|
|
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,40 @@ 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
|
+
* Note that the numbers are arbitrary and just signify overall progress and not specific quantifies such as bytes or asset counts.
|
|
41
|
+
* @type {Signal<{global:{current:number, total:number, progress: number}}>}
|
|
42
|
+
*/
|
|
43
|
+
progress: Signal<{
|
|
44
|
+
global: {
|
|
45
|
+
current: number;
|
|
46
|
+
total: number;
|
|
47
|
+
progress: number;
|
|
48
|
+
};
|
|
49
|
+
}>;
|
|
50
|
+
/**
|
|
51
|
+
* Single priority has finished loading
|
|
52
|
+
* @type {Signal}
|
|
53
|
+
*/
|
|
54
|
+
levelFinished: Signal;
|
|
55
|
+
/**
|
|
56
|
+
* An asset has failed to load
|
|
57
|
+
*/
|
|
37
58
|
error: Signal<any, any, any, any, any, any, any, any>;
|
|
38
59
|
started: Signal<any, any, any, any, any, any, any, any>;
|
|
39
60
|
/**
|
|
61
|
+
* Dispatched when all scheduled assets have been successfully loaded (no errors).
|
|
40
62
|
* @type {Signal<number>}
|
|
41
63
|
*/
|
|
42
|
-
|
|
64
|
+
succeeded: Signal<number>;
|
|
43
65
|
/**
|
|
44
|
-
* All assets are processed, even if some have errored out
|
|
66
|
+
* All assets are processed, even if some have errored out.
|
|
67
|
+
* This is a more permissive version of {@link succeeded} signal.
|
|
45
68
|
* @type {Signal<number,number>}
|
|
46
69
|
*/
|
|
47
70
|
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;;;;WAIG;kBADO,OAAO;YAAC,QAAO;gBAAC,OAAO,EAAC,MAAM,CAAC;gBAAC,KAAK,EAAC,MAAM,CAAC;gBAAC,QAAQ,EAAE,MAAM,CAAA;aAAC,CAAA;SAAC,CAAC;QAG3E;;;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;AApWxC;;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,34 @@ 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
|
+
* Note that the numbers are arbitrary and just signify overall progress and not specific quantifies such as bytes or asset counts.
|
|
97
|
+
* @type {Signal<{global:{current:number, total:number, progress: number}}>}
|
|
98
|
+
*/
|
|
91
99
|
progress: new Signal(),
|
|
100
|
+
/**
|
|
101
|
+
* Single priority has finished loading
|
|
102
|
+
* @type {Signal}
|
|
103
|
+
*/
|
|
92
104
|
levelFinished: new Signal(),
|
|
105
|
+
/**
|
|
106
|
+
* An asset has failed to load
|
|
107
|
+
*/
|
|
93
108
|
error: new Signal(),
|
|
94
109
|
started: new Signal(),
|
|
95
110
|
/**
|
|
111
|
+
* Dispatched when all scheduled assets have been successfully loaded (no errors).
|
|
96
112
|
* @type {Signal<number>}
|
|
97
113
|
*/
|
|
98
|
-
|
|
114
|
+
succeeded: new Signal(),
|
|
99
115
|
/**
|
|
100
|
-
* All assets are processed, even if some have errored out
|
|
116
|
+
* All assets are processed, even if some have errored out.
|
|
117
|
+
* This is a more permissive version of {@link succeeded} signal.
|
|
101
118
|
* @type {Signal<number,number>}
|
|
102
119
|
*/
|
|
103
120
|
resolved: new Signal(),
|
|
@@ -209,13 +226,13 @@ export class AssetPreloader {
|
|
|
209
226
|
|
|
210
227
|
const totalProcessed = numAssetsLoaded + numAssetsFailed;
|
|
211
228
|
|
|
212
|
-
if (totalProcessed
|
|
229
|
+
if (totalProcessed < numAssets) {
|
|
213
230
|
// not done yet
|
|
214
231
|
return;
|
|
215
232
|
}
|
|
216
233
|
|
|
217
234
|
if (numAssetsFailed === 0) {
|
|
218
|
-
on.
|
|
235
|
+
on.succeeded.send1(numAssetsLoaded);
|
|
219
236
|
}
|
|
220
237
|
|
|
221
238
|
on.resolved.send2(numAssetsLoaded, numAssetsFailed);
|
|
@@ -242,6 +259,7 @@ export class AssetPreloader {
|
|
|
242
259
|
}
|
|
243
260
|
|
|
244
261
|
let batchElementLoadedCount = 0;
|
|
262
|
+
let batchElementFailedCount = 0;
|
|
245
263
|
|
|
246
264
|
function assetLoadSuccess(asset) {
|
|
247
265
|
batchElementLoadedCount++;
|
|
@@ -267,7 +285,7 @@ export class AssetPreloader {
|
|
|
267
285
|
});
|
|
268
286
|
|
|
269
287
|
//monitor completion
|
|
270
|
-
if (batchElementLoadedCount >= batchElementCount) {
|
|
288
|
+
if ((batchElementLoadedCount + batchElementFailedCount) >= batchElementCount) {
|
|
271
289
|
on.levelFinished.dispatch(level);
|
|
272
290
|
}
|
|
273
291
|
|
|
@@ -276,6 +294,8 @@ export class AssetPreloader {
|
|
|
276
294
|
|
|
277
295
|
function assetLoadFailed(e) {
|
|
278
296
|
numAssetsFailed++;
|
|
297
|
+
batchElementFailedCount++;
|
|
298
|
+
|
|
279
299
|
on.error.dispatch(e);
|
|
280
300
|
|
|
281
301
|
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"}
|