Putting the name in GameManager rather than passing it from scene to scene.
This commit is contained in:
parent
5601e5e134
commit
76b745ebea
3 changed files with 12 additions and 12 deletions
|
@ -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();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue