Exemple #1
0
        /// <summary>
        /// called when changing with confirmation of game settings in options form
        /// </summary>
        private void WantNewGameWithChangedOptions(Options newOptions)
        {
            Options prevOptions = _gameManager.CurrentOptions;

            if (newOptions.Width != prevOptions.Width || newOptions.Height != prevOptions.Height) //dimentions of gamefield have been changed
            {
                _mainView.AdjustViewToCellsAmount(newOptions.Width, newOptions.Height);
                DrawEmptyGameFieldAdvanced(newOptions.Width, prevOptions.Width, newOptions.Height, prevOptions.Height);
                ClearGameFieldSelected();
            }
            else
            {
                ClearGameFieldSelected(); //  the dimensions of the field have not changed - change only open cells images
            }
            _gameManager.StartNewGame(newOptions);
            _mainView.MinesLeft   = newOptions.MinesAmount;
            _mainView.ElapsedTime = 0;
        }