public async Task HandleJsonMessage(Room room, dynamic jsonObj) { JsonReceivedEventArgs args = new JsonReceivedEventArgs(room, jsonObj); if (jsonObj.command == Constants.JsonCommands.ClientCommands.POWER_UP) { await Task.Run(() => OnPowerUpEvent?.Invoke(this, args)); return; } if (jsonObj.command == Constants.JsonCommands.ClientCommands.MOVE_TO) { await Task.Run(() => OnMoveToEvent?.Invoke(this, args)); return; } if (jsonObj.command == Constants.JsonCommands.ClientCommands.UPGRADE_TOWER) { await Task.Run(() => UpgradeTowerEvent?.Invoke(this, args)); return; } if (jsonObj.command == Constants.JsonCommands.ClientCommands.ARRIVED_TO) { await AnalyzeCommandBagAsync(jsonObj, args); } }
public override async Task Handle(Room room, dynamic jsonObj) { JsonReceivedEventArgs args = new JsonReceivedEventArgs(room, jsonObj); if (jsonObj.command == Constants.JsonCommands.ClientCommands.MOVE_TO) { await Task.Run(() => OnMoveToEvent?.Invoke(this, args)); } else { await base.Handle((Room)room, (object)jsonObj); } }