parent
cd7763770e
commit
cd586a9e0c
@ -8,7 +8,7 @@ export class MapController {
|
|||||||
|
|
||||||
constructor(App: Application) {
|
constructor(App: Application) {
|
||||||
this.App = App;
|
this.App = App;
|
||||||
this.getMaps();
|
this.getStartMap();
|
||||||
this.assetMaps();
|
this.assetMaps();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -17,8 +17,8 @@ export class MapController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Returns a map mapping map name to file name of the map
|
// Returns a map mapping map name to file name of the map
|
||||||
getMaps() {
|
getStartMap() {
|
||||||
this.App.get("/maps", (req: Request, res: Response) => {
|
this.App.get("/start-map", (req: Request, res: Response) => {
|
||||||
return res.status(OK).send({
|
return res.status(OK).send({
|
||||||
mapUrlStart: req.headers.host + "/map/files" + URL_ROOM_STARTED,
|
mapUrlStart: req.headers.host + "/map/files" + URL_ROOM_STARTED,
|
||||||
startInstance: "global"
|
startInstance: "global"
|
||||||
|
@ -128,7 +128,7 @@ export interface ConnexionInterface {
|
|||||||
|
|
||||||
createConnexion(name: string, characterSelected: string): Promise<any>;
|
createConnexion(name: string, characterSelected: string): Promise<any>;
|
||||||
|
|
||||||
loadMaps(): Promise<any>;
|
loadStartMap(): Promise<any>;
|
||||||
|
|
||||||
joinARoom(roomId: string, startX: number, startY: number, direction: string, moving: boolean): void;
|
joinARoom(roomId: string, startX: number, startY: number, direction: string, moving: boolean): void;
|
||||||
|
|
||||||
@ -230,8 +230,8 @@ export class Connexion implements ConnexionInterface {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//TODO add middleware with access token to secure api
|
//TODO add middleware with access token to secure api
|
||||||
loadMaps() : Promise<any> {
|
loadStartMap() : Promise<any> {
|
||||||
return Axios.get(`${API_URL}/maps`)
|
return Axios.get(`${API_URL}/start-map`)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
return res.data;
|
return res.data;
|
||||||
}).catch((err) => {
|
}).catch((err) => {
|
||||||
|
@ -54,8 +54,8 @@ export class GameManager {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
loadMaps(){
|
loadStartMap(){
|
||||||
return this.ConnexionInstance.loadMaps().then((data) => {
|
return this.ConnexionInstance.loadStartMap().then((data) => {
|
||||||
return data;
|
return data;
|
||||||
}).catch((err) => {
|
}).catch((err) => {
|
||||||
throw err;
|
throw err;
|
||||||
|
@ -101,7 +101,7 @@ export class LogincScene extends Phaser.Scene {
|
|||||||
return mapUrl;
|
return mapUrl;
|
||||||
} else {
|
} else {
|
||||||
// If we do not have a map address in the URL, let's ask the server for a start map.
|
// If we do not have a map address in the URL, let's ask the server for a start map.
|
||||||
return gameManager.loadMaps().then((scene : any) => {
|
return gameManager.loadStartMap().then((scene : any) => {
|
||||||
if (!scene) {
|
if (!scene) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user