public void IFGameOwer() { bool tr = false; for (int i = 0; i < 4; i++) { for (int j = 0; j < 4; j++) { if (num_matrix[i, j] == 0) { tr = true; } } } if (!tr) { for (int i = 0; i < 4; i++) { for (int j = 0; j < 4; j++) { try { if (num_matrix[i, j] == num_matrix[i, j + 1] || num_matrix[i, j] == num_matrix[i + 1, j]) { tr = true; } } catch { } } } if (!tr) { foreach (PictureBox i in picture_matrix) { this.Controls.Remove(i); } UpDate.Stop(); this.Controls.Remove(background); GameOwer.BringToFront(); GameOwer.Visible = true; Lids ld = new Lids(scores.Text); ld.Show(); } } }
public void IFGameOwer() // funcja zostaje wywolana kiedy liczba punktow jest 2048 lub kiedy nie ma miejsca no nowe klocki { bool tr = false; for (int i = 0; i < 4; i++) { for (int j = 0; j < 4; j++) { if (num_matrix[i, j] == 0) { tr = true; } } } if (!tr) { for (int i = 0; i < 4; i++) { for (int j = 0; j < 4; j++) { try { if (num_matrix[i, j] == num_matrix[i, j + 1] || num_matrix[i, j] == num_matrix[i + 1, j]) { tr = true; } } catch { } } } if (!tr) { foreach (PictureBox i in picture_matrix) { this.Controls.Remove(i); } UpDate.Stop(); this.Controls.Remove(background); GameOwer.BringToFront(); GameOwer.Visible = true; } } }