private void btnNewGame_Click(object sender, EventArgs e) { if (panel1.BackColor.Equals(panel2.BackColor)) { MessageBox.Show("Мора да изберете различни бои!"); } else { ig1 = new Igrac(txtImeP1.Text, panel1.BackColor, 0); ig2 = new Igrac(txtImeP2.Text, panel2.BackColor, 0); this.DialogResult = System.Windows.Forms.DialogResult.OK; NewGame ng = new NewGame(ig1, ig2); ng.ShowDialog(); } }
public void handlePobeda(Igrac p, int br) { txtRez.Clear(); txtRez.AppendText(string.Format("{0}:{1}", gs.ig1.Score, gs.ig2.Score)); if (br == 1) { pobP1++; } else { pobP2++; } KraenRez += string.Format("{0}. {1}{2}", brRunda, txtRez.Text, Environment.NewLine); this.DialogResult = System.Windows.Forms.DialogResult.OK; //System.Threading.Thread.Sleep(200); this.Dispose(); if (brRunda + 1 > Rundi) { string s; if (pobP1 > pobP2) { s = gs.ig1.Ime; } else if (pobP1 < pobP2) { s = gs.ig2.Ime; } else { s = "Нерешено"; } KraenRezultat kr = new KraenRezultat(KraenRez, pobP1, pobP2, s); KraenRez = ""; pobP1 = 0; pobP2 = 0; kr.ShowDialog(); } else { NewGame ng = new NewGame(gs.ig1, gs.ig2, gs.tipIgra, Turn, Rundi, brRunda + 1); ng.ShowDialog(); } }
private void btnNewGame_Click(object sender, EventArgs e) { if (panel1.BackColor.Equals(panel2.BackColor)) { MessageBox.Show("Мора да изберете различни бои!", "Грешка", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } if (cBoxTipIgra.SelectedIndex == -1) { MessageBox.Show("Мора да изберете тип на игра", "Грешка", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } else { this.DialogResult = System.Windows.Forms.DialogResult.OK; ig1 = new Igrac(txtImeP1.Text, panel1.BackColor, 0); ig2 = new Igrac(txtImeP2.Text, panel2.BackColor, 0); NewGame ng = new NewGame(ig1, ig2, cBoxTipIgra.SelectedIndex, turn, Rundi, 1); ng.Show(); //this.Hide(); } }