Set() public static méthode

public static Set ( ) : void
Résultat void
Exemple #1
0
            public void TimerMain()
            {
                long now;
                int  i, j;
                bool loaded;

                while (!Core.Closing)
                {
                    if (World.Loading || World.Saving)
                    {
                        m_Signal.WaitOne(1, false);
                        continue;
                    }
                    ProcessChanged();

                    loaded = false;

                    for (i = 0; i < m_Timers.Length; i++)
                    {
                        now = Core.TickCount;
                        if (now < m_NextPriorities[i])
                        {
                            break;
                        }

                        m_NextPriorities[i] = now + m_PriorityDelays[i];

                        for (j = 0; j < m_Timers[i].Count; j++)
                        {
                            Timer t = m_Timers[i][j];

                            if (!t.m_Queued && now > t.m_Next)
                            {
                                t.m_Queued = true;

                                lock (m_Queue)
                                    m_Queue.Enqueue(t);

                                loaded = true;

                                if (t.m_Count != 0 && (++t.m_Index >= t.m_Count))
                                {
                                    t.Stop();
                                }
                                else
                                {
                                    t.m_Next = now + t.m_Interval;
                                }
                            }
                        }
                    }

                    if (loaded)
                    {
                        Core.Set();
                    }

                    m_Signal.WaitOne(10, false);
                }
            }
Exemple #2
0
            public void TimerMain()
            {
                DateTime now;
                int      i, j;
                bool     loaded;

                while (!Core.Closing)
                {
                    // Uncomment to prevent timers from ticking during world saves.
                    if (World.Saving)
                    {
                        Thread.Sleep(0);
                        continue;
                    }

                    ProcessChangeQueue();

                    loaded = false;

                    for (i = 0; i < m_Timers.Length; i++)
                    {
                        now = DateTime.UtcNow;
                        if (now < m_NextPriorities[i])
                        {
                            break;
                        }

                        m_NextPriorities[i] = now + m_PriorityDelays[i];

                        for (j = 0; j < m_Timers[i].Count; j++)
                        {
                            Timer t = m_Timers[i][j];

                            if (!t.m_Queued && now > t.m_Next)
                            {
                                t.m_Queued = true;

                                lock (m_Queue)
                                    m_Queue.Enqueue(t);

                                loaded = true;

                                if (t.m_Count != 0 && (++t.m_Index >= t.m_Count))
                                {
                                    t.Stop();
                                }
                                else
                                {
                                    t.m_Next = now + t.m_Interval;
                                }
                            }
                        }
                    }

                    if (loaded)
                    {
                        Core.Set();
                    }

                    m_Signal.WaitOne(10, false);
                }
            }