private void HandleAuthenticatedClientDisconnected(object sender, EventArgs e) { Connection connection = sender as Connection; onNewEntityHandlers.Remove(connection); onRemovedEntityHandlers.Remove(connection); UpdateQueue.StopClientUpdates(connection); authenticatedClients.Remove(connection); if (ClientDisconnected != null) { ClientDisconnected(this, new ClientConnectionEventArgs(connection)); } }
private void HandleAuthenticatedClientDisconnected(object sender, EventArgs e) { Connection connection = sender as Connection; if (onNewEntityHandlers.ContainsKey(connection)) { foreach (var handler in onNewEntityHandlers[connection]) { World.Instance.AddedEntity -= handler; } } if (onRemovedEntityHandlers.ContainsKey(connection)) { foreach (var handler in onRemovedEntityHandlers[connection]) { World.Instance.RemovedEntity -= handler; } } UpdateQueue.StopClientUpdates(connection); authenticatedClients.Remove(connection); }