improvments
This commit is contained in:
parent
af4611ed29
commit
3f9659ef3c
10 changed files with 72 additions and 71 deletions
|
@ -1,4 +1,4 @@
|
|||
import {PointInterface} from "../../Connexion/Connection";
|
||||
import {PointInterface} from "../../Connexion/ConnexionModels";
|
||||
|
||||
export interface AddPlayerInterface {
|
||||
userId: number;
|
||||
|
|
|
@ -4,7 +4,7 @@ import {
|
|||
} from "../../Connexion/ConnexionModels";
|
||||
import Axios from "axios";
|
||||
import {API_URL} from "../../Enum/EnvironmentVariable";
|
||||
import {adminDataFetchPromise} from "../../register";
|
||||
import {connectionManager} from "../../Connexion/ConnectionManager";
|
||||
|
||||
export interface HasMovedEvent {
|
||||
direction: string;
|
||||
|
@ -30,23 +30,12 @@ export class GameManager {
|
|||
}
|
||||
|
||||
loadStartMap() : Promise<StartMapInterface> {
|
||||
if (adminDataFetchPromise) {
|
||||
return adminDataFetchPromise.then(data => {
|
||||
return {
|
||||
mapUrlStart: data.mapUrlStart,
|
||||
startInstance: data.startInstance,
|
||||
}
|
||||
})
|
||||
} else {
|
||||
//todo: remove this call, merge with the admin workflow?
|
||||
return Axios.get(`${API_URL}/start-map`)
|
||||
.then((res) => {
|
||||
return res.data;
|
||||
}).catch((err) => {
|
||||
console.error(err);
|
||||
throw err;
|
||||
});
|
||||
}
|
||||
return connectionManager.getMapUrlStart().then(mapUrlStart => {
|
||||
return {
|
||||
mapUrlStart: mapUrlStart,
|
||||
startInstance: "global", //todo: is this property still usefull?
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
getPlayerName(): string {
|
||||
|
|
|
@ -205,8 +205,8 @@ export class GameScene extends Phaser.Scene implements CenterListener {
|
|||
|
||||
this.connectionPromise = connectionManager.connectToRoomSocket().then((connection : RoomConnection) => {
|
||||
this.connection = connection;
|
||||
|
||||
this.connection.emitPlayerDetailsMessage(gameManager.getCharacterSelected())
|
||||
|
||||
this.connection.emitPlayerDetailsMessage(gameManager.getPlayerName(), gameManager.getCharacterSelected())
|
||||
|
||||
connection.onUserJoins((message: MessageUserJoined) => {
|
||||
const userMessage: AddPlayerInterface = {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue