Esempio n. 1
0
        private void btnExit_Click(object sender, EventArgs e)
        {
            wheelOfFortune goBack = new wheelOfFortune();

            this.Hide();
            goBack.Show();
        }
Esempio n. 2
0
        }     //end void method

        public void gameOver()
        {
            wheelOfFortune finish = new wheelOfFortune();

            this.Hide();

            //17 letters will be set in the boxes
            finish.txtS.Text = "S";
            finish.txtO.Text = "O";
            finish.txtF.Text = "F";
            finish.txtT.Text = "T";
            finish.txtW.Text = "W";
            finish.txtA.Text = "A";
            finish.txtR.Text = "R";
            finish.txtE.Text = "E";

            finish.txtD.Text     = "D";
            finish.txt2ndE.Text  = "E";
            finish.txtV.Text     = "V";
            finish.txt3rdE.Text  = "E";
            finish.txtL.Text     = "L";
            finish.txt2ndO.Text  = "O";
            finish.txtP.Text     = "P";
            finish.txt4rthE.Text = "E";
            finish.txt2ndR.Text  = "R";

            //hide buttons and messages when game is over
            finish.btnSpinPlayerOne.Hide();
            finish.btnSolvePlayerOne.Hide();
            finish.lblMessageOne.Hide();

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

            finish.btnSpinPlayerThree.Hide();
            finish.btnSolvePlayerThree.Hide();
            finish.lblMessageThree.Hide();


            char[] lettersArray = new[] { 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J'
                                          , 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z' };

            //clears all of the items from the avaliable letters of the board
            finish.lstAvailableLetters.Items.Clear();

            finish.Show();

            MessageBox.Show("Game over thanks for playing!");
        } //end void set
Esempio n. 3
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
Esempio n. 4
0
        }//end void method

        private void btnSolve_Click(object sender, EventArgs e)
        {
            try
            {
                wheelOfFortune finish       = new wheelOfFortune();
                wheel          player1Money = new wheel();
                wheel          player2Money = new wheel();
                wheel          player3Money = new wheel();

                //make 3 guessers have a answer method in there class to use here
                guesser      g1 = new guesser();
                guesserTwo   g2 = new guesserTwo();
                guesserThree g3 = new guesserThree();

                //if and else statements for player 1
                if (g1.answer() == "SOFTWARE DEVELOPER" &&
                    txtSolve.Text == "SOFTWARE DEVELOPER")
                {
                    txtSolve.Text = "SOFTWARE DEVELOPER";

                    int total = player1Money.getTotalMoney();

                    MessageBox.Show("Congratulations player one has won the game!" + "\nAmount of money won: "
                                    + total.ToString("n2"));

                    //calling a void method
                    gameOver();
                }//end if

                else
                {
                    MessageBox.Show("OOPS that is not the right answer....Next players turn");

                    this.Hide();
                    finish.Show();


                    //hide buttons and messages
                    finish.btnSpinPlayerOne.Hide();
                    finish.btnSolvePlayerOne.Hide();
                    finish.lblMessageOne.Hide();

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


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



                //if and else statements for player 2
                if (g2.answer() == "SOFTWARE DEVELOPER" &&
                    txtSolve.Text == "SOFTWARE DEVELOPER")
                {
                    txtSolve.Text = "SOFTWARE DEVELOPER";

                    int total = player2Money.getTotalMoney();

                    MessageBox.Show("Congratulations player two has won the game!" + "\nAmount of money won: "
                                    + total.ToString("n2"));

                    //calling a void method
                    gameOver();
                }//end if

                else
                {
                    MessageBox.Show("OOPS that is not the right answer....Next players turn");

                    this.Hide();
                    finish.Show();


                    //hide buttons and messages
                    finish.btnSpinPlayerOne.Hide();
                    finish.btnSolvePlayerOne.Hide();
                    finish.lblMessageOne.Hide();

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

                    finish.btnSpinPlayerThree.Show();
                    finish.btnSolvePlayerThree.Show();
                    finish.lblMessageThree.Show();
                }//end else



                //if and else statements for player 3
                if (g3.answer() == "SOFTWARE DEVELOPER" &&
                    txtSolve.Text == "SOFTWARE DEVELOPER")
                {
                    txtSolve.Text = "SOFTWARE DEVELOPER";

                    int total = player3Money.getTotalMoney();

                    MessageBox.Show("Congratulations player three has won the game!" + "\nAmount of money won: "
                                    + total.ToString("n2"));

                    //calling a void method
                    gameOver();
                }//end if

                else
                {
                    MessageBox.Show("OOPS that is not the right answer....Next players turn");

                    this.Hide();
                    finish.Show();

                    //hide buttons and messages
                    finish.btnSpinPlayerOne.Show();
                    finish.btnSolvePlayerOne.Show();
                    finish.lblMessageOne.Show();

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

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

            catch (FormatException formatE)
            {
                MessageBox.Show(formatE.Message);
            }//end catch

            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            } //end catch
        }     //end void method