private void RenderRow(bool[] row) { ConsoleColor originalBackground = Console.BackgroundColor; int rowIndex = row.Length - 1; Write(String.Format("{0,2} ", rowIndex + 1), ConsoleColor.White); RowRenderData rowData = boardRenderData.Rows[rowIndex]; rowData.CursorTop = Console.CursorTop; for (int iPin = 0; iPin < row.Length; iPin++) { PinRenderData pinData = rowData.Pins[iPin]; pinData.Available = row[iPin]; pinData.CursorLeft = Console.CursorLeft; RenderPin(pinData); Write(" ", Console.ForegroundColor); } Console.BackgroundColor = originalBackground; }
public BoardRenderData(int rowCount) { Rows = new RowRenderData[rowCount]; for (int i = 0; i < rowCount; i++) { Rows[i] = new RowRenderData(this, i); } SelectedMove = new Move(); }
public void SelectPins(int rowIndex, int firstPinIndex, int length) { boardRenderData.SelectedMove.FirstPin = firstPinIndex; RowRenderData rowData = boardRenderData.Rows[rowIndex]; for (int i = firstPinIndex; i < firstPinIndex + length; i++) { PinRenderData pinData = rowData.Pins[i]; pinData.Selected = true; RenderPinUpdate(pinData); } }
private void RenderRowUpdate(int rowIndex) { RowRenderData rowData = boardRenderData.Rows[rowIndex]; int left = Console.CursorLeft; int top = Console.CursorTop; ConsoleColor color = Console.ForegroundColor; Console.CursorLeft = 1; Console.CursorTop = rowData.CursorTop; Console.ForegroundColor = ConsoleColor.Magenta; Console.Write(rowIndex + 1); Console.CursorLeft = left; Console.CursorTop = top; Console.ForegroundColor = color; }
public PinRenderData(RowRenderData row) { this.Row = row; this.Available = true; this.Selected = false; }