Esempio n. 1
0
        }     //end void validation for first player

        public void validatePlayerTwoSpin()
        {
            wheel      player2  = new wheel();
            guesserTwo guesser2 = new guesserTwo();
            int        number   = -1000;


            //get the spin to determine where numbers fall
            int p2Spin = player2.getSpin();


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

                player2.calculateMoney(number);

                int total = player2.getTotalMoney();

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

                MessageBox.Show("Next players turn");


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

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


                btnSpinPlayerTwo.Hide();
                btnSolvePlayerTwo.Hide();
                lblMessageTwo.Hide();
            }//end if

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

                number = 0;

                player2.calculateMoney(number);

                int total = player2.getTotalMoney();

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

                MessageBox.Show("Next players turn");

                // txtPlayerThree.Focus();

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

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

                btnSpinPlayerTwo.Hide();
                btnSolvePlayerTwo.Hide();
                lblMessageTwo.Hide();
            }//end else if

            else
            {
                number = 0;

                player2.calculateMoney(number);

                int total = player2.getTotalMoney();

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

                MessageBox.Show("Your spin landed on $" + p2Spin + " dollars");
                this.Hide();
                guesser2.Show();
            } //end else
        }     //end void method validation for the second player
Esempio n. 2
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