protected override void OnExiting(object sender, EventArgs args) { inGame = false; NetworkHost.shutdown(); NetworkClient.shutdown(); base.OnExiting(sender, args); }
static void Main(string[] args) { Thread backThread = new Thread(new ThreadStart(delegate() { using (Main game = new Main()) { game.Run(); } })); backThread.Start(); backThread.Join(); QuadTree.Main.inGame = false; NetworkHost.shutdown(); NetworkClient.shutdown(); }