/// <summary> /// Checks the user has set a new complexity. /// </summary> /// <returns> /// True if new complexity is set, false otherwise. A new game grid /// is generated and the visual playing field is reset. /// </returns> private bool ReevalGameComplexity() { var complexity = NewGameCmplx_Combo.SelectedItem as GameDifficultyDefinition; if (complexity != prevGameComplexity) { prevGameComplexity = complexity; game = new GameGridService(complexity.Rows, complexity.Columns, complexity.Bombs); ClearPlayingField(); RestorePlayingField(); return(true); } return(false); }
/// <summary> /// TODO: Move into Models or Repository /// </summary> private void InitialiseComplexityOptions() { int defaultComplexity = GameDifficultyDefinition.DefaultOptionIndex; var difficulties = GameDifficultyDefinition.DifficultyOptions(); foreach (var option in difficulties) { complexityOptions.Add(option); } prevGameComplexity = complexityOptions[defaultComplexity]; game = new GameGridService(prevGameComplexity.Rows, prevGameComplexity.Columns, prevGameComplexity.Bombs); NewGameCmplx_Combo.SelectedIndex = defaultComplexity; }