コード例 #1
0
        //Purpose:To reset all values back to zero
        //Requires: Nothing
        //Returns :Nothing
        private void beginagain()
        {
            p1.cash = 0;
            p2.cash = 0;
            p3.cash = 0;
            c       = 0;

            PlayeroneEspincount.Clear();
            PlayertwoEspincount.Clear();
            PlayerthreeEspincount.Clear();
            Playeronecash.Clear();
            Playertwocash.Clear();
            Playerthreecash.Clear();

            PlayeroneEspincount.AppendText(string.Format(Convert.ToString(p1.Espins)));
            PlayertwoEspincount.AppendText(string.Format(Convert.ToString(p2.Espins)));
            PlayerthreeEspincount.AppendText(string.Format(Convert.ToString(p3.Espins)));
            PlayeronePspincount.AppendText(string.Format(Convert.ToString(p1.pSpins)));
            PlayertwoPspincount.AppendText(string.Format(Convert.ToString(p2.pSpins)));
            PlayerthreePspincount.AppendText(string.Format(Convert.ToString(p3.pSpins)));
            Playeronecash.AppendText("$" + Convert.ToString(p1.cash));
            Playertwocash.AppendText("$" + Convert.ToString(p2.cash));
            Playerthreecash.AppendText("$" + Convert.ToString(p3.cash));
        }
コード例 #2
0
        //Purpose to process the spins for the current player
        //requires:the current player, spins
        //returns:cash value to their respective textbox
        private void changePlaces(Player play)
        {
            int i = 0; // will reset the do while loop for each

            //new spin
            spinsound.PlayLooping();
            do
            {
                int r = random.Next(0, 18);
                randomize();                                     // randomizes the board
                Boarder_Box.Parent = pictureBox[r];              //setting the boarder box to a random picbox
                this.Refresh();                                  //refreshes the form to show where the boarder is located
                pictureBox[r].Image = imageList1.Images[r];      // finds the correct image
                filemoney           = imageList1.Images.Keys[r]; // sets the image to the path
                i++;
            } while (i < 25);
            spinsound.Stop();//stops the sound

            //Purpose: checks to see if the file image is a whammy or not
            //if it is then it sets the current players cash to zero
            //and out puts it to their respective cash box
            //Requies: A current image file, a current player, and spins
            //returns: The cash value for the player
            if ((filemoney == "Whammy.png") || (filemoney == "whammy1.png") || (filemoney == "Wham.png") ||
                (filemoney == "Whammy2.pgn") || (filemoney == "wham1.png"))
            {
                a = 0;
                b = 0;
                if (play == p1)
                {
                    Playeronecash.Clear();
                    Playeronecash.AppendText(Convert.ToString("$ " + a));
                    p1.Espins--;
                    PlayeroneEspincount.Clear();
                    PlayeroneEspincount.AppendText(Convert.ToString(p1.Espins));
                    p1.cash = a;
                }
                else if (play == p2)
                {
                    Playertwocash.Clear();
                    Playertwocash.AppendText(Convert.ToString("$ " + a));
                    p2.Espins--;
                    PlayertwoEspincount.Clear();
                    PlayertwoEspincount.AppendText(Convert.ToString(p2.Espins));
                    p2.cash = a;
                }
                else
                {
                    Playerthreecash.Clear();
                    Playerthreecash.AppendText(Convert.ToString("$ " + a));
                    p3.Espins--;
                    PlayerthreeEspincount.Clear();
                    PlayerthreeEspincount.AppendText(Convert.ToString(p3.Espins));
                    p3.cash = a;
                }
            }
            else
            {
                if (play == p1)
                {
                    Playeronecash.Clear();
                    p1.Espins--;
                    PlayeroneEspincount.Clear();
                    PlayeroneEspincount.AppendText(Convert.ToString(p1.Espins));
                    b = calculateMoney(a, p1);
                    Playeronecash.AppendText(("$ " + Convert.ToString(b)));
                    p1.cash = b; //sets cash to compare winnner later
                }
                else if (play == p2)
                {
                    Playertwocash.Clear();
                    p2.Espins--;
                    PlayertwoEspincount.Clear();
                    PlayertwoEspincount.AppendText(Convert.ToString(p2.Espins));
                    b = calculateMoney(a, p2);
                    Playertwocash.AppendText(("$ " + Convert.ToString(b)));
                    p2.cash = b;//sets the cash to compare it to the winner later
                }
                else if (play == p3)
                {
                    Playerthreecash.Clear();
                    p3.Espins--;
                    PlayerthreeEspincount.Clear();
                    PlayerthreeEspincount.AppendText(Convert.ToString(p3.Espins));
                    b = calculateMoney(a, p3);
                    Playerthreecash.AppendText(("$ " + Convert.ToString(b)));
                    p3.cash = b;//sets the cash to compare it to the winner later
                }
            }
        }
コード例 #3
0
        //Purpose: When clicked it will a bool value and call
        //check question to see if the answer is correct or not
        //then calls current player to output if they were wrong or not
        //Requires: A boolian value and the current player
        //Returns:Nothing for the button
        private void Answer_Button_Click_1(object sender, EventArgs e)
        {
            if (c <= 11)
            {
                bool a = checkQuestion();

                if (c == 0 || c == 3 || c == 6 || c == 9)
                {
                    if (a == true)
                    {
                        p1.Espins++;
                        PlayeroneEspincount.Clear();
                        PlayeroneEspincount.AppendText(Convert.ToString(p1.Espins));
                        Question_Box.AppendText("\n\n\n");
                        Question_Box.AppendText(p2.pName + " it is your turn");
                    }
                    else
                    {
                        Question_Box.AppendText("\n\n\n");
                        Question_Box.AppendText(p2.pName + " it is your turn");
                    }
                    c++;
                }
                else if (c == 1 || c == 4 || c == 7 || c == 10)
                {
                    if (a == true)
                    {
                        p2.Espins++;
                        PlayertwoEspincount.Clear();
                        PlayertwoEspincount.AppendText(Convert.ToString(p2.Espins));
                        Question_Box.AppendText("\n\n\n");
                        Question_Box.AppendText(p3.pName + " it is your turn");
                    }
                    else
                    {
                        Question_Box.AppendText("\n\n\n");
                        Question_Box.AppendText(p3.pName + " it is your turn");
                    }
                    c++;
                }
                else
                {
                    if (a == true)
                    {
                        p3.Espins++;
                        PlayerthreeEspincount.Clear();
                        PlayerthreeEspincount.AppendText(Convert.ToString(p3.Espins));
                        Question_Box.AppendText("\n\n\n");
                        Question_Box.AppendText(p1.pName + " it is your turn");
                    }
                    else
                    {
                        Question_Box.AppendText("\n\n\n");
                        Question_Box.AppendText(p1.pName + " it is your turn");
                    }

                    if (c == 11)
                    {
                        Answer_Button.Hide();
                        Next_Question_Button.Hide();
                        Answers_Textbox.Hide();
                        Spin_Round_Instruction.Show();
                    }
                    c++;
                }
            }
        }