Пример #1
0
 public static CellComponentmodel[] CreateCells(int count, int cellSize)
 {
     CellComponentmodel[] cells = new CellComponentmodel[count];
     for (int i = 0; i < count; i++)
     {
         cells[i] = new CellComponentmodel();
         cells[i].SetCellSize(cellSize);
     }
     return(cells);
 }
        public static CellComponentmodel CopyCell(CellComponentmodel cell)
        {
            CellComponentmodel result = new CellComponentmodel();

            result.SetCellSize(cell.CellSize);
            result.SetColor(cell.CellColor);
            result.SetEmpty(cell.Empty);
            result.SetPosInField(cell.PosInField);
            // result.SetContent(cell.PosInField.X,cell.PosInField.Y);
            return(result);
        }
Пример #3
0
        public static CellComponentmodel[,] CopyField(CellComponentmodel[,] cells)
        {
            var rows = cells.GetUpperBound(0) + 1;

            if (rows == 0)
            {
                return(new CellComponentmodel[0, 0]);
            }
            var columns = cells.Length / rows;

            CellComponentmodel[,] newCells = new CellComponentmodel[rows, columns];
            for (int i = 0; i < rows; i++)
            {
                for (int j = 0; j < columns; j++)
                {
                    newCells[i, j] = CellComponentmodel.CopyCell(cells[i, j]);
                }
            }
            return(newCells);
        }