Fixing loading of same custom texture several time

Phaser 3 does not trigger oncomplete event if the resource is already loaded.
This commit is contained in:
David Négrier 2020-10-21 10:34:55 +02:00
parent c03dd4c551
commit 45c6e13cad

View File

@ -1266,6 +1266,10 @@ export class GameScene extends ResizableScene implements CenterListener {
private loadSpritesheet(name: string, url: string): Promise<void> { private loadSpritesheet(name: string, url: string): Promise<void> {
return new Promise<void>(((resolve, reject) => { return new Promise<void>(((resolve, reject) => {
if (this.textures.exists(name)) {
resolve();
return;
}
this.load.spritesheet( this.load.spritesheet(
name, name,
url, url,