Example #1
0
 public int InvokeOnce(float delay, CBInvoke cbInvoke)
 {
     if (null != cbInvoke)
     {
         InvokeItem item = null;
         if (m_recycled.Count > 0)
         {
             item = m_recycled[0];
             m_recycled.RemoveAt(0);
         }
         else
         {
             item = new InvokeItem();
         }
         item.flag            = 0;
         item.iId             = ++ms_handle_id;
         item.repeat          = 1;
         item.interval        = 0;
         item.repeat_interval = 0;
         item.delay           = (int)delay * m_fps;
         item.cbInvoke        = cbInvoke;
         m_actives.Add(item);
         return(item.iId);
     }
     return(-1);
 }
Example #2
0
 public int InvokeRepeate(float delay, float interval, CBInvoke cbInvoke, int repeat = -1, bool global = false)
 {
     if (null != cbInvoke)
     {
         InvokeItem item = null;
         if (m_recycled.Count > 0)
         {
             item = m_recycled[0];
             m_recycled.RemoveAt(0);
         }
         else
         {
             item = new InvokeItem();
         }
         item.flag = 0;
         if (repeat < 0)
         {
             item.flag |= FLAG_REPEAT_FOREVER;
         }
         if (global)
         {
             item.flag |= FLAG_GLOBAL;
         }
         item.iId             = ++ms_handle_id;
         item.repeat          = repeat;
         item.delay           = (int)delay * m_fps;
         item.interval        = (int)interval * m_fps;
         item.repeat_interval = 0;
         item.cbInvoke        = cbInvoke;
         m_actives.Add(item);
         return(item.iId);
     }
     return(-1);
 }
Example #3
0
 public void Reset()
 {
     flag            = 0;
     iId             = -1;
     repeat          = 1;
     delay           = 0;
     interval        = 0;
     repeat_interval = 0;
     cbInvoke        = null;
 }