Exemplo n.º 1
0
        private BrickViewModel[] GetBricksArray(int rowCount, int colCount, IBrick[,] array)
        {
            var bricksList = new List <BrickViewModel>();

            for (var row = 0; row < rowCount; row++)
            {
                for (var col = 0; col < colCount; col++)
                {
                    var b = array[col, row];
                    if (b != null)
                    {
                        bricksList.Add(new BrickViewModel()
                        {
                            Row   = row,
                            Col   = col,
                            Color = b.Color.ToString()
                        });
                    }
                    else
                    {
                        bricksList.Add(new BrickViewModel()
                        {
                            Row   = row,
                            Col   = col,
                            Color = "0"
                        });
                    }
                }
            }
            return(bricksList.ToArray());
        }
Exemplo n.º 2
0
        public void UpdateBoardView(string ArrayString, IBrick[,] brickArray, int width, int height)
        {
            if (view == null)
            {
                throw new ArgumentNullException("View");
            }

            view.DisplayBoard(ArrayString, brickArray, width, height);
        }
Exemplo n.º 3
0
 public virtual void Init()
 {
     _brickArr = new IBrick[_w, _h];
     for (int row = 0; row < _h; row++)
     {
         for (int column = 0; column < _w; column++)
         {
             _brickArr[column, row] = null;
         }
     }
 }
Exemplo n.º 4
0
 public virtual void InitializeArray()
 {
     shapeArray = new IBrick[width, height];
     for (int row = 0; row < height; row++)
     {
         for (int column = 0; column < width; column++)
         {
             shapeArray[column, row] = null;
         }
     }
 }
Exemplo n.º 5
0
 public void DisplayBoard(string arrayString, IBrick[,] brickArray, int width, int height)
 {
     currentBoard.Bricks = GetBricksArray(height, width, brickArray);
 }