コード例 #1
0
        private void btnReset_Click(object sender, EventArgs e)
        {
            foreach (CockGreyhound c**k in cockGreyhounds)
            {
                c**k.TakeSPos();
            }
            if (JoBetLabel.Text == "BUSTED" && AliBetLabel.Text == "BUSTED" && MaryBetLabel.Text == "BUSTED")
            {
                RaceTrackSetting();

                cockClients[0] = new CockClient("Jo", null, 50, JoRadioButton, JoBetLabel);
                cockClients[1] = new CockClient("Ali", null, 75, AliRadioButton, AliBetLabel);
                cockClients[2] = new CockClient("Mary", null, 45, MaryRadioButton, MaryBetLabel);

                foreach (CockClient punter in cockClients)
                {
                    punter.UpdateLabels();
                }
                JoBetLabel.ForeColor    = System.Drawing.Color.White;
                MaryBetLabel.ForeColor  = System.Drawing.Color.White;
                AliBetLabel.ForeColor   = System.Drawing.Color.White;
                JoRadioButton.Enabled   = true;
                AliRadioButton.Enabled  = true;
                MaryRadioButton.Enabled = true;
                numericUpDown1.Value    = 1;
                numericUpDown2.Value    = 1;
            }
            {
                Application.Restart();
            }
        }
コード例 #2
0
        private void btnReset_Click(object sender, EventArgs e)
        {
            foreach (CockGreyhound c**k in cockGreyhounds)
            {
                c**k.TakeSPos();
            }
            if (yadwinderBetLabel.Text == "BUSTED" && loveBetLabel.Text == "BUSTED" && rajinderBetLabel.Text == "BUSTED")
            {
                RaceTrackSetting();

                cockClients[0] = new CockClient("Yadwinder", null, 50, yadwinderRadioButton, yadwinderBetLabel);
                cockClients[1] = new CockClient("Love", null, 75, loveRadioButton, loveBetLabel);
                cockClients[2] = new CockClient("Rajinder", null, 45, rajinderRadioButton, rajinderBetLabel);

                foreach (CockClient punter in cockClients)
                {
                    punter.UpdateLabels();
                }
                yadwinderBetLabel.ForeColor  = System.Drawing.Color.White;
                rajinderBetLabel.ForeColor   = System.Drawing.Color.White;
                loveBetLabel.ForeColor       = System.Drawing.Color.White;
                yadwinderRadioButton.Enabled = true;
                loveRadioButton.Enabled      = true;
                rajinderRadioButton.Enabled  = true;
                numericUpDown1.Value         = 1;
                numericUpDown2.Value         = 1;
            }
            {
                Application.Restart();
            }
        }
コード例 #3
0
        private void RaceTrackSetting()                                                          //this funtion is for setting the race track
        {
            minimumBetLabel.Text = string.Format("Minimum Bet $1", (int)numericUpDown1.Minimum); //Showing the minimum bet rate in label

            int sPosition = pictureBox2.Right - pictureBox1.Left;                                //Setting the variable for starting position from c**k 1
            int rTLength  = pictureBox1.Size.Width;                                              //Setting the variable of length of racetrack

            //Setting values of the array of the class greyhound for racing for the first part of the game as suggested in assignment
            cockGreyhounds[0] = new CockGreyhound()
            {
                MPBox = pictureBox2,
                RTLen = rTLength,
                SPos  = sPosition
            };

            cockGreyhounds[1] = new CockGreyhound()
            {
                MPBox = pictureBox3,
                RTLen = rTLength,
                SPos  = sPosition
            };
            cockGreyhounds[2] = new CockGreyhound()
            {
                MPBox = pictureBox4,
                RTLen = rTLength,
                SPos  = sPosition
            };
            cockGreyhounds[3] = new CockGreyhound()
            {
                MPBox = pictureBox5,
                RTLen = rTLength,
                SPos  = sPosition
            };

            //this part is for assigning the constructor values which is created in guy class
            Punter[] punters = new Punter[3];
            punters[0] = Factory.CreatePunter("Jo");
            punters[0].SetPunter(null, 50, JoRadioButton, JoBetLabel);
            cockClients[0] = new CockClient("Jo", null, 50, JoRadioButton, JoBetLabel);
            punters[1]     = Factory.CreatePunter("Ali");
            punters[1].SetPunter(null, 50, AliRadioButton, AliBetLabel);
            cockClients[1] = new CockClient("Ali", null, 50, AliRadioButton, AliBetLabel);
            punters[2]     = Factory.CreatePunter("Mary");
            punters[2].SetPunter(null, 50, MaryRadioButton, MaryBetLabel);
            cockClients[2] = new CockClient("Mary", null, 50, MaryRadioButton, MaryBetLabel);

            foreach (CockClient guy in cockClients)
            {
                guy.UpdateLabels();//using the foreach loop for assigning the values of labels for bet
            }
        }
コード例 #4
0
 public CockBet(int Price, int C**k, CockClient cockClient)//this is constructor
 {
     this.Price      = Price;
     this.C**k       = C**k;
     this.cockClient = cockClient;
 }