static void GameOver(object sender, GameOverArgs e) { double passed_seconds = DateTime.Now.Subtract(last_game_over).TotalSeconds; System.Diagnostics.Debug.WriteLine(String.Format("Seconds past since previous game over {0}", passed_seconds)); if (passed_seconds > 30) //Cant gameover twice in quick succession. { System.Diagnostics.Debug.WriteLine("Game over"); last_game_over = DateTime.Now; cg.Chat.Chat(String.Format(">>Unreal 300%. Faster and more lethal, with {0} months of iterative testing.", Math.Round(now.Subtract(birth).Days / (365.25 / 12)))); cg.Chat.Chat(">>If you'd like to find the server again, you can friend me so it will appear at the top of your server browser."); System.Diagnostics.Debug.WriteLine(String.Format("Winning team is {0}.", e.GetWinningTeam())); if (current_game_log != null) { current_game_log.winning_team = e.GetWinningTeam(); } RemoveBotsIfAny(); map_chooser.SetRandomMap(); if (cg.PlayerCount - num_bots < 4) { NextMap(); } else { int wait_timer = 0; while (cg.GetGameState() != GameState.Ending_Commend && wait_timer < 30) { System.Threading.Thread.Sleep(50); wait_timer++; } NextMap(); } } }
static void SetGameEnded(object sender, GameOverArgs e) { double passed_seconds = DateTime.Now.Subtract(last_game_over).TotalSeconds; if (passed_seconds > 60) //Cant gameover twice in quick succession. { System.Diagnostics.Debug.WriteLine("game ended"); last_game_over = DateTime.Now; if (current_game_log != null) { System.Diagnostics.Debug.WriteLine(String.Format("Winning team is {0}.", e.GetWinningTeam())); current_game_log.winning_team = e.GetWinningTeam(); } game_ended = true; } }