Beispiel #1
0
            protected override void OnTick()
            {
                if (m_Game == null || m_Game.PowerBall == null || m_Game.Picks == null || m_Game.Picks.Count < 6)
                {
                    Stop();
                    return;
                }

                if (m_Start > DateTime.Now)
                {
                    return;
                }

                if (m_Ticks <= 5)
                {
                    string text;
                    int    num = 0;
                    try
                    {
                        num = m_Game.Picks[m_Ticks];
                    }
                    catch
                    {
                        this.Stop();
                        Console.WriteLine("Error with PowerBallGame Timer");
                        return;
                    }

                    if (m_Ticks == 0)
                    {
                        text = "The first pick is... ";
                    }
                    else if (m_Ticks < 5)
                    {
                        text = "The next pick is... ";
                    }
                    else
                    {
                        text = "And the powerball is... ";
                    }

                    if (m_Game != null && m_Game.PowerBall != null)
                    {
                        m_Game.PowerBall.PublicOverheadMessage(0, m_Ticks < 5 ? 2041 : 0x21, false, text);
                        Timer.DelayCall(TimeSpan.FromSeconds(2), new TimerStateCallback(DoDelayMessage), new object[] { m_Game.PowerBall, num, m_Ticks });
                    }

                    foreach (PowerBallSatellite sat in PowerBall.SatList)
                    {
                        sat.PublicOverheadMessage(0, m_Ticks < 5 ? 2041 : 0x21, false, text);
                        Timer.DelayCall(TimeSpan.FromSeconds(2), new TimerStateCallback(DoDelayMessage), new object[] { sat, num, m_Ticks });
                    }

                    m_Ticks++;
                    m_Start = DateTime.Now + TimeSpan.FromSeconds(8 + Utility.Random(10));
                }
                else  //Time to tally picks and start up a new game!
                {
                    m_Game.CheckForWinners();
                    PowerBall.AddToArchive(m_Game.Picks, m_Game.Payout);  //Adds pickslist to Archive for stats gump

                    if (!m_Game.HasJackpot)                               //Still no jackpot eh?
                    {
                        m_Game.NoWins++;
                        Timer.DelayCall(TimeSpan.FromSeconds(2), new TimerStateCallback(DoMessage), m_Game);
                    }
                    else
                    {
                        if (PowerBall.Announcement)
                        {
                            Timer.DelayCall(TimeSpan.FromSeconds(2), new TimerStateCallback(DoJackpotMessage), m_Game.JackpotWinners);
                        }

                        PowerBall.GoldSink += PowerBall.Instance.Profit;
                    }

                    Timer.DelayCall(TimeSpan.FromSeconds(10), new TimerStateCallback(DoWinnersMessage), m_Game);
                    m_Game.PowerBall.NewGame(m_Game.HasJackpot);

                    Stop();
                }
            }