2020-09-16 16:06:43 +02:00
|
|
|
import { Group } from "./Group";
|
|
|
|
import { PointInterface } from "./Websocket/PointInterface";
|
|
|
|
import {Zone} from "_Model/Zone";
|
|
|
|
import {Movable} from "_Model/Movable";
|
|
|
|
import {PositionInterface} from "_Model/PositionInterface";
|
2020-09-25 15:25:06 +02:00
|
|
|
import {PositionNotifier} from "_Model/PositionNotifier";
|
2020-09-29 16:01:22 +02:00
|
|
|
import {ExSocketInterface} from "_Model/Websocket/ExSocketInterface";
|
2020-09-16 16:06:43 +02:00
|
|
|
|
|
|
|
export class User implements Movable {
|
|
|
|
public listenedZones: Set<Zone>;
|
|
|
|
public group?: Group;
|
|
|
|
|
|
|
|
public constructor(
|
2020-09-18 13:57:38 +02:00
|
|
|
public id: number,
|
2020-10-16 14:36:43 +02:00
|
|
|
public uuid: string,
|
2020-09-25 15:25:06 +02:00
|
|
|
private position: PointInterface,
|
2020-09-16 16:06:43 +02:00
|
|
|
public silent: boolean,
|
2020-09-29 16:01:22 +02:00
|
|
|
private positionNotifier: PositionNotifier,
|
|
|
|
public readonly socket: ExSocketInterface
|
2020-09-16 16:06:43 +02:00
|
|
|
) {
|
|
|
|
this.listenedZones = new Set<Zone>();
|
2020-09-25 15:25:06 +02:00
|
|
|
|
|
|
|
this.positionNotifier.enter(this);
|
2020-09-16 16:06:43 +02:00
|
|
|
}
|
|
|
|
|
2020-09-25 15:25:06 +02:00
|
|
|
public getPosition(): PointInterface {
|
2020-09-16 16:06:43 +02:00
|
|
|
return this.position;
|
|
|
|
}
|
2020-09-25 15:25:06 +02:00
|
|
|
|
|
|
|
public setPosition(position: PointInterface): void {
|
|
|
|
const oldPosition = this.position;
|
|
|
|
this.position = position;
|
|
|
|
this.positionNotifier.updatePosition(this, position, oldPosition);
|
|
|
|
}
|
2020-09-16 16:06:43 +02:00
|
|
|
}
|