front: revert animated loading screen logo
This commit is contained in:
parent
f910c833dd
commit
8e77e85749
1 changed files with 1 additions and 37 deletions
|
@ -2,10 +2,8 @@ import ImageFrameConfig = Phaser.Types.Loader.FileTypes.ImageFrameConfig;
|
||||||
import { DirtyScene } from "../Game/DirtyScene";
|
import { DirtyScene } from "../Game/DirtyScene";
|
||||||
|
|
||||||
const LogoNameIndex: string = "logoLoading";
|
const LogoNameIndex: string = "logoLoading";
|
||||||
const LogoAnimationNameIndex: string = "logoAnimationLoading";
|
|
||||||
const TextName: string = "Loading...";
|
const TextName: string = "Loading...";
|
||||||
const LogoResource: string = "static/images/logo.png";
|
const LogoResource: string = "static/images/logo.png";
|
||||||
const LogoAnimationResource: string = "static/images/logo.webm";
|
|
||||||
const LogoFrame: ImageFrameConfig = { frameWidth: 310, frameHeight: 60 };
|
const LogoFrame: ImageFrameConfig = { frameWidth: 310, frameHeight: 60 };
|
||||||
|
|
||||||
const loadingBarHeight: number = 16;
|
const loadingBarHeight: number = 16;
|
||||||
|
@ -16,7 +14,6 @@ export class Loader {
|
||||||
private progress!: Phaser.GameObjects.Graphics;
|
private progress!: Phaser.GameObjects.Graphics;
|
||||||
private progressAmount: number = 0;
|
private progressAmount: number = 0;
|
||||||
private logo: Phaser.GameObjects.Image | undefined;
|
private logo: Phaser.GameObjects.Image | undefined;
|
||||||
private animation: Phaser.GameObjects.Video | 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) {}
|
||||||
|
@ -30,14 +27,7 @@ export class Loader {
|
||||||
const loadingBarWidth: number = Math.floor(this.scene.game.renderer.width / 3);
|
const loadingBarWidth: number = Math.floor(this.scene.game.renderer.width / 3);
|
||||||
|
|
||||||
const promiseLoadLogoTexture = new Promise<Phaser.GameObjects.Image>((res) => {
|
const promiseLoadLogoTexture = new Promise<Phaser.GameObjects.Image>((res) => {
|
||||||
if (this.scene.load.cacheManager.video.exists(LogoAnimationNameIndex)) {
|
if (this.scene.load.textureManager.exists(LogoNameIndex)) {
|
||||||
this.animation = this.scene.add.video(
|
|
||||||
this.scene.game.renderer.width / 2,
|
|
||||||
this.scene.game.renderer.height / 2 - 150,
|
|
||||||
LogoAnimationNameIndex);
|
|
||||||
this.animation.play(true);
|
|
||||||
return res(this.animation);
|
|
||||||
} else if (this.scene.load.textureManager.exists(LogoNameIndex)) {
|
|
||||||
return res(
|
return res(
|
||||||
(this.logo = this.scene.add.image(
|
(this.logo = this.scene.add.image(
|
||||||
this.scene.game.renderer.width / 2,
|
this.scene.game.renderer.width / 2,
|
||||||
|
@ -54,14 +44,10 @@ export class Loader {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
this.scene.load.spritesheet(LogoNameIndex, LogoResource, LogoFrame);
|
this.scene.load.spritesheet(LogoNameIndex, LogoResource, LogoFrame);
|
||||||
this.scene.load.video(LogoAnimationNameIndex, LogoAnimationResource, 'loadeddata', false, true);
|
|
||||||
this.scene.load.once(`filecomplete-spritesheet-${LogoNameIndex}`, () => {
|
this.scene.load.once(`filecomplete-spritesheet-${LogoNameIndex}`, () => {
|
||||||
if (this.loadingText) {
|
if (this.loadingText) {
|
||||||
this.loadingText.destroy();
|
this.loadingText.destroy();
|
||||||
}
|
}
|
||||||
if (this.animation) {
|
|
||||||
return res(this.animation);
|
|
||||||
}
|
|
||||||
return res(
|
return res(
|
||||||
(this.logo = this.scene.add.image(
|
(this.logo = this.scene.add.image(
|
||||||
this.scene.game.renderer.width / 2,
|
this.scene.game.renderer.width / 2,
|
||||||
|
@ -70,20 +56,6 @@ export class Loader {
|
||||||
))
|
))
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
this.scene.load.once(`filecomplete-video-${LogoAnimationNameIndex}`, () => {
|
|
||||||
if (this.loadingText) {
|
|
||||||
this.loadingText.destroy();
|
|
||||||
}
|
|
||||||
if (this.logo) {
|
|
||||||
this.logo.destroy();
|
|
||||||
}
|
|
||||||
this.animation = this.scene.add.video(
|
|
||||||
this.scene.game.renderer.width / 2,
|
|
||||||
this.scene.game.renderer.height / 2 - 150,
|
|
||||||
LogoAnimationNameIndex);
|
|
||||||
this.animation.play(true);
|
|
||||||
return res(this.animation);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
this.progressContainer = this.scene.add.graphics();
|
this.progressContainer = this.scene.add.graphics();
|
||||||
|
@ -114,9 +86,6 @@ export class Loader {
|
||||||
}
|
}
|
||||||
|
|
||||||
public removeLoader(): void {
|
public removeLoader(): void {
|
||||||
if (this.scene.load.cacheManager.video.exists(LogoAnimationNameIndex)) {
|
|
||||||
this.scene.load.cacheManager.video.remove(LogoAnimationNameIndex);
|
|
||||||
}
|
|
||||||
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);
|
||||||
}
|
}
|
||||||
|
@ -145,11 +114,6 @@ export class Loader {
|
||||||
this.logo.x = this.scene.game.renderer.width / 2;
|
this.logo.x = this.scene.game.renderer.width / 2;
|
||||||
this.logo.y = this.scene.game.renderer.height / 2 - 150;
|
this.logo.y = this.scene.game.renderer.height / 2 - 150;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.animation) {
|
|
||||||
this.animation.x = this.scene.game.renderer.width / 2;
|
|
||||||
this.animation.y = this.scene.game.renderer.height / 2 - 150;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private drawProgress() {
|
private drawProgress() {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue