Fix invalid maps
This commit is contained in:
parent
2132fc0323
commit
ea49dafea4
@ -142,6 +142,9 @@ class LocalUserStore {
|
|||||||
localStorage.getItem(lastRoomUrl) ?? window.location.protocol + "//" + window.location.host + START_ROOM_URL
|
localStorage.getItem(lastRoomUrl) ?? window.location.protocol + "//" + window.location.host + START_ROOM_URL
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
removeLastRoomUrl(): void {
|
||||||
|
localStorage.removeItem(lastRoomUrl);
|
||||||
|
}
|
||||||
getLastRoomUrlCacheApi(): Promise<string | undefined> {
|
getLastRoomUrlCacheApi(): Promise<string | undefined> {
|
||||||
if (!("caches" in window)) {
|
if (!("caches" in window)) {
|
||||||
return Promise.resolve(undefined);
|
return Promise.resolve(undefined);
|
||||||
|
@ -429,7 +429,11 @@ export class GameScene extends DirtyScene {
|
|||||||
//hook create scene
|
//hook create scene
|
||||||
create(): void {
|
create(): void {
|
||||||
this.preloading = false;
|
this.preloading = false;
|
||||||
|
try {
|
||||||
this.trackDirtyAnims();
|
this.trackDirtyAnims();
|
||||||
|
} catch (e) {
|
||||||
|
console.error(e);
|
||||||
|
}
|
||||||
|
|
||||||
gameManager.gameSceneIsCreated(this);
|
gameManager.gameSceneIsCreated(this);
|
||||||
urlManager.pushRoomIdToUrl(this.room);
|
urlManager.pushRoomIdToUrl(this.room);
|
||||||
@ -455,6 +459,17 @@ export class GameScene extends DirtyScene {
|
|||||||
//initialise map
|
//initialise map
|
||||||
this.Map = this.add.tilemap(this.MapUrlFile);
|
this.Map = this.add.tilemap(this.MapUrlFile);
|
||||||
const mapDirUrl = this.MapUrlFile.substr(0, this.MapUrlFile.lastIndexOf("/"));
|
const mapDirUrl = this.MapUrlFile.substr(0, this.MapUrlFile.lastIndexOf("/"));
|
||||||
|
|
||||||
|
if (!this.mapFile && this.room.href == localUserStore.getLastRoomUrl()) {
|
||||||
|
localUserStore.removeLastRoomUrl();
|
||||||
|
this.scene.start(ErrorSceneName, {
|
||||||
|
title: "This map seems unaccessible.",
|
||||||
|
message:
|
||||||
|
"If you want more information, you may contact administrator or contact us at: partey@bstly.de",
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
this.mapFile.tilesets.forEach((tileset: ITiledTileSet) => {
|
this.mapFile.tilesets.forEach((tileset: ITiledTileSet) => {
|
||||||
this.Terrains.push(
|
this.Terrains.push(
|
||||||
this.Map.addTilesetImage(
|
this.Map.addTilesetImage(
|
||||||
|
Loading…
Reference in New Issue
Block a user