Beispiel #1
0
        private void btnChoose1_Click(object sender, EventArgs e)
        {
            if (Convert.ToDouble(lblPrice1.Text) == dp.GetRealPrice())
            {
                MessageBox.Show("You won!");
                if (GameSys.WhoseTurnPlayer == 1)
                {
                    GameSys.Player1Score++;
                }
                else if (GameSys.WhoseTurnPlayer == 2)
                {
                    GameSys.Player2Score++;
                }
                else
                {
                    GameSys.Player3Score++;
                }
                //=========================
                FrmPlayerScore s      = new FrmPlayerScore();
                FrmChooseGame  choose = new FrmChooseGame();

                this.Close();
                s.ShowDialog();
            }
            else
            {
                MessageBox.Show("You lose!");
                this.Close();
            }
        }
        private void btnContinue_Click(object sender, EventArgs e)
        {
            if (!string.IsNullOrWhiteSpace(txtGuess1.Text) &&
                !string.IsNullOrWhiteSpace(txtGuess2.Text) &&
                !string.IsNullOrWhiteSpace(txtGuess3.Text) &&
                !string.IsNullOrWhiteSpace(txtGuess4.Text) &&
                !string.IsNullOrWhiteSpace(txtGuess5.Text))
            {
                double storeGuess1 = Convert.ToDouble(txtGuess1.Text);
                double storeGuess2 = Convert.ToDouble(txtGuess2.Text);
                double storeGuess3 = Convert.ToDouble(txtGuess3.Text);
                double storeGuess4 = Convert.ToDouble(txtGuess4.Text);
                double storeGuess5 = Convert.ToDouble(txtGuess5.Text);
                checkOut.GuessSet(storeGuess1, storeGuess2, storeGuess3, storeGuess4, storeGuess5);

                lblActualPrice1.Visible = true;
                lblActualPrice2.Visible = true;
                lblActualPrice3.Visible = true;
                lblActualPrice4.Visible = true;
                lblActualPrice5.Visible = true;

                lblTotalGuess.Text    = checkOut.GetTotalGuessItemPrice().ToString();
                lblTotalGuess.Visible = true;
                lblTotalPrice.Visible = true;

                if (checkOut.WinOrNah())
                {
                    MessageBox.Show("You won!");
                    FrmChooseGame  ChooseGameForm = new FrmChooseGame();
                    FrmPlayerScore thisScore      = new FrmPlayerScore();
                    if (GameSys.WhoseTurnPlayer == 1)
                    {
                        GameSys.Player1Score++;
                    }
                    else if (GameSys.WhoseTurnPlayer == 2)
                    {
                        GameSys.Player2Score++;
                    }
                    else
                    {
                        GameSys.Player3Score++;
                    }

                    this.Close();
                }
                else
                {
                    MessageBox.Show("You Lose!");
                    this.Close();
                }
            }
            else
            {
                MessageBox.Show("You left one blank!");
            }
        }
Beispiel #3
0
 private void btnChoose2_Click(object sender, EventArgs e)
 {
     if (Convert.ToDouble(lblPrice2.Text) == dp.GetRealPrice())
     {
         FrmPlayerScore s      = new FrmPlayerScore();
         FrmChooseGame  choose = new FrmChooseGame();
         if (choose.lblTurnP1.Visible)
         {
             int score = Convert.ToInt32(s.lblScore1.Text);
             score++;
             s.lblScore1.Text = score.ToString();
         }
         else if (choose.lblTurnP2.Visible)
         {
             int score = Convert.ToInt32(s.lblScore2.Text);
             score++;
             s.lblScore2.Text = score.ToString();
         }
         else
         {
             int score = Convert.ToInt32(s.lblScore3.Text);
             score++;
             s.lblScore3.Text = score.ToString();
         }
         MessageBox.Show("You won!");
         if (GameSys.WhoseTurnPlayer == 1)
         {
             GameSys.Player1Score++;
         }
         else if (GameSys.WhoseTurnPlayer == 2)
         {
             GameSys.Player2Score++;
         }
         else
         {
             GameSys.Player3Score++;
         }
         this.Close();
     }
     else
     {
         MessageBox.Show("You lose!");
         this.Close();
     }
 }
        private void btnFinal_Click(object sender, EventArgs e)
        {
            FrmChooseGame  ChooseGameForm = new FrmChooseGame();
            FrmPlayerScore s = new FrmPlayerScore();

            if (rd1.Text == gd.actualprice.ToString())
            {
                if (rd1.Checked)
                {
                    string win = gd.DisplayWinAnnoucement();
                    MessageBox.Show(win);
                    if (ChooseGameForm.lblTurnP1.Visible == true)
                    {
                        s.lblScore1.Text = (Convert.ToInt32(s.lblScore1.Text) + 1).ToString();
                    }
                    else if (ChooseGameForm.lblTurnP2.Visible == true)
                    {
                        s.lblScore2.Text = (Convert.ToInt32(s.lblScore2.Text) + 1).ToString();
                    }
                    else if (ChooseGameForm.lblTurnP3.Visible == true)
                    {
                        s.lblScore3.Text = (Convert.ToInt32(s.lblScore3.Text) + 1).ToString();
                    }
                    this.Hide();
                }
                else if (rd2.Checked || rd3.Checked || rd4.Checked)
                {
                    string lose = gd.DisplayLoseAnnoucement();
                    MessageBox.Show(lose);
                    this.Close();
                }
            }
            else if (rd2.Text == gd.actualprice.ToString())
            {
                if (rd2.Checked)
                {
                    string win = gd.DisplayWinAnnoucement();
                    MessageBox.Show(win);
                    if (ChooseGameForm.lblTurnP1.Visible == true)
                    {
                        s.lblScore1.Text = (Convert.ToInt32(s.lblScore1.Text) + 1).ToString();
                    }
                    else if (ChooseGameForm.lblTurnP2.Visible == true)
                    {
                        s.lblScore2.Text = (Convert.ToInt32(s.lblScore2.Text) + 1).ToString();
                    }
                    else if (ChooseGameForm.lblTurnP3.Visible == true)
                    {
                        s.lblScore3.Text = (Convert.ToInt32(s.lblScore3.Text) + 1).ToString();
                    }
                    this.Hide();
                }
                else if (rd1.Checked || rd3.Checked || rd4.Checked)
                {
                    string lose = gd.DisplayLoseAnnoucement();
                    MessageBox.Show(lose);
                    this.Close();
                }
            }
            else if (rd3.Text == gd.actualprice.ToString())
            {
                if (rd3.Checked)
                {
                    string win = gd.DisplayWinAnnoucement();
                    MessageBox.Show(win);
                    if (ChooseGameForm.lblTurnP1.Visible == true)
                    {
                        s.lblScore1.Text = (Convert.ToInt32(s.lblScore1.Text) + 1).ToString();
                    }
                    else if (ChooseGameForm.lblTurnP2.Visible == true)
                    {
                        s.lblScore2.Text = (Convert.ToInt32(s.lblScore2.Text) + 1).ToString();
                    }
                    else if (ChooseGameForm.lblTurnP3.Visible == true)
                    {
                        s.lblScore3.Text = (Convert.ToInt32(s.lblScore3.Text) + 1).ToString();
                    }
                    this.Hide();
                }
                else if (rd2.Checked || rd1.Checked || rd4.Checked)
                {
                    string lose = gd.DisplayLoseAnnoucement();
                    MessageBox.Show(lose);
                    this.Close();
                }
            }
            else if (rd4.Text == gd.actualprice.ToString())
            {
                if (rd4.Checked)
                {
                    string win = gd.DisplayWinAnnoucement();
                    MessageBox.Show(win);

                    /*
                     * if (ChooseGameForm.lblTurnP1.Visible == true)
                     * {
                     *  s.lblScore1.Text = (Convert.ToInt32(s.lblScore1.Text) + 1).ToString();
                     * }
                     * else if (ChooseGameForm.lblTurnP2.Visible == true)
                     * {
                     *  s.lblScore2.Text = (Convert.ToInt32(s.lblScore2.Text) + 1).ToString();
                     * }
                     * else if (ChooseGameForm.lblTurnP3.Visible == true)
                     * {
                     *  s.lblScore3.Text = (Convert.ToInt32(s.lblScore3.Text) + 1).ToString();
                     * }
                     * */
                    if (GameSys.WhoseTurnPlayer == 1)
                    {
                        GameSys.Player1Score++;
                    }
                    else if (GameSys.WhoseTurnPlayer == 2)
                    {
                        GameSys.Player2Score++;
                    }
                    else
                    {
                        GameSys.Player3Score++;
                    }

                    this.Hide();
                }
                else if (rd2.Checked || rd3.Checked || rd1.Checked)
                {
                    string lose = gd.DisplayLoseAnnoucement();
                    MessageBox.Show(lose);
                    this.Close();
                }
            }
        }