private Box[,] CreateGameState() { DotsModel(); var gamestate = new Box[Size, Size]; ItemsBoxes = new List <Box>(); for (int i = 0; i < Size; i++) { for (int j = 0; j < Size; j++) { DotLine up = Rows[i][j]; DotLine down = Rows[i + 1][j]; DotLine left = Columns[j][i]; DotLine right = Columns[j + 1][i]; gamestate[i, j] = new Box { Up = up, Left = left, Right = right, Down = down, X = up.X1, Y = up.Y1, StrokeColor = Brushes.Transparent }; ItemsBoxes.Add(gamestate[i, j]); } } return(gamestate); }
private void LineModel(Dot[,] temp) { //We get the Rows for (int i = 0; i < Size + 1; i++) { List <DotLine> row = new List <DotLine>(); for (int j = 0; j < Size; j++) { DotLine tem = new DotLine { IsDraw = false, StrokeColor = Brushes.Transparent, X1 = temp[i, j].X, Y1 = temp[i, j].Y, X2 = temp[i, j + 1].X, Y2 = temp[i, j + 1].Y }; ItemsLine.Add(tem); row.Add(tem); } Rows.Add(row); } //We get the Columns for (int i = 0; i < Size + 1; i++) { List <DotLine> column = new List <DotLine>(); for (int j = 0; j < Size; j++) { DotLine tem = new DotLine { IsDraw = false, StrokeColor = Brushes.Transparent, X1 = temp[j, i].X, Y1 = temp[j, i].Y, X2 = temp[j + 1, i].X, Y2 = temp[j + 1, i].Y, }; ItemsLine.Add(tem); column.Add(tem); } Columns.Add(column); } }
public static void DrawLine(this DotLine linetodraw) { linetodraw.StrokeColor = Brushes.Black; linetodraw.IsDraw = true; }