Пример #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();
            }
        }
Пример #2
0
        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!");
            }
        }
Пример #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();
     }
 }
Пример #4
0
        private void btnContinue_Click(object sender, EventArgs e)
        {
            FrmPlayerScore thisScore = new FrmPlayerScore();
            int            p1Score   = Convert.ToInt32(thisScore.lblScore1.Text);
            int            p2Score   = Convert.ToInt32(thisScore.lblScore2.Text);
            int            p3Score   = Convert.ToInt32(thisScore.lblScore3.Text);

            if (lblPlayer2.Visible == false && lblPlayer3.Visible == false)
            {
                myFormFinalShowDown.pbPlayer2.Visible        = false;
                myFormFinalShowDown.txtPlayer2Answer.Visible = false;
                myFormFinalShowDown.pbPlayer3.Visible        = false;
                myFormFinalShowDown.txtPlayer3Answer.Visible = false;
                if (counter == 0)
                {
                    myFormFinalShowDown.ShowDialog();
                    this.Hide();
                }
                else
                {
                    MessageBox.Show("Please finish all of the games");
                }
            }
            else if (lblPlayer3.Visible == false)
            {
                myFormFinalShowDown.pbPlayer3.Visible        = false;
                myFormFinalShowDown.txtPlayer3Answer.Visible = false;
                if (counter == 0)
                {
                    if (p1Score > p2Score)
                    {
                        myFormFinalShowDown.pbPlayer2.Visible        = false;
                        myFormFinalShowDown.txtPlayer2Answer.Visible = false;
                        myFormFinalShowDown.ShowDialog();
                        this.Hide();
                    }
                    else if (p1Score < p2Score)
                    {
                        myFormFinalShowDown.pbPlayer1.Visible        = false;
                        myFormFinalShowDown.txtPlayer1Answer.Visible = false;
                        myFormFinalShowDown.ShowDialog();
                        this.Hide();
                    }
                    else if (p1Score == p2Score)
                    {
                        myFormFinalShowDown.ShowDialog();
                        this.Hide();
                    }
                }
                else
                {
                    MessageBox.Show("Please finish all of the games");
                }
            }
            else if (lblPlayer3.Visible == true)
            {
                if (counter == 0)
                {
                    if (p1Score > p2Score && p1Score > p3Score)
                    {
                        myFormFinalShowDown.pbPlayer2.Visible        = false;
                        myFormFinalShowDown.txtPlayer2Answer.Visible = false;
                        myFormFinalShowDown.pbPlayer3.Visible        = false;
                        myFormFinalShowDown.txtPlayer3Answer.Visible = false;
                        myFormFinalShowDown.ShowDialog();
                        this.Hide();
                    }
                    else if (p1Score > p2Score && p1Score == p3Score)
                    {
                        myFormFinalShowDown.pbPlayer2.Visible        = false;
                        myFormFinalShowDown.txtPlayer2Answer.Visible = false;
                        myFormFinalShowDown.ShowDialog();
                        this.Hide();
                    }
                    else if (p1Score == p2Score && p1Score > p3Score)
                    {
                        myFormFinalShowDown.pbPlayer3.Visible        = false;
                        myFormFinalShowDown.txtPlayer3Answer.Visible = false;
                        myFormFinalShowDown.ShowDialog();
                        this.Hide();
                    }
                    else if (p2Score == p3Score && p2Score > p1Score)
                    {
                        myFormFinalShowDown.pbPlayer1.Visible        = false;
                        myFormFinalShowDown.txtPlayer1Answer.Visible = false;
                        myFormFinalShowDown.ShowDialog();
                        this.Hide();
                    }
                    else if (p2Score > p1Score && p2Score > p3Score)
                    {
                        myFormFinalShowDown.pbPlayer1.Visible        = false;
                        myFormFinalShowDown.txtPlayer1Answer.Visible = false;
                        myFormFinalShowDown.pbPlayer3.Visible        = false;
                        myFormFinalShowDown.txtPlayer3Answer.Visible = false;
                        myFormFinalShowDown.ShowDialog();
                        this.Hide();
                    }
                    else if (p3Score > p2Score && p3Score > p1Score)
                    {
                        myFormFinalShowDown.pbPlayer1.Visible        = false;
                        myFormFinalShowDown.txtPlayer1Answer.Visible = false;
                        myFormFinalShowDown.pbPlayer2.Visible        = false;
                        myFormFinalShowDown.txtPlayer2Answer.Visible = false;
                        myFormFinalShowDown.ShowDialog();
                        this.Hide();
                    }
                    else if (p1Score == p2Score && p1Score == p3Score)
                    {
                        myFormFinalShowDown.ShowDialog();
                        this.Hide();
                    }
                }
                else
                {
                    MessageBox.Show("Please finish all of the games");
                }
            }
        }
Пример #5
0
        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();
                }
            }
        }