Optimize performance
This commit is contained in:
parent
e4cd3284b7
commit
b8ef90c100
31 changed files with 319 additions and 206 deletions
|
|
@ -5,7 +5,15 @@ export class CommandReceiverSocket extends CommandReceiver {
|
|||
super();
|
||||
}
|
||||
|
||||
private commandQueue: Array<Command> = [];
|
||||
protected defaultCommandExecutor(command: Command) {
|
||||
this.socket.emit(TransportEvents.PlayerToServer, serialize(command));
|
||||
this.commandQueue.push(command);
|
||||
}
|
||||
|
||||
public sendQueuedCommands() {
|
||||
if (this.commandQueue.length > 0) {
|
||||
this.socket.emit(TransportEvents.PlayerToServer, serialize(this.commandQueue));
|
||||
this.commandQueue = [];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue