Migrating Loader bar to SuperLoad and fixing Resize issue on loader

This commit is contained in:
David Négrier
2022-03-18 15:47:25 +01:00
parent c529658ef4
commit 9f79e595a5
6 changed files with 157 additions and 83 deletions
@@ -2,7 +2,7 @@ import LoaderPlugin = Phaser.Loader.LoaderPlugin;
import type { CharacterTexture } from "../../Connexion/LocalUser";
import { BodyResourceDescriptionInterface, mapLayerToLevel, PlayerTextures, PlayerTexturesKey } from "./PlayerTextures";
import CancelablePromise from "cancelable-promise";
import {SuperLoaderPlugin} from "../Services/SuperLoaderPlugin";
import { SuperLoaderPlugin } from "../Services/SuperLoaderPlugin";
import Texture = Phaser.Textures.Texture;
export interface FrameConfig {
@@ -52,11 +52,13 @@ export const lazyLoadPlayerCharacterTextures = (
): CancelablePromise<string[]> => {
const promisesList: CancelablePromise<Texture>[] = [];
for (const texture of textures) {
promisesList.push(superLoaderPlugin.spritesheet(texture.id, texture.img, {
frameWidth: 32,
frameHeight: 32,
}));
};
promisesList.push(
superLoaderPlugin.spritesheet(texture.id, texture.img, {
frameWidth: 32,
frameHeight: 32,
})
);
}
const returnPromise: CancelablePromise<Texture[]> = CancelablePromise.all(promisesList);
return returnPromise.then(() =>