private void StartGame() { MusicEngine.ButtonSoundEffect(); // kod som startar och lagrar spel i databas try { if (AreAllPlayersBots() == false) { Game game = new Game(); DbOperations.CreateNewGameId(Selected_game_type.Gametype_id); game = DbOperations.GetGameId(); foreach (var player in Selected_players) { DbOperations.StartNewGame(game.Game_Id, player.Player_id); } ActiveGame.SetActiveGame(Selected_players, game.Game_Id, game.Start, game.End, Selected_game_type); if (HelperActive == true) { ActiveGame.Helper = true; } else if (HelperActive == false) { ActiveGame.Helper = false; } MusicEngine.StartStop(); ChangeWindow(); MusicEngine.ButtonSoundEffectGameStart(); } else { MessageBox.Show("Det är inte tillåtet att starta ett spel med enbart botar"); } } catch (PostgresException ex) { MessageBox.Show(ex.Message.ToString()); } }