Making the loader resizable
This way, if the window is resized while loading, the loading bar will stay in the middle
This commit is contained in:
parent
dfad0a7b57
commit
7c6105d93a
5 changed files with 121 additions and 69 deletions
|
@ -28,7 +28,7 @@ import { localUserStore } from "../../Connexion/LocalUserStore";
|
|||
import { HtmlUtils } from "../../WebRtc/HtmlUtils";
|
||||
import { mediaManager } from "../../WebRtc/MediaManager";
|
||||
import { SimplePeer } from "../../WebRtc/SimplePeer";
|
||||
import { addLoader, removeLoader } from "../Components/Loader";
|
||||
import { Loader } from "../Components/Loader";
|
||||
import { lazyLoadPlayerCharacterTextures, loadCustomTexture } from "../Entity/PlayerTexturesLoadingManager";
|
||||
import { RemotePlayer } from "../Entity/RemotePlayer";
|
||||
import type { ActionableItem } from "../Items/ActionableItem";
|
||||
|
@ -203,6 +203,7 @@ export class GameScene extends DirtyScene {
|
|||
private sharedVariablesManager!: SharedVariablesManager;
|
||||
private objectsByType = new Map<string, ITiledMapObject[]>();
|
||||
private embeddedWebsiteManager!: EmbeddedWebsiteManager;
|
||||
private loader: Loader;
|
||||
|
||||
constructor(private room: Room, MapUrlFile: string, customKey?: string | undefined) {
|
||||
super({
|
||||
|
@ -221,6 +222,7 @@ export class GameScene extends DirtyScene {
|
|||
this.connectionAnswerPromise = new Promise<RoomJoinedMessageInterface>((resolve, reject): void => {
|
||||
this.connectionAnswerPromiseResolve = resolve;
|
||||
});
|
||||
this.loader = new Loader(this);
|
||||
}
|
||||
|
||||
//hook preload scene
|
||||
|
@ -297,7 +299,7 @@ export class GameScene extends DirtyScene {
|
|||
//if SpriteSheetFile (WOKA file) don't display error and give an access for user
|
||||
if (this.preloading && !(file instanceof SpriteSheetFile)) {
|
||||
//remove loader in progress
|
||||
removeLoader(this);
|
||||
this.loader.removeLoader();
|
||||
|
||||
//display an error scene
|
||||
this.scene.start(ErrorSceneName, {
|
||||
|
@ -331,7 +333,7 @@ export class GameScene extends DirtyScene {
|
|||
});
|
||||
|
||||
//this function must stay at the end of preload function
|
||||
addLoader(this);
|
||||
this.loader.addLoader();
|
||||
}
|
||||
|
||||
// FIXME: we need to put a "unknown" instead of a "any" and validate the structure of the JSON we are receiving.
|
||||
|
@ -1832,6 +1834,8 @@ ${escapedMessage}
|
|||
right: camera.scrollX + camera.width,
|
||||
bottom: camera.scrollY + camera.height,
|
||||
});
|
||||
|
||||
this.loader.resize();
|
||||
}
|
||||
private getObjectLayerData(objectName: string): ITiledMapObject | undefined {
|
||||
for (const layer of this.mapFile.layers) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue