// Function to create GLOBAL Grid and fill it with random cells. public GameBoardModel CreateGrid(int width, int height, int userID) { Globals.timer.Start(); Globals.Grid = new GameBoardModel(width, height, false); CellModel[,] cells = new CellModel[width, height]; for (int y = 0; y < height; y++) { for (int x = 0; x < width; x++) { cells[x, y] = new CellModel(x, y); } } // Activate the cells FillRandomCells(20, width, height, cells, Globals.Grid); // Send new Grid to DB DAObusiness businessService = new DAObusiness(); businessService.CreateGrid(Globals.Grid, userID); return(Globals.Grid); }
public void UpdateGrid(GameBoardModel grid, int userID) { // Send updated Grid to DB DAObusiness businessService = new DAObusiness(); businessService.UpdateGrid(grid, userID); }
// Find an existing saved grid and save it to storage public GameBoardModel FindGrid(int userID) { DAObusiness businessService = new DAObusiness(); Globals.Grid = businessService.FindGrid(userID); if (Globals.Grid != null) { return(Globals.Grid); } else { return(null); } }
public void deleteGrid(int userID) { DAObusiness businessService = new DAObusiness(); businessService.deleteGrid(userID); }
public void PublishGameStats(GameBoardModel grid, int userID, string elapsedTime) { DAObusiness businessService = new DAObusiness(); businessService.publishGameStats(grid, userID, elapsedTime); }