@combos-fun/engine 0.1.2 → 0.1.4-beta.0
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/engine.cjs.js +35 -8
- package/dist/engine.cjs.js.map +1 -1
- package/dist/engine.cjs.prod.js +1 -1
- package/dist/engine.d.ts +16 -5
- package/dist/engine.esm.js +35 -8
- package/dist/engine.esm.js.map +1 -1
- package/package.json +2 -2
- package/references/public-api.md +2 -2
package/dist/engine.cjs.js
CHANGED
|
@@ -891,7 +891,7 @@ class Scene extends GameObject {
|
|
|
891
891
|
}
|
|
892
892
|
|
|
893
893
|
/** Generated at build from package.json */
|
|
894
|
-
const version = "0.1.
|
|
894
|
+
const version = "0.1.4-beta.0";
|
|
895
895
|
|
|
896
896
|
/**
|
|
897
897
|
* Sent to `window.parent` after each `System.init` completes during `Game.addSystem`
|
|
@@ -1208,10 +1208,21 @@ class Game extends EventEmitter__default.default {
|
|
|
1208
1208
|
notifyReady(error) {
|
|
1209
1209
|
postParentGameReady(error, this.pluginInitNotifyTargetOrigin);
|
|
1210
1210
|
}
|
|
1211
|
+
/** Drain queued component observer events without starting the ticker. */
|
|
1212
|
+
flushObservedComponents() {
|
|
1213
|
+
for (const system of this.systems) {
|
|
1214
|
+
try {
|
|
1215
|
+
system.update?.();
|
|
1216
|
+
}
|
|
1217
|
+
catch (e) {
|
|
1218
|
+
console.error(`${systemClassName(system.constructor)} update error`, e);
|
|
1219
|
+
}
|
|
1220
|
+
}
|
|
1221
|
+
}
|
|
1211
1222
|
notifyStateChanged() {
|
|
1212
1223
|
postParentGameState({ playing: this.playing, started: this.started }, this.pluginInitNotifyTargetOrigin);
|
|
1213
1224
|
}
|
|
1214
|
-
/** When `systems` is passed in the constructor, run async `init` for each before `loadScene` / `start`. */
|
|
1225
|
+
/** When `systems` is passed in the constructor, run async `init` for each before `loadScene` / `beforeReady` / `start`. */
|
|
1215
1226
|
async bootstrapSystemsAndMaybeStart(systemsToAdd, needScene, autoStart, onComplete) {
|
|
1216
1227
|
let error;
|
|
1217
1228
|
try {
|
|
@@ -1221,18 +1232,34 @@ class Game extends EventEmitter__default.default {
|
|
|
1221
1232
|
if (needScene) {
|
|
1222
1233
|
this.loadScene({ scene: new Scene("scene") });
|
|
1223
1234
|
}
|
|
1224
|
-
if (autoStart) {
|
|
1225
|
-
this.start();
|
|
1226
|
-
}
|
|
1227
1235
|
}
|
|
1228
1236
|
catch (e) {
|
|
1229
1237
|
error = e;
|
|
1230
1238
|
console.error("Game bootstrap failed", e);
|
|
1231
1239
|
}
|
|
1232
|
-
|
|
1233
|
-
onComplete?.(this, error);
|
|
1234
|
-
|
|
1240
|
+
try {
|
|
1241
|
+
await Promise.resolve(onComplete?.(this, error));
|
|
1242
|
+
}
|
|
1243
|
+
catch (e) {
|
|
1244
|
+
error = error ?? e;
|
|
1245
|
+
console.error("onSystemsBootstrapComplete failed", e);
|
|
1246
|
+
}
|
|
1247
|
+
if (!error) {
|
|
1248
|
+
try {
|
|
1249
|
+
this.flushObservedComponents();
|
|
1250
|
+
for (const system of this.systems) {
|
|
1251
|
+
await Promise.resolve(system.beforeReady?.());
|
|
1252
|
+
}
|
|
1253
|
+
}
|
|
1254
|
+
catch (e) {
|
|
1255
|
+
error = e;
|
|
1256
|
+
console.error("Game beforeReady failed", e);
|
|
1257
|
+
}
|
|
1258
|
+
}
|
|
1259
|
+
if (!error && autoStart) {
|
|
1260
|
+
this.start();
|
|
1235
1261
|
}
|
|
1262
|
+
this.notifyReady(error);
|
|
1236
1263
|
}
|
|
1237
1264
|
/**
|
|
1238
1265
|
* Get scene on this game
|