import Texture = Phaser.Textures.Texture;
import Sprite = Phaser.GameObjects.Sprite;
import CanvasTexture = Phaser.Textures.CanvasTexture;
+import {Floor1Name} from "./GameSceneFloor1";
-export const GameSceneName = "GameScene";
export enum Textures {
- Player = 'male1',
- Map = 'map'
+ Player = "male1",
+ Map = 'floor0',
+ MapUrl = 'maps/floor0.json'
}
+export const Floor0Name = "Floor0";
+
export interface GameSceneInterface extends Phaser.Scene {
Map: Phaser.Tilemaps.Tilemap;
createCurrentPlayer(UserId : string) : void;
shareUserPosition(UsersPosition : Array<MessageUserPositionInterface>): void;
+ shareGroupPosition(groupPositionMessage: GroupCreatedUpdatedMessageInterface): void;
+ updateOrCreateMapPlayer(UsersPosition : Array<MessageUserPositionInterface>): void;
+ deleteGroup(groupId: string): void;
}
export class GameScene extends Phaser.Scene implements GameSceneInterface{
GameManager : GameManager;
constructor() {
super({
- key: GameSceneName
+ key: Floor0Name
});
this.GameManager = gameManager;
this.Terrains = [];
//hook preload scene
preload(): void {
this.GameManager.setCurrentGameScene(this);
- let mapUrl = 'maps/map.json';
this.load.on('filecomplete-tilemapJSON-'+Textures.Map, (key: string, type: string, data: any) => {
// Triggered when the map is loaded
// Load tiles attached to the map recursively
console.warn("Don't know how to handle tileset ", tileset)
return;
}
- let path = mapUrl.substr(0, mapUrl.lastIndexOf('/'));
+ let path = Textures.MapUrl.substr(0, Textures.MapUrl.lastIndexOf('/'));
this.load.image(tileset.name, path + '/' + tileset.image);
})
});
- this.load.tilemapTiledJSON(Textures.Map, mapUrl);
+ this.load.tilemapTiledJSON(Textures.Map, Textures.MapUrl);
//add player png
PLAYER_RESOURCES.forEach((playerResource: any) => {
}
//hook initialisation
- init() {
- }
+ init() {}
//hook create scene
create(): void {
//initalise map
- this.Map = this.add.tilemap("map");
+ this.Map = this.add.tilemap(Textures.Map);
this.map.tilesets.forEach((tileset: ITiledTileSet) => {
this.Terrains.push(this.Map.addTilesetImage(tileset.name, tileset.name));
});
* Create new player
* @param MessageUserPosition
*/
- addPlayer(MessageUserPosition : MessageUserPositionInterface){
+ addPlayer(MessageUserPosition : MessageUserPositionInterface) : void{
//initialise player
let player = new Player(
MessageUserPosition.userId,
import {TextField} from "../Components/TextField";
import {TextInput} from "../Components/TextInput";
import {ClickButton} from "../Components/ClickButton";
-import {GameSceneInterface, GameSceneName, Textures} from "../Game/GameScene";
+import {GameSceneInterface, Floor0Name, Textures} from "../Game/GameScene";
import Image = Phaser.GameObjects.Image;
import {Player} from "../Player/Player";
import {getPlayerAnimations, PlayerAnimationNames} from "../Player/Animation";
import Rectangle = Phaser.GameObjects.Rectangle;
import {PLAYER_RESOURCES} from "../Entity/PlayableCaracter";
import {cypressAsserter} from "../../Cypress/CypressAsserter";
+import {GroupCreatedUpdatedMessageInterface, MessageUserPositionInterface} from "../../Connexion";
//todo: put this constants in a dedicated file
export const LoginSceneName = "LoginScene";
private async login(name: string) {
gameManager.connect(name, this.selectedPlayer.texture.key).then(() => {
- this.scene.start(GameSceneName);
+ this.scene.start(Floor0Name);
});
}
shareUserPosition(UsersPosition: import("../../Connexion").MessageUserPositionInterface[]): void {
throw new Error("Method not implemented.");
}
+
+ deleteGroup(groupId: string): void {
+ throw new Error("Method not implemented.");
+ }
+
+ shareGroupPosition(groupPositionMessage: GroupCreatedUpdatedMessageInterface): void {
+ throw new Error("Method not implemented.");
+ }
+
+ updateOrCreateMapPlayer(UsersPosition: Array<MessageUserPositionInterface>): void {
+ throw new Error("Method not implemented.");
+ }
}