Example #1
0
 private XTimerMgr.XTimer GetTimer(double trigger, object handler, object parma, uint token, bool global, int id = -1)
 {
     if (this._pool.Count > 0)
     {
         XTimerMgr.XTimer xTimer = this._pool.Dequeue();
         xTimer.Refine(trigger, handler, parma, token, global, id);
         return(xTimer);
     }
     return(new XTimerMgr.XTimer(trigger, handler, parma, token, global, id));
 }
Example #2
0
 public void AdjustTimer(float interval, uint token, bool closed = false)
 {
     XTimerMgr.XTimer xTimer = null;
     if (this._dict.TryGetValue(token, out xTimer) && !xTimer.IsInPool)
     {
         double trigger     = closed ? (this._elapsed - (double)(Time.deltaTime * 0.5f) + Math.Round((double)interval, 3)) : (this._elapsed + Math.Round((double)interval, 3));
         double triggerTime = xTimer.TriggerTime;
         xTimer.Refine(trigger);
         this._timers.Adjust(xTimer, triggerTime < xTimer.TriggerTime);
     }
 }