public static void UpdatePlayboard(PlayBoard pb) { for (int j = 0; j < 10; j++) { for (int i = 0; i < 10; i++) { pb.fields[j, i].has_ship = MainForm.temp_array[j, i]; } } }
public static void Clear(PlayBoard pb) { for (int j = 0; j < 10; j++) { for (int i = 0; i < 10; i++) { pb.fields[i, j].button.Text = ""; } } }
public static void Refresh(PlayBoard pb) { for (int j = 0; j < 10; j++) { for (int i = 0; i < 10; i++) { if (pb.fields[i, j].has_ship) { pb.fields[i, j].button.Text = "X"; } } } }
public static bool[,] temp_array; // tablica pomocnicza do zapisywania pozycji statku #endregion Fields #region Constructors public MainForm() { InitializeComponent(); FillTempArray(); richtext = richTextBox1; chosen_ship = null; mainform = this; play_board_1 = new PlayBoard(groupBox1); play_board_2 = new PlayBoard(groupBox2); settings = new Settings(); records = new Record(); ships = new Ship[5]; ships[0] = new Ship(1, 2, "S_2"); ships[1] = new Ship(2, 3, "S_3_1"); ships[2] = new Ship(3, 3, "S_3_2"); ships[3] = new Ship(4, 4, "S_4"); ships[4] = new Ship(5, 5, "S_5"); }