Add WorkAdventure logo

This commit is contained in:
Gregoire Parant 2021-01-30 20:33:31 +01:00
parent 3a046cb450
commit f99db4856f
2 changed files with 17 additions and 3 deletions

BIN
front/dist/resources/logos/logo.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

View File

@ -1,6 +1,18 @@
const LogoNameIndex: string = 'logo';
const LogoResource: string = 'resources/logos/logo.png';
export const addLoader = (scene: Phaser.Scene): void => {
const loaderPlugin = scene.load.image(LogoNameIndex, LogoResource);
loaderPlugin.spritesheet(LogoNameIndex, LogoResource);
const promiseLoadLogoTexture = new Promise<Phaser.GameObjects.Image>((res) => {
if (loaderPlugin.textureManager.exists(LogoNameIndex)) {
return res(scene.add.image(scene.game.renderer.width / 2, 100, LogoNameIndex));
}
loaderPlugin.once(`filecomplete-spritesheet-${LogoNameIndex}`, () => {
res(scene.add.image(scene.game.renderer.width / 2, 100, LogoNameIndex))
});
});
export const addLoader = (scene:Phaser.Scene): void => {
const loadingText = scene.add.text(scene.game.renderer.width / 2, 200, 'Loading');
const progress = scene.add.graphics();
scene.load.on('progress', (value: number) => {
progress.clear();
@ -8,7 +20,9 @@ export const addLoader = (scene:Phaser.Scene): void => {
progress.fillRect(0, 270, 800 * value, 60);
});
scene.load.on('complete', () => {
loadingText.destroy();
promiseLoadLogoTexture.then((resLoadingImage: Phaser.GameObjects.Image) => {
resLoadingImage.destroy();
});
progress.destroy();
});
}