FIX: room id is now pushed to the url
This commit is contained in:
parent
48b856f836
commit
65785240e1
@ -301,6 +301,7 @@ export class GameScene extends ResizableScene implements CenterListener {
|
|||||||
|
|
||||||
//hook create scene
|
//hook create scene
|
||||||
create(): void {
|
create(): void {
|
||||||
|
urlManager.pushRoomIdToUrl(this.room);
|
||||||
this.startLayerName = urlManager.getStartLayerNameFromUrl();
|
this.startLayerName = urlManager.getStartLayerNameFromUrl();
|
||||||
|
|
||||||
//initalise map
|
//initalise map
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
import {Room} from "../Connexion/Room";
|
||||||
|
|
||||||
export enum GameConnexionTypes {
|
export enum GameConnexionTypes {
|
||||||
anonymous=1,
|
anonymous=1,
|
||||||
@ -45,6 +46,12 @@ class UrlManager {
|
|||||||
return newUrl;
|
return newUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public pushRoomIdToUrl(room:Room): void {
|
||||||
|
if (window.location.pathname === room.id) return;
|
||||||
|
const hash = window.location.hash;
|
||||||
|
history.pushState({}, 'WorkAdventure', room.id+hash);
|
||||||
|
}
|
||||||
|
|
||||||
public getStartLayerNameFromUrl(): string|null {
|
public getStartLayerNameFromUrl(): string|null {
|
||||||
const hash = window.location.hash;
|
const hash = window.location.hash;
|
||||||
return hash.length > 1 ? hash.substring(1) : null;
|
return hash.length > 1 ? hash.substring(1) : null;
|
||||||
|
Loading…
Reference in New Issue
Block a user