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:
parent
7f989cfd23
commit
fb8d9bf9a8
8 changed files with 101 additions and 53 deletions
|
@ -13,7 +13,7 @@ class App {
|
|||
public server: http.Server;
|
||||
public ioSocketController: IoSocketController;
|
||||
public authenticateController: AuthenticateController;
|
||||
public AuthenticateMiddleware: AuthenticateMiddleware;
|
||||
//public AuthenticateMiddleware: AuthenticateMiddleware;
|
||||
public mapController: MapController;
|
||||
|
||||
constructor() {
|
||||
|
@ -26,7 +26,7 @@ class App {
|
|||
//create socket controllers
|
||||
this.ioSocketController = new IoSocketController(this.server);
|
||||
this.authenticateController = new AuthenticateController(this.app);
|
||||
this.AuthenticateMiddleware = new AuthenticateMiddleware(this.app);
|
||||
//this.AuthenticateMiddleware = new AuthenticateMiddleware(this.app);
|
||||
this.mapController = new MapController(this.app);
|
||||
}
|
||||
|
||||
|
|
|
@ -27,7 +27,11 @@ export class AuthenticateController{
|
|||
return res.status(OK).send({
|
||||
token: token,
|
||||
roomId: ROOM,
|
||||
userId: userId
|
||||
userId: userId,
|
||||
maps: [
|
||||
"floor0",
|
||||
"floor1"
|
||||
]
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
|
@ -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"},
|
||||
]
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue