public void print() { foreach (int i in Enumerable.Range(0, grid_.GetLength(0))) { foreach (int j in Enumerable.Range(0, grid_.GetLength(1))) { gridcell cell = grid_[i, j]; ConsoleColor?bkgcolor = null; if (selection_) { if (selectedindex.Item1 == i && selectedindex.Item2 == j) { bkgcolor = ConsoleColor.White; } } if (cell == null) { Console.BackgroundColor = bkgcolor ?? ConsoleColor.DarkBlue; Console.Write(" "); Console.ResetColor(); Console.Write(" "); } else { Console.BackgroundColor = bkgcolor ?? cell.cellColor(); Console.ForegroundColor = ConsoleColor.Red; Console.Write(cell.cellObject().representation()); Console.ResetColor(); Console.Write(" "); } } Console.Write("\n"); } }
//public event EventHandler SimpleEvent; public void insertgrid(Igameobject obj, int x, int y) { grid_[x, y] = new gridcell(obj); }