Migrating userId to "int32" to save some space and adding userMoves message in protobuf

This commit is contained in:
David Négrier 2020-09-18 13:57:38 +02:00
parent 4b55b54a07
commit e9ca8721a6
31 changed files with 295 additions and 445 deletions

View file

@ -7,7 +7,9 @@ import {Movable} from "_Model/Movable";
export class Group implements Movable {
static readonly MAX_PER_GROUP = 4;
private id: string;
private static nextId: number = 1;
private id: number;
private users: Set<User>;
private connectCallback: ConnectCallback;
private disconnectCallback: DisconnectCallback;
@ -17,7 +19,8 @@ export class Group implements Movable {
this.users = new Set<User>();
this.connectCallback = connectCallback;
this.disconnectCallback = disconnectCallback;
this.id = uuid();
this.id = Group.nextId;
Group.nextId++;
users.forEach((user: User) => {
this.join(user);
@ -28,7 +31,7 @@ export class Group implements Movable {
return Array.from(this.users.values());
}
getId() : string{
getId() : number {
return this.id;
}