示例#1
0
        // 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);
        }
示例#2
0
        public void UpdateGrid(GameBoardModel grid, int userID)
        {
            // Send updated Grid to DB
            DAObusiness businessService = new DAObusiness();

            businessService.UpdateGrid(grid, userID);
        }
示例#3
0
        // 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);
            }
        }
示例#4
0
        public void deleteGrid(int userID)
        {
            DAObusiness businessService = new DAObusiness();

            businessService.deleteGrid(userID);
        }
示例#5
0
        public void PublishGameStats(GameBoardModel grid, int userID, string elapsedTime)
        {
            DAObusiness businessService = new DAObusiness();

            businessService.publishGameStats(grid, userID, elapsedTime);
        }