public Game(GameSaveDbContext context)
        {
            Settings = new GameSettings();
            if (Settings.BoardHeight < ConstantSize._minimumBoardHeight ||
                Settings.BoardWidth < ConstantSize._minimumBoardWidth)
            {
                throw new ArgumentException(
                          $"Board size has to be at least {ConstantSize._minimumBoardHeight} x {ConstantSize._minimumBoardWidth} ");
            }

            if (Settings.BoardHeight > ConstantSize._maximumBoardHeight ||
                Settings.BoardWidth > ConstantSize._maximumBoardWidth)
            {
                throw new ArgumentException(
                          $"Board size cannot be greater than {ConstantSize._maximumBoardHeight} x {ConstantSize._maximumBoardWidth} ");
            }

            _context      = context;
            BoardHeight   = Settings.BoardHeight;
            BoardWidth    = Settings.BoardWidth;
            NumberOfMines = Settings.NumberOfMines;

            if (Settings.isLoadedGame == true)
            {
                Board = Settings.Board;
            }
            else if (Settings.isLoadedGame == false)
            {
                InitializeNewBoard(BoardWidth, BoardHeight);
            }

            SetNumberOfMinesOnBoard();
        }
 public DetailsModel(DAL.GameSaveDbContext context)
 {
     _context = context;
 }
Example #3
0
 public CreateModel(DAL.GameSaveDbContext context)
 {
     _context = context;
 }
Example #4
0
 public IndexModel(DAL.GameSaveDbContext context)
 {
     _context = context;
 }
Example #5
0
 public StartGameCustomModel(GameSaveDbContext context)
 {
     _context = context;
 }
Example #6
0
 public EditModel(DAL.GameSaveDbContext context)
 {
     _context = context;
 }
 public PlayGameModel(GameSaveDbContext context)
 {
     _context   = context;
     GameEngine = new GameEngine.Game(_context);
 }
 public DeleteModel(DAL.GameSaveDbContext context)
 {
     _context = context;
 }
 public StartNewGamePageModel(GameSaveDbContext context)
 {
     _context = context;
 }