Putting the name in GameManager rather than passing it from scene to scene.
This commit is contained in:
@@ -15,14 +15,16 @@ export class GameManager {
|
||||
status: number;
|
||||
private ConnexionInstance: Connexion;
|
||||
private currentGameScene: GameScene;
|
||||
private playerName: string;
|
||||
SimplePeer : SimplePeerInterface;
|
||||
|
||||
constructor() {
|
||||
this.status = StatusGameManagerEnum.IN_PROGRESS;
|
||||
}
|
||||
|
||||
connect(email:string) {
|
||||
this.ConnexionInstance = new Connexion(email, this);
|
||||
|
||||
connect(name:string) {
|
||||
this.playerName = name;
|
||||
this.ConnexionInstance = new Connexion(name, this);
|
||||
ConnexionInstance = this.ConnexionInstance;
|
||||
return this.ConnexionInstance.createConnexion().then(() => {
|
||||
this.SimplePeer = new SimplePeer(ConnexionInstance);
|
||||
@@ -57,6 +59,10 @@ export class GameManager {
|
||||
console.error(e);
|
||||
}
|
||||
}
|
||||
|
||||
getPlayerName(): string {
|
||||
return this.playerName;
|
||||
}
|
||||
}
|
||||
|
||||
export const gameManager = new GameManager();
|
||||
export const gameManager = new GameManager();
|
||||
|
||||
Reference in New Issue
Block a user