Adding a special scene to wait for server reconnection
This commit is contained in:
parent
ab798b1c09
commit
36858f8747
5 changed files with 78 additions and 7 deletions
|
@ -2,12 +2,18 @@ import {GameScene} from "./GameScene";
|
|||
import {
|
||||
Connexion,
|
||||
GroupCreatedUpdatedMessageInterface,
|
||||
ListMessageUserPositionInterface, MessageUserJoined, MessageUserMovedInterface, MessageUserPositionInterface, Point
|
||||
ListMessageUserPositionInterface,
|
||||
MessageUserJoined,
|
||||
MessageUserMovedInterface,
|
||||
MessageUserPositionInterface,
|
||||
Point,
|
||||
PointInterface
|
||||
} from "../../Connexion";
|
||||
import {SimplePeerInterface, SimplePeer} from "../../WebRtc/SimplePeer";
|
||||
import {getMapKeyByUrl} from "../Login/LogincScene";
|
||||
import ScenePlugin = Phaser.Scenes.ScenePlugin;
|
||||
import {AddPlayerInterface} from "./AddPlayerInterface";
|
||||
import {ReconnectingSceneName} from "../Reconnecting/ReconnectingScene";
|
||||
|
||||
export enum StatusGameManagerEnum {
|
||||
IN_PROGRESS = 1,
|
||||
|
@ -174,6 +180,16 @@ export class GameManager {
|
|||
}
|
||||
return sceneKey;
|
||||
}
|
||||
|
||||
private oldSceneKey : string;
|
||||
switchToDisconnectedScene(): void {
|
||||
this.oldSceneKey = this.currentGameScene.scene.key;
|
||||
this.currentGameScene.scene.start(ReconnectingSceneName);
|
||||
}
|
||||
|
||||
reconnectToGameScene(lastPositionShared: PointInterface) {
|
||||
this.currentGameScene.scene.start(this.oldSceneKey, { initPosition: lastPositionShared });
|
||||
}
|
||||
}
|
||||
|
||||
export const gameManager = new GameManager();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue