Properly catching promises
This commit is contained in:
parent
375f78ca30
commit
6e52f280d0
@ -45,15 +45,17 @@ export class Loader {
|
|||||||
);
|
);
|
||||||
|
|
||||||
const logoPromise = this.superLoad.image(this.logoNameIndex, logoResource);
|
const logoPromise = this.superLoad.image(this.logoNameIndex, logoResource);
|
||||||
logoPromise.then((texture) => {
|
logoPromise
|
||||||
this.logo = this.scene.add.image(
|
.then((texture) => {
|
||||||
this.scene.game.renderer.width / 2,
|
this.logo = this.scene.add.image(
|
||||||
this.scene.game.renderer.height / 2 - 150,
|
this.scene.game.renderer.width / 2,
|
||||||
texture
|
this.scene.game.renderer.height / 2 - 150,
|
||||||
);
|
texture
|
||||||
|
);
|
||||||
|
|
||||||
this.loadingText?.destroy();
|
this.loadingText?.destroy();
|
||||||
});
|
})
|
||||||
|
.catch((e) => console.warn("Could not load logo: ", logoResource, e));
|
||||||
|
|
||||||
let poweredByLogoPromise: CancelablePromise<Texture> | undefined;
|
let poweredByLogoPromise: CancelablePromise<Texture> | undefined;
|
||||||
if (gameManager.currentStartedRoom.loadingLogo) {
|
if (gameManager.currentStartedRoom.loadingLogo) {
|
||||||
@ -61,13 +63,17 @@ export class Loader {
|
|||||||
"poweredByLogo",
|
"poweredByLogo",
|
||||||
"static/images/Powered_By_WorkAdventure_Small.png"
|
"static/images/Powered_By_WorkAdventure_Small.png"
|
||||||
);
|
);
|
||||||
poweredByLogoPromise.then((texture) => {
|
poweredByLogoPromise
|
||||||
this.poweredByLogo = this.scene.add.image(
|
.then((texture) => {
|
||||||
this.scene.game.renderer.width / 2,
|
this.poweredByLogo = this.scene.add.image(
|
||||||
this.scene.game.renderer.height - 50,
|
this.scene.game.renderer.width / 2,
|
||||||
texture
|
this.scene.game.renderer.height - 50,
|
||||||
|
texture
|
||||||
|
);
|
||||||
|
})
|
||||||
|
.catch((e) =>
|
||||||
|
console.warn('Could not load image "static/images/Powered_By_WorkAdventure_Small.png"', e)
|
||||||
);
|
);
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this.progressContainer = this.scene.add.graphics();
|
this.progressContainer = this.scene.add.graphics();
|
||||||
|
Loading…
Reference in New Issue
Block a user