コード例 #1
0
        public Roulette()
        {
            InitializeComponent();
            TheGame         = new RoulleteGame();
            lbl_Bet.Text    = "Your bet " + TheGame.Bets.Count() + "$";
            lbl_Earned.Text = "Make a round to get your earnings";
            changeMoney();
            timerSeconds.Start();
            SoundPlayer = new SoundPlayer();
            timerRoll.Start();
            int left = 620;
            int top  = 0;

            for (int i = 1; i <= 17; i++)
            {
                BetOnPicture pb = new BetOnPicture();

                Controls.Add(pb);
                pb.Name     = "bet_" + i;
                pb.Location = new Point(left, top);
                left       += 105;
                pb.Size     = new Size(100, 130);
                pb.Position = i;

                if (i <= 13)
                {
                    pb.Chance                = 12;
                    pb.BackgroundImage       = (Image)Resources.ResourceManager.GetObject("bet_" + i);
                    pb.BackgroundImageLayout = ImageLayout.Stretch;
                }
                else if (i == 14)
                {
                    pb.Chance    = 2;
                    pb.BackColor = Color.Black;
                }
                else if (i == 15)
                {
                    pb.Chance    = 2;
                    pb.BackColor = Color.Red;
                }
                else if (i == 16)
                {
                    pb.Chance                = 2;
                    pb.BackgroundImage       = (Image)Resources.ResourceManager.GetObject("male");
                    pb.BackgroundImageLayout = ImageLayout.Stretch;
                }
                else if (i == 17)
                {
                    pb.Chance                = 2;
                    pb.BackgroundImage       = (Image)Resources.ResourceManager.GetObject("female");
                    pb.BackgroundImageLayout = ImageLayout.Stretch;
                }

                pb.Click += new System.EventHandler(CashPlusOnButton);

                if (i % 7 == 0)
                {
                    left = 620;
                    top += 140;
                }
                SoundPlayer.Stream = Resources.Vlogovi;
                SoundPlayer.Play();
            }
        }
コード例 #2
0
 public void BetOn(BetOnPicture bet)
 {
     Bets.Add(bet);
 }