private static ProjectionPoint[] CellParse(EnterData.Figure.Point[] cells) { var axisPoint = cells.First(cell => cell.X == 0 && cell.Y == 0); var axisProjectionPoint = new ProjectionPoint(axisPoint.X, axisPoint.Y); var listCells = cells .Where(cell => !(cell.X == 0 && cell.Y == 0)) .Select(cell => new ProjectionPoint(cell.X, cell.Y, axisProjectionPoint)).ToList(); listCells.Add(axisProjectionPoint); return listCells.ToArray(); }
public static Figure[] FigursParse(EnterData enterData) { EnterData.Figure[] figurs = enterData.Pieces; List<Figure> parseFigure = new List<Figure>(); foreach(var figure in figurs) { parseFigure.Add(new Figure(CellParse(figure.Cells))); } return parseFigure.ToArray(); }
public static PlayingField PlayingFieldParser(EnterData enterData) { return new PlayingField(enterData.Width, enterData.Height); }
public static Commander CommanderParse(EnterData enterData) { return new Commander(enterData.Commands); }