Multi Scene in back end

- Change maps url to get maps
 - Change GameScene to create scene with file since back end
 - Change LoginScene to upload scene and start game
This commit is contained in:
gparant 2020-05-09 19:41:21 +02:00
parent 7f989cfd23
commit fb8d9bf9a8
8 changed files with 101 additions and 53 deletions

View file

@ -27,7 +27,11 @@ export class AuthenticateController{
return res.status(OK).send({
token: token,
roomId: ROOM,
userId: userId
userId: userId,
maps: [
"floor0",
"floor1"
]
});
});
}

View file

@ -3,33 +3,29 @@ import path from "path";
import {Application, Request, Response} from "express";
import {OK} from "http-status-codes";
const MapFloor0 = require('../Assets/Maps/Floor0/floor0.json');
const MapFloor1 = require('../Assets/Maps/Floor1/floor1.json');
export class MapController {
App: Application;
export class MapController{
App : Application;
constructor(App : Application) {
constructor(App: Application) {
this.App = App;
this.getFloor0();
this.getFloor1();
this.getMpas();
this.assetMaps();
}
assetMaps(){
this.App.use('/maps', express.static('src/Assets/Maps'));
assetMaps() {
this.App.use('/map/files', express.static('src/Assets/Maps'));
}
//permit to login on application. Return token to connect on Websocket IO.
getFloor0(){
this.App.get("/floor0", (req: Request, res: Response) => {
return res.status(OK).send(MapFloor0);
});
}
getFloor1(){
this.App.get("/floor1", (req: Request, res: Response) => {
return res.status(OK).send(MapFloor1);
getMpas() {
this.App.get("/maps", (req: Request, res: Response) => {
return res.status(OK).send({
startMapKey: "floor0",
maps: [
{mapKey: "floor0", mapUrl: "/map/files/Floor0"},
{mapKey: "floor1", mapUrl: "/map/files/Floor1"},
]
});
});
}
}