private void frmGameLobby_FormClosing(object sender, FormClosingEventArgs e) { if (!gameStarting) { client.Dispose(); if (lobbyMode == LobbyMode.Hosting) { server.Dispose(); } } }
public void Dispose() { // destroy the server if (netServer != null) { netServer.Dispose(); netServer = null; } // destroy all instance-specific information if (world != null) { world.Dispose(); world = null; } }