Ejemplo n.º 1
0
        public static void DeleteTimeListener(TimerListerType type)
        {
            TimeListener timeLlister = m_listTimeListener.Find(delegate(TimeListener timer) { return(timer.m_timerType == type); });

            m_listTimeListener.Remove(timeLlister);
            sortTimeListener();
        }
Ejemplo n.º 2
0
        public static TimeListener AddTimeListener(System.Action callBackHandler, DateTime dateTime, TimerListerType type = TimerListerType.NULL)
        {
            TimeListener timeListener = new TimeListener(callBackHandler, dateTime, type);

            m_listTimeListener.Add(adjustEquilTime(timeListener));
            sortTimeListener();
            return(timeListener);
        }
Ejemplo n.º 3
0
        public static TimeListener AddTimeListener(System.Action callBackHandler, float fTriggerTime, TimerListerType type = TimerListerType.NULL)
        {
            DateTime     m_triggerTime = CurrentDateTime().AddSeconds(fTriggerTime);
            TimeListener timeListener  = new TimeListener(callBackHandler, m_triggerTime, type);

            m_listTimeListener.Add(adjustEquilTime(timeListener));
            sortTimeListener();
            return(timeListener);
        }
Ejemplo n.º 4
0
 /* 相同时间的 根据添加顺序调用 **/
 private static TimeListener adjustEquilTime(TimeListener dateTime)
 {
     for (int i = 0, count = m_listTimeListener.Count; i < count; i++)
     {
         TimeListener listener = m_listTimeListener[i];
         if (dateTime.m_triggerTime == listener.m_triggerTime)
         {
             dateTime.sort = listener.sort + 1;
             return(dateTime);
         }
     }
     return(dateTime);
 }
Ejemplo n.º 5
0
        public static void Update()
        {
            //事件监听的时时检测
            for (int i = m_listTimeListener.Count - 1; i >= 0; i--)
            {
                TimeListener timeListener = m_listTimeListener[i];

                if (timeListener == null)
                {
                    continue;
                }

                if (CurrentDateTime() >= timeListener.m_triggerTime)
                {
                    if (timeListener.m_handler != null)
                    {
                        m_listTimeListener.RemoveAt(i);
                        timeListener.m_handler();
                    }
                }
            }
        }
Ejemplo n.º 6
0
 public static bool Contain(TimeListener listener)
 {
     return(m_listTimeListener.Contains(listener));
 }
Ejemplo n.º 7
0
 /** 移除定时器 */
 public static void RemoveListener(TimeListener target)
 {
     m_listTimeListener.Remove(target);
 }