Refactoring events to connect/disconnect a user to a group
This commit is contained in:
parent
dcaf9a8e46
commit
58565a7f45
3 changed files with 19 additions and 67 deletions
|
@ -6,6 +6,9 @@ import {UserInterface} from "./UserInterface";
|
|||
import {ExSocketInterface} from "_Model/Websocket/ExSocketInterface";
|
||||
import {PositionInterface} from "_Model/PositionInterface";
|
||||
|
||||
export type ConnectCallback = (user: string, group: Group) => void;
|
||||
export type DisconnectCallback = (user: string, group: Group) => void;
|
||||
|
||||
export class World {
|
||||
static readonly MIN_DISTANCE = 160;
|
||||
|
||||
|
@ -13,10 +16,10 @@ export class World {
|
|||
private users: Map<string, UserInterface>;
|
||||
private groups: Group[];
|
||||
|
||||
private connectCallback: (user1: string, user2: string) => void;
|
||||
private disconnectCallback: (user1: string, user2: string) => void;
|
||||
private connectCallback: ConnectCallback;
|
||||
private disconnectCallback: DisconnectCallback;
|
||||
|
||||
constructor(connectCallback: (user1: string, user2: string) => void, disconnectCallback: (user1: string, user2: string) => void)
|
||||
constructor(connectCallback: ConnectCallback, disconnectCallback: DisconnectCallback)
|
||||
{
|
||||
this.users = new Map<string, UserInterface>();
|
||||
this.groups = [];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue