Prettier fixes on front

This commit is contained in:
David Négrier 2021-11-24 15:31:17 +01:00
parent 9b29fde1b3
commit 07ba532c5e
2 changed files with 18 additions and 8 deletions

View file

@ -16,8 +16,7 @@ export class Loader {
private logo: Phaser.GameObjects.Image | undefined; private logo: Phaser.GameObjects.Image | undefined;
private loadingText: Phaser.GameObjects.Text | null = null; private loadingText: Phaser.GameObjects.Text | null = null;
public constructor(private scene: Phaser.Scene) { public constructor(private scene: Phaser.Scene) {}
}
public addLoader(): void { public addLoader(): void {
// If there is nothing to load, do not display the loader. // If there is nothing to load, do not display the loader.
@ -30,11 +29,19 @@ export class Loader {
const promiseLoadLogoTexture = new Promise<Phaser.GameObjects.Image>((res) => { const promiseLoadLogoTexture = new Promise<Phaser.GameObjects.Image>((res) => {
if (this.scene.load.textureManager.exists(LogoNameIndex)) { if (this.scene.load.textureManager.exists(LogoNameIndex)) {
return res( return res(
this.logo = this.scene.add.image(this.scene.game.renderer.width / 2, this.scene.game.renderer.height / 2 - 150, LogoNameIndex) (this.logo = this.scene.add.image(
this.scene.game.renderer.width / 2,
this.scene.game.renderer.height / 2 - 150,
LogoNameIndex
))
); );
} else { } else {
//add loading if logo image is not ready //add loading if logo image is not ready
this.loadingText = this.scene.add.text(this.scene.game.renderer.width / 2, this.scene.game.renderer.height / 2 - 50, TextName); this.loadingText = this.scene.add.text(
this.scene.game.renderer.width / 2,
this.scene.game.renderer.height / 2 - 50,
TextName
);
} }
this.scene.load.spritesheet(LogoNameIndex, LogoResource, LogoFrame); this.scene.load.spritesheet(LogoNameIndex, LogoResource, LogoFrame);
this.scene.load.once(`filecomplete-spritesheet-${LogoNameIndex}`, () => { this.scene.load.once(`filecomplete-spritesheet-${LogoNameIndex}`, () => {
@ -42,7 +49,11 @@ export class Loader {
this.loadingText.destroy(); this.loadingText.destroy();
} }
return res( return res(
this.logo = this.scene.add.image(this.scene.game.renderer.width / 2, this.scene.game.renderer.height / 2 - 150, LogoNameIndex) (this.logo = this.scene.add.image(
this.scene.game.renderer.width / 2,
this.scene.game.renderer.height / 2 - 150,
LogoNameIndex
))
); );
}); });
}); });
@ -72,7 +83,6 @@ export class Loader {
}); });
} }
public removeLoader(): void { public removeLoader(): void {
if (this.scene.load.textureManager.exists(LogoNameIndex)) { if (this.scene.load.textureManager.exists(LogoNameIndex)) {
this.scene.load.textureManager.remove(LogoNameIndex); this.scene.load.textureManager.remove(LogoNameIndex);