Properly catching promises
This commit is contained in:
parent
375f78ca30
commit
6e52f280d0
@ -45,7 +45,8 @@ export class Loader {
|
|||||||
);
|
);
|
||||||
|
|
||||||
const logoPromise = this.superLoad.image(this.logoNameIndex, logoResource);
|
const logoPromise = this.superLoad.image(this.logoNameIndex, logoResource);
|
||||||
logoPromise.then((texture) => {
|
logoPromise
|
||||||
|
.then((texture) => {
|
||||||
this.logo = this.scene.add.image(
|
this.logo = this.scene.add.image(
|
||||||
this.scene.game.renderer.width / 2,
|
this.scene.game.renderer.width / 2,
|
||||||
this.scene.game.renderer.height / 2 - 150,
|
this.scene.game.renderer.height / 2 - 150,
|
||||||
@ -53,7 +54,8 @@ export class Loader {
|
|||||||
);
|
);
|
||||||
|
|
||||||
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
|
||||||
|
.then((texture) => {
|
||||||
this.poweredByLogo = this.scene.add.image(
|
this.poweredByLogo = this.scene.add.image(
|
||||||
this.scene.game.renderer.width / 2,
|
this.scene.game.renderer.width / 2,
|
||||||
this.scene.game.renderer.height - 50,
|
this.scene.game.renderer.height - 50,
|
||||||
texture
|
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