//---------------------------------------------- /// 移除Timer /// @onTimeUpHandler //---------------------------------------------- public void RemoveTimer(ILRCTimer.OnTimeUpHandler onTimeUpHandler) { List <ILRCTimer> timers = m_timers[(int)(enTimerType.Normal)]; for (int i = 0; i < timers.Count; i++) { if (timers[i].IsDelegateMatched(onTimeUpHandler)) { timers[i].Finish(); continue; } } }
private int _AddTimer(int time, int loop, ILRCTimer.OnTimeUpHandler onTimeUpHandler, enTimerType type, object arg = null) { m_timerSequence++; if (Application.isPlaying) { var timer = new ILRCTimer(ILRCTimer.TimerType.timer); timer.Arg = arg; timer.ResetWith(time, loop, onTimeUpHandler, m_timerSequence); m_timers[(int)type].Add(timer); } return(m_timerSequence); }
//---------------------------------------------- /// 添加Timer /// @time : 计时时间(ms) /// @loop : 循环次数(0: forever) /// @onTimeUpHandler : 时间到时的回调函数 /// @return sequence of timer //---------------------------------------------- public int AddTimer(int time, int loop, ILRCTimer.OnTimeUpHandler onTimeUpHandler) { return(AddTimer(time, loop, onTimeUpHandler, false, null)); }
//---------------------------------------------- /// 添加Timer /// @time : 计时时间(ms) /// @loop : 循环次数 /// @onTimeUpHandler : 时间到时的回调函数 /// @useFrameSync : 是否使用桢同步 /// @return sequence of timer //---------------------------------------------- private int AddTimer(int time, int loop, ILRCTimer.OnTimeUpHandler onTimeUpHandler, bool useFrameSync, object arg) { return(_AddTimer(time, loop, onTimeUpHandler, enTimerType.Normal, arg)); }
public int AddLateUpdateTimer(int time, int loop, ILRCTimer.OnTimeUpHandler onTimeUpHandler) { return(_AddTimer(time, loop, onTimeUpHandler, enTimerType.LateUpdate, null)); }