public bool StartGame() { game = BuildGame(); mainView = BuildMain(RoundType.First); currentRound = RoundType.First; mainView.ShowDialog(); if (!exit && !newGame) { mainView = BuildMain(RoundType.Second); currentRound = RoundType.Second; mainView.ShowDialog(); } if (!exit && !newGame) { if (game.Cash > 0) { currentQ = game.FinalQuestion; mainView = BuildFinal(); currentRound = RoundType.Final; mainView.ShowDialog(); } else { didFinal = false; } } if (!exit && !newGame) { mainView = BuildFinished(); mainView.ShowDialog(); } return(exit); }
private bool CheckGameNull(JeoGame game) { bool checkNull = false; foreach (JeoCategory <JeoQuestion> category in game.FirstRound) { foreach (JeoQuestion question in category) { if (question == null) { checkNull = true; } } } foreach (JeoCategory <JeoQuestion> category in game.SecondRound) { foreach (JeoQuestion question in category) { if (question == null) { checkNull = true; } } } return(checkNull); }
//build a JeoGame. if a category was used both before and after the clue value increase in 2001, there is a chance for //questions to be nulled. This cannot be fixed without rebuilding the database to include airdate of each question. //until that is done, re-build the game until those categories aren't included private JeoGame BuildGame() { JeoModel db = new JeoModel(); JeoGame retGame; do { retGame = new JeoGame(db.RandomRound(RoundType.First, true), db.RandomRound(RoundType.Second, true), db.GetFinal()); } while (CheckGameNull(retGame)); db = null; return(retGame); }