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()); }
public void UpdateBoardView(string ArrayString, IBrick[,] brickArray, int width, int height) { if (view == null) { throw new ArgumentNullException("View"); } view.DisplayBoard(ArrayString, brickArray, width, height); }
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; } } }
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; } } }
public void DisplayBoard(string arrayString, IBrick[,] brickArray, int width, int height) { currentBoard.Bricks = GetBricksArray(height, width, brickArray); }