Merge pull request #122 from thecodingmachine/reconnecting_scene
Adding a special scene to wait for server reconnection
This commit is contained in:
commit
080e08eeef
5 changed files with 96 additions and 9 deletions
|
@ -2,7 +2,7 @@ import {GameManager, gameManager, HasMovedEvent} from "./GameManager";
|
|||
import {
|
||||
GroupCreatedUpdatedMessageInterface,
|
||||
MessageUserMovedInterface,
|
||||
MessageUserPositionInterface
|
||||
MessageUserPositionInterface, PointInterface, PositionInterface
|
||||
} from "../../Connexion";
|
||||
import {CurrentGamerInterface, GamerInterface, hasMovedEventName, Player} from "../Player/Player";
|
||||
import { DEBUG_MODE, ZOOM_LEVEL} from "../../Enum/EnvironmentVariable";
|
||||
|
@ -18,6 +18,10 @@ export enum Textures {
|
|||
Player = "male1"
|
||||
}
|
||||
|
||||
interface GameSceneInitInterface {
|
||||
initPosition: PointInterface|null
|
||||
}
|
||||
|
||||
export class GameScene extends Phaser.Scene {
|
||||
GameManager : GameManager;
|
||||
Terrains : Array<Phaser.Tilemaps.Tileset>;
|
||||
|
@ -32,6 +36,7 @@ export class GameScene extends Phaser.Scene {
|
|||
startX = 704;// 22 case
|
||||
startY = 32; // 1 case
|
||||
circleTexture: CanvasTexture;
|
||||
initPosition: PositionInterface;
|
||||
|
||||
MapKey: string;
|
||||
MapUrlFile: string;
|
||||
|
@ -84,7 +89,9 @@ export class GameScene extends Phaser.Scene {
|
|||
}
|
||||
|
||||
//hook initialisation
|
||||
init() {}
|
||||
init(initData : GameSceneInitInterface) {
|
||||
this.initPosition = initData.initPosition;
|
||||
}
|
||||
|
||||
//hook create scene
|
||||
create(): void {
|
||||
|
@ -208,7 +215,13 @@ export class GameScene extends Phaser.Scene {
|
|||
/**
|
||||
* @param layer
|
||||
*/
|
||||
private startUser(layer: ITiledMapLayer){
|
||||
private startUser(layer: ITiledMapLayer): void {
|
||||
if (this.initPosition !== undefined) {
|
||||
this.startX = this.initPosition.x;
|
||||
this.startY = this.initPosition.y;
|
||||
return;
|
||||
}
|
||||
|
||||
let tiles : any = layer.data;
|
||||
tiles.forEach((objectKey : number, key: number) => {
|
||||
if(objectKey === 0){
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue