예제 #1
0
        }     //end void method validation for the second player

        public void validatePlayerThreeSpin()
        {
            wheel        player3 = new wheel();
            guesserThree gusser3 = new guesserThree();
            int          number  = -1000;



            int p3Spin = player3.getSpin();

            if (p3Spin == -1000)
            {
                MessageBox.Show("SORRY BUT YOUR SPIN LANDED ON -1000 " + "\nTHIS MEANS YOU LOST A TURN"
                                + "\nAND LOST $1000");

                player3.calculateMoney(number);

                int total = player3.getTotalMoney();

                txtPlayerThree.Text = "$" + total.ToString("n2");

                MessageBox.Show("Next players turn");

                //hide buttons and messages on the load
                btnSpinPlayerTwo.Hide();
                btnSolvePlayerTwo.Hide();
                lblMessageTwo.Hide();


                btnSpinPlayerOne.Show();
                btnSolvePlayerOne.Show();
                lblMessageOne.Show();

                btnSpinPlayerThree.Hide();
                btnSolvePlayerThree.Hide();
                lblMessageThree.Hide();
            }//end if

            else if (p3Spin == 0)
            {
                MessageBox.Show("SORRY BUT YOUR SPIN LANDED ON 0 " + "\nTHIS MEANS YOU LOST A TURN");

                number = 0;

                player3.calculateMoney(number);

                int total = player3.getTotalMoney();

                txtPlayerThree.Text = "$" + total.ToString("n2");

                this.Hide();

                MessageBox.Show("Next players turn");

                // txtPlayerOne.Focus();

                //hide buttons and messages on the load
                btnSpinPlayerTwo.Hide();
                btnSolvePlayerTwo.Hide();
                lblMessageTwo.Hide();

                btnSpinPlayerOne.Show();
                btnSolvePlayerOne.Show();
                lblMessageOne.Show();

                btnSpinPlayerThree.Hide();
                btnSolvePlayerThree.Hide();
                lblMessageThree.Hide();
            }//end else if

            else
            {
                number = 0;

                player3.calculateMoney(number);

                int total = player3.getTotalMoney();

                txtPlayerThree.Text = "$" + total.ToString("n2");

                MessageBox.Show("Your spin landed on $" + p3Spin + " dollars");

                this.Hide();
                gusser3.Show();
            } //end else
        }     //end void method validation for the third player
예제 #2
0
        }//end btnExit Two button

        public void playerTwoMethod()
        {
            int p2Number = 0;
            int total    = 0;


            //object used to go back to the main when program goes to default in the switch
            wheelOfFortune p2Main_Screen = new wheelOfFortune();
            wheel          playerTwo     = new wheel();

            //converting the input to a char
            char p2LetterValue = char.Parse(txtGuessTwo.Text);

            while (playerTwo.getSelectedLetter(p2LetterValue))
            {
                if (playerTwo.getSelectedLetter(p2LetterValue))
                {
                    if (p2LetterValue == 'S')
                    {
                        MessageBox.Show("The letter " + p2LetterValue
                                        + " matches " + "\nSpin to guess another one!");

                        p2Main_Screen.txtS.Text = "S";
                        p2Main_Screen.lstAvailableLetters.Items.Remove(p2LetterValue);


                        this.Hide();

                        playerTwo.calculateMoney(p2Number);

                        total = playerTwo.getTotalMoney();

                        p2Main_Screen.txtPlayerTwo.Text = "$" + total.ToString("n2");

                        p2Main_Screen.Enabled = true;

                        p2Main_Screen.Show();
                    }

                    else if (p2LetterValue == 'O')
                    {
                        MessageBox.Show("The letter " + p2LetterValue
                                        + " matches " + "\nSpin to guess another one!");


                        p2Main_Screen.txtO.Text    = "O";
                        p2Main_Screen.txt2ndO.Text = "O";
                        p2Main_Screen.lstAvailableLetters.Items.Remove(p2LetterValue);


                        this.Hide();

                        total = playerTwo.calculateMoney(p2Number) * 2;

                        total = playerTwo.getTotalMoney();

                        p2Main_Screen.txtPlayerTwo.Text = "$" + total.ToString("n2");

                        p2Main_Screen.Enabled = true;

                        p2Main_Screen.Show();
                    }

                    else if (p2LetterValue == 'F')
                    {
                        MessageBox.Show("The letter " + p2LetterValue
                                        + " matches " + "\nSpin to guess another one!");


                        p2Main_Screen.txtF.Text = "F";
                        p2Main_Screen.lstAvailableLetters.Items.Remove(p2LetterValue);


                        this.Hide();

                        playerTwo.calculateMoney(p2Number);

                        total = playerTwo.getTotalMoney();

                        p2Main_Screen.txtPlayerTwo.Text = "$" + total.ToString("n2");

                        p2Main_Screen.Enabled = true;

                        p2Main_Screen.Show();
                    }//end else if

                    else if (p2LetterValue == 'T')
                    {
                        MessageBox.Show("The letter " + p2LetterValue
                                        + " matches " + "\nSpin to guess another one!");


                        p2Main_Screen.txtT.Text = "T";
                        p2Main_Screen.lstAvailableLetters.Items.Remove(p2LetterValue);


                        this.Hide();

                        playerTwo.calculateMoney(p2Number);

                        total = playerTwo.getTotalMoney();

                        p2Main_Screen.txtPlayerTwo.Text = "$" + total.ToString("n2");

                        p2Main_Screen.Enabled = true;

                        p2Main_Screen.Show();
                    }//end else if
                    else if (p2LetterValue == 'W')
                    {
                        MessageBox.Show("The letter " + p2LetterValue
                                        + " matches " + "\nSpin to guess another one!");


                        p2Main_Screen.txtW.Text = "W";
                        p2Main_Screen.lstAvailableLetters.Items.Remove(p2LetterValue);


                        this.Hide();

                        playerTwo.calculateMoney(p2Number);

                        total = playerTwo.getTotalMoney();

                        p2Main_Screen.txtPlayerTwo.Text = "$" + total.ToString("n2");

                        p2Main_Screen.Enabled = true;

                        p2Main_Screen.Show();
                    }//end else if
                    else if (p2LetterValue == 'A')
                    {
                        MessageBox.Show("The letter " + p2LetterValue
                                        + " matches " + "\nSpin to guess another one!");


                        p2Main_Screen.txtA.Text = "A";
                        p2Main_Screen.lstAvailableLetters.Items.Remove(p2LetterValue);


                        this.Hide();

                        playerTwo.calculateMoney(p2Number);

                        total = playerTwo.getTotalMoney();

                        p2Main_Screen.txtPlayerTwo.Text = "$" + total.ToString("n2");

                        p2Main_Screen.Enabled = true;

                        p2Main_Screen.Show();
                    }//end else if
                    else if (p2LetterValue == 'R')
                    {
                        MessageBox.Show("The letter " + p2LetterValue
                                        + " matches " + "\nSpin to guess another one!");


                        p2Main_Screen.txtR.Text    = "R";
                        p2Main_Screen.txt2ndR.Text = "R";
                        p2Main_Screen.lstAvailableLetters.Items.Remove(p2LetterValue);


                        this.Hide();

                        total = playerTwo.calculateMoney(p2Number) * 2;

                        total = playerTwo.getTotalMoney();

                        p2Main_Screen.txtPlayerTwo.Text = "$" + total.ToString("n2");

                        p2Main_Screen.Enabled = true;

                        p2Main_Screen.Show();
                    }//end else if
                    else if (p2LetterValue == 'E')
                    {
                        MessageBox.Show("The letter " + p2LetterValue
                                        + " matches " + "\nSpin to guess another one!");


                        p2Main_Screen.txtE.Text     = "E";
                        p2Main_Screen.txt2ndE.Text  = "E";
                        p2Main_Screen.txt3rdE.Text  = "E";
                        p2Main_Screen.txt4rthE.Text = "E";
                        p2Main_Screen.lstAvailableLetters.Items.Remove(p2LetterValue);


                        this.Hide();

                        total = playerTwo.calculateMoney(p2Number) * 4;

                        total = playerTwo.getTotalMoney();

                        p2Main_Screen.txtPlayerTwo.Text = "$" + total.ToString("n2");

                        p2Main_Screen.Enabled = true;

                        p2Main_Screen.Show();
                    }//end else if
                    else if (p2LetterValue == 'D')
                    {
                        MessageBox.Show("The letter " + p2LetterValue
                                        + " matches " + "\nSpin to guess another one!");


                        p2Main_Screen.txtD.Text = "D";
                        p2Main_Screen.lstAvailableLetters.Items.Remove(p2LetterValue);


                        this.Hide();

                        playerTwo.calculateMoney(p2Number);

                        total = playerTwo.getTotalMoney();

                        p2Main_Screen.txtPlayerTwo.Text = "$" + total.ToString("n2");

                        p2Main_Screen.Enabled = true;

                        p2Main_Screen.Show();
                    }//end else if
                    else if (p2LetterValue == 'V')
                    {
                        MessageBox.Show("The letter " + p2LetterValue
                                        + " matches " + "\nSpin to guess another one!");


                        p2Main_Screen.txtV.Text = "V";
                        p2Main_Screen.lstAvailableLetters.Items.Remove(p2LetterValue);


                        this.Hide();

                        playerTwo.calculateMoney(p2Number);

                        total = playerTwo.getTotalMoney();

                        p2Main_Screen.txtPlayerTwo.Text = "$" + total.ToString("n2");

                        p2Main_Screen.Enabled = true;

                        p2Main_Screen.Show();
                    }//end else if
                    else if (p2LetterValue == 'L')
                    {
                        MessageBox.Show("The letter " + p2LetterValue
                                        + " matches " + "\nSpin to guess another one!");


                        p2Main_Screen.txtL.Text = "L";
                        p2Main_Screen.lstAvailableLetters.Items.Remove(p2LetterValue);


                        this.Hide();

                        playerTwo.calculateMoney(p2Number);

                        total = playerTwo.getTotalMoney();

                        p2Main_Screen.txtPlayerTwo.Text = "$" + total.ToString("n2");

                        p2Main_Screen.Enabled = true;

                        p2Main_Screen.Show();
                    }//end else if
                    else if (p2LetterValue == 'P')
                    {
                        MessageBox.Show("The letter " + p2LetterValue
                                        + " matches " + "\nSpin to guess another one!");


                        p2Main_Screen.txtP.Text = "P";
                        p2Main_Screen.lstAvailableLetters.Items.Remove(p2LetterValue);


                        this.Hide();

                        playerTwo.calculateMoney(p2Number);

                        total = playerTwo.getTotalMoney();

                        p2Main_Screen.txtPlayerTwo.Text = "$" + total.ToString("n2");

                        p2Main_Screen.Enabled = true;

                        p2Main_Screen.Show();
                    }//end else if

                    else if (!playerTwo.getSelectedLetter(p2LetterValue))
                    {
                        MessageBox.Show("Sorry incorrect letter " + "\nNext players turn");

                        this.Hide();

                        playerTwo.calculateMoney(p2Number);

                        total = playerTwo.getTotalMoney();

                        p2Main_Screen.txtPlayerTwo.Text = "$" + total.ToString("n2");

                        p2Main_Screen.Enabled = true;

                        p2Main_Screen.btnSpinPlayerOne.Hide();
                        p2Main_Screen.btnSolvePlayerOne.Hide();
                        p2Main_Screen.lblMessageOne.Hide();

                        p2Main_Screen.btnSpinPlayerTwo.Hide();
                        p2Main_Screen.btnSolvePlayerTwo.Hide();
                        p2Main_Screen.lblMessageTwo.Hide();

                        p2Main_Screen.btnSpinPlayerThree.Show();
                        p2Main_Screen.btnSolvePlayerThree.Show();
                        p2Main_Screen.lblMessageThree.Show();

                        p2Main_Screen.Show();

                        break;
                    }//end else
                    else
                    {
                        MessageBox.Show("PLEASE TYPE IN A VALID LETTER");
                    } //end else
                }     //end if

                //bumps into this if the statement is not true
                else if (!playerTwo.getSelectedLetter(p2LetterValue))
                {
                    MessageBox.Show("Sorry incorrect letter " + "\nNext players turn");

                    this.Hide();

                    playerTwo.calculateMoney(p2Number);

                    total = playerTwo.getTotalMoney();

                    p2Main_Screen.txtPlayerTwo.Text = "$" + total.ToString("n2");

                    p2Main_Screen.Enabled = true;

                    p2Main_Screen.btnSpinPlayerOne.Hide();
                    p2Main_Screen.btnSolvePlayerOne.Hide();
                    p2Main_Screen.lblMessageOne.Hide();

                    p2Main_Screen.btnSpinPlayerTwo.Hide();
                    p2Main_Screen.btnSolvePlayerTwo.Hide();
                    p2Main_Screen.lblMessageTwo.Hide();


                    p2Main_Screen.btnSpinPlayerThree.Show();
                    p2Main_Screen.btnSolvePlayerThree.Show();
                    p2Main_Screen.lblMessageThree.Show();

                    p2Main_Screen.Show();
                }//end else if
                else
                {
                    MessageBox.Show("PLEASE TYPE IN A VALID LETTER");
                }//end else

                break;
            }//end while

            if (p2Main_Screen.txtS.Enabled &&
                p2Main_Screen.txtO.Enabled &&
                p2Main_Screen.txt2ndO.Enabled &&
                p2Main_Screen.txtF.Enabled &&
                p2Main_Screen.txtT.Enabled &&
                p2Main_Screen.txtW.Enabled &&
                p2Main_Screen.txtA.Enabled &&
                p2Main_Screen.txtR.Enabled &&
                p2Main_Screen.txt2ndR.Enabled &&
                p2Main_Screen.txtE.Enabled &&
                p2Main_Screen.txt2ndE.Enabled &&
                p2Main_Screen.txt3rdE.Enabled &&
                p2Main_Screen.txt4rthE.Enabled &&
                p2Main_Screen.txtD.Enabled &&
                p2Main_Screen.txtV.Enabled &&
                p2Main_Screen.txtL.Enabled &&
                p2Main_Screen.txtP.Enabled)
            {
                winner p2Winner = new winner();

                MessageBox.Show("GOOD JOB");

                //string message
                p2Winner.txtWinner.Text = "Player Two";

                total = playerTwo.getTotalMoney();

                p2Winner.txtTotalAmount.Text = "$" + total.ToString("n2");

                p2Winner.Show();
            } //end if
        }     //end void method
예제 #3
0
        }//end void method

        public void validatePlayerOneSpin()
        {
            //created object for the first player
            wheel   player1  = new wheel();
            guesser guesser1 = new guesser();

            //get the spin to determine where numbers fall
            int p1Spin = player1.getSpin();
            int number = -1000;

            if (p1Spin == -1000)
            {
                MessageBox.Show("SORRY BUT YOUR SPIN LANDED ON -1000  " + "\nTHIS MEANS YOU LOST A TURN"
                                + "\nAND LOST $1000");

                //calculating total then returning it
                player1.calculateMoney(number);

                int total = player1.getTotalMoney();

                //printing it back out from what was calculated
                txtPlayerOne.Text = "$" + total.ToString("n2");

                MessageBox.Show("Next players turn");


                //hide buttons and messages on the load
                btnSpinPlayerOne.Hide();
                btnSolvePlayerOne.Hide();
                lblMessageOne.Hide();

                btnSpinPlayerTwo.Show();
                btnSolvePlayerTwo.Show();
                lblMessageTwo.Show();

                btnSpinPlayerThree.Hide();
                btnSolvePlayerThree.Hide();
                lblMessageThree.Hide();
            }//end if

            else if (p1Spin == 0)
            {
                MessageBox.Show("SORRY BUT YOUR SPIN LANDED ON 0 " + "\nTHIS MEANS YOU LOST A TURN");

                number = 0;

                player1.calculateMoney(number);

                int total = player1.getTotalMoney();

                txtPlayerOne.Text = "$" + total.ToString("n2");


                MessageBox.Show("Next players turn");


                //hide buttons and messages on the load
                btnSpinPlayerOne.Hide();
                btnSolvePlayerOne.Hide();
                lblMessageOne.Hide();

                btnSpinPlayerTwo.Show();
                btnSolvePlayerTwo.Show();
                lblMessageTwo.Show();


                btnSpinPlayerThree.Hide();
                btnSolvePlayerThree.Hide();
                lblMessageThree.Hide();
            }//end else if

            else
            {
                number = 0;

                player1.calculateMoney(number);

                int total = player1.getTotalMoney();

                txtPlayerOne.Text = "$" + total.ToString("n2");

                MessageBox.Show("Your spin landed on $" + p1Spin + " dollars");

                this.Hide();
                guesser1.Show();
            } //end else
        }     //end void validation for first player