@@ -197,7 +197,7 @@
|
|
197
197
|
private onVisibilityChanged = () => {
|
198
198
|
switch (document.visibilityState) {
|
199
199
|
case "hidden":
|
200
|
-
if (this.playInBackground === false) {
|
200
|
+
if (this.playInBackground === false || utils.isMobileDevice()) {
|
201
201
|
this.wasPlaying = this.isPlaying;
|
202
202
|
if (this.isPlaying) {
|
203
203
|
this.pause();
|
@@ -1,4 +1,9 @@
|
|
1
1
|
|
2
2
|
//@ts-ignore
|
3
3
|
import _logo from "./logo.svg"
|
4
|
-
|
4
|
+
let logoUrl = _logo;
|
5
|
+
// in next dev mode the logo is { src: string }
|
6
|
+
if (typeof logoUrl === "object") {
|
7
|
+
logoUrl = (logoUrl as any).src;
|
8
|
+
}
|
9
|
+
export const logoSVG: string = logoUrl;
|
@@ -663,6 +663,9 @@
|
|
663
663
|
}
|
664
664
|
}
|
665
665
|
|
666
|
+
@serializable()
|
667
|
+
playOnAwake: boolean = true;
|
668
|
+
|
666
669
|
@serializable(ColorOverLifetimeModule)
|
667
670
|
readonly colorOverLifetime!: ColorOverLifetimeModule;
|
668
671
|
|
@@ -881,7 +884,9 @@
|
|
881
884
|
this.inheritVelocity.system = this;
|
882
885
|
if (this._batchSystem)
|
883
886
|
this._batchSystem.visible = true;
|
884
|
-
this.
|
887
|
+
if (this.playOnAwake)
|
888
|
+
this.play();
|
889
|
+
this._isPlaying = this.playOnAwake;
|
885
890
|
}
|
886
891
|
|
887
892
|
onDisable() {
|
@@ -77,6 +77,10 @@
|
|
77
77
|
|
78
78
|
private _preloadScheduler?: PreLoadScheduler;
|
79
79
|
|
80
|
+
awake(): void {
|
81
|
+
if(debug) console.log("SceneSwitcher", this);
|
82
|
+
}
|
83
|
+
|
80
84
|
async start() {
|
81
85
|
if (this._currentIndex === -1 && !await this.tryLoadFromQueryParam()) {
|
82
86
|
const value = this.context.domElement.getAttribute(ENGINE_ELEMENT_SCENE_ATTRIBUTE_NAME);
|
@@ -351,12 +355,12 @@
|
|
351
355
|
maxConcurrent: number;
|
352
356
|
|
353
357
|
private _isRunning: boolean = false;
|
354
|
-
private
|
355
|
-
private
|
358
|
+
private _switcher: SceneSwitcher;
|
359
|
+
private _loadTasks: LoadTask[] = [];
|
356
360
|
private _maxConcurrentLoads: number = 1;
|
357
361
|
|
358
362
|
constructor(rooms: SceneSwitcher, ahead: number = 1, behind: number = 1, maxConcurrent: number = 2) {
|
359
|
-
this.
|
363
|
+
this._switcher = rooms;
|
360
364
|
this.maxLoadAhead = ahead;
|
361
365
|
this.maxLoadBehind = behind;
|
362
366
|
this.maxConcurrent = maxConcurrent;
|
@@ -369,7 +373,7 @@
|
|
369
373
|
let lastRoom: number = -1;
|
370
374
|
let searchDistance: number;
|
371
375
|
let searchCall: number;
|
372
|
-
const array = this.
|
376
|
+
const array = this._switcher.scenes;
|
373
377
|
let interval = setInterval(() => {
|
374
378
|
if (this.allLoaded()) {
|
375
379
|
if (debug)
|
@@ -381,8 +385,8 @@
|
|
381
385
|
return;
|
382
386
|
}
|
383
387
|
if (this.canLoadNewScene() === false) return;
|
384
|
-
if (lastRoom !== this.
|
385
|
-
lastRoom = this.
|
388
|
+
if (lastRoom !== this._switcher.currentIndex) {
|
389
|
+
lastRoom = this._switcher.currentIndex;
|
386
390
|
searchCall = 0;
|
387
391
|
searchDistance = 0;
|
388
392
|
}
|
@@ -396,7 +400,7 @@
|
|
396
400
|
// if (roomIndex < 0) roomIndex = array.length + roomIndex;
|
397
401
|
if (roomIndex < 0 || roomIndex >= array.length) return;
|
398
402
|
const scene = array[roomIndex];
|
399
|
-
new LoadTask(roomIndex, scene, this.
|
403
|
+
new LoadTask(roomIndex, scene, this._loadTasks);
|
400
404
|
}, 200);
|
401
405
|
}
|
402
406
|
|
@@ -405,12 +409,12 @@
|
|
405
409
|
}
|
406
410
|
|
407
411
|
canLoadNewScene(): boolean {
|
408
|
-
return this.
|
412
|
+
return this._loadTasks.length < this._maxConcurrentLoads;
|
409
413
|
}
|
410
414
|
|
411
415
|
allLoaded(): boolean {
|
412
|
-
for (const
|
413
|
-
if (
|
416
|
+
for (const scene of this._switcher.scenes) {
|
417
|
+
if (scene?.isLoaded() === false) return false;
|
414
418
|
}
|
415
419
|
return true;
|
416
420
|
}
|