Merge pull request #346 from thecodingmachine/customUserStore

improved the local storage of the the selectcharacterScene
This commit is contained in:
David Négrier 2020-10-20 17:38:54 +02:00 committed by GitHub
commit a3816cd725
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 71 additions and 83 deletions

View file

@ -1,7 +1,6 @@
import {GameScene} from "./GameScene";
import {connectionManager} from "../../Connexion/ConnectionManager";
import {Room} from "../../Connexion/Room";
import {FourOFourSceneName} from "../Reconnecting/FourOFourScene";
export interface HasMovedEvent {
direction: string;
@ -24,11 +23,7 @@ export class GameManager {
this.playerName = name;
}
public setCharacterUserSelected(characterUserSelected : string): void {
this.characterLayers = [characterUserSelected];
}
public setCharacterLayers(layers: string[]) {
public setCharacterLayers(layers: string[]): void {
this.characterLayers = layers;
}
@ -54,13 +49,6 @@ export class GameManager {
}
}
public getMapKeyByUrl(mapUrlStart: string) : string {
// FIXME: the key should be computed from the full URL of the map.
const startPos = mapUrlStart.indexOf('://')+3;
const endPos = mapUrlStart.indexOf(".json");
return mapUrlStart.substring(startPos, endPos);
}
public async goToStartingMap(scenePlugin: Phaser.Scenes.ScenePlugin) {
const url = await this.startRoom.getMapUrl();
console.log('Starting scene '+url);