Merge branch 'master' into feature/back-players-proximity

# Conflicts:
#	back/src/Model/Websocket/MessageUserPosition.ts
This commit is contained in:
gparant 2020-04-26 23:31:40 +02:00
commit 9730df2295
47 changed files with 3083 additions and 254 deletions

View file

@ -4,19 +4,22 @@ import {PointInterface} from "./PointInterface";
export class Point implements PointInterface{
x: number;
y: number;
direction: string;
constructor(x : number, y : number) {
constructor(x : number, y : number, direction : string = "none") {
if(x === null || y === null){
throw Error("position x and y cannot be null");
}
this.x = x;
this.y = y;
this.direction = direction;
}
toJson(){
return {
x : this.x,
y: this.y
y: this.y,
direction: this.direction
}
}
}
@ -24,9 +27,10 @@ export class Point implements PointInterface{
export class MessageUserPosition extends Message{
position: PointInterface;
constructor(data: any) {
super(data);
this.position = new Point(data.position.x, data.position.y);
constructor(message: string) {
super(message);
let data = JSON.parse(message);
this.position = new Point(data.position.x, data.position.y, data.position.direction);
}
toString() {

View file

@ -1,5 +1,6 @@
export interface PointInterface {
x: number;
y: number;
direction: string;
toJson() : object;
}