private void OnDisconnected(object sender, DisconnectedEventArgs e) { try { if (Player.Game != null) { Player.Game.HandleRemovePlayer(Id, DisconnectReason.ExitGame); } } catch (Exception ex) { Logger.Error(ex, "Exception caught in client disconnection."); } _clientManager.Remove(this); }
public override async ValueTask HandleDisconnectAsync(string reason) { try { if (Player != null) { await Player.Game.HandleRemovePlayer(Id, DisconnectReason.ExitGame); } } catch (Exception ex) { _logger.LogError(ex, "Exception caught in client disconnection."); } _logger.LogInformation("Client {0} disconnecting, reason: {1}", Id, reason); _clientManager.Remove(this); }