示例#1
0
        private void timerSeconds_Tick(object sender, EventArgs e)
        {
            if (!TheGame.GameFinished)
            {
                if (TheGame.Timer == 3)
                {
                    SoundPlayer.Stream = Resources.Oblozuvanjeto;
                    SoundPlayer.Play();
                }
                if (TheGame.Timer > 0)
                {
                    TheGame.Timer--;
                }
                lblTimeStart.Text = TheGame.Timer.ToString();
            }
            else
            {
                double res      = TheGame.Ball.Angle % 6.3;
                int    position = (int)Math.Abs(Math.Floor(res / (6.3 / 13.00)));

                int suma = TheGame.CalculateFor(position);
                if (suma > 0)
                {
                    SoundPlayer.Stream = Resources.money;
                    SoundPlayer.Play();
                }
                Form1.CurrPlayer.Money += suma;
                lbl_Earned.Text         = "You earned " + suma + "$";
                changeMoney();
                loadTheBets();
                lbl_Bet.Text = "Your bet " + TheGame.Bets.Count() + "$";

                new Thread(() =>
                {
                    Thread.Sleep(3000);
                    SoundPlayer.Stream = Resources.Vlogovi;
                    SoundPlayer.Play();
                }).Start();
                TheGame = new RoulleteGame();
            }
        }