//---------------------------------------------- /// 重设Timer倒计时 /// @sequence /// @totalTime //---------------------------------------------- public void ResetTimerTotalTime(int sequence, int totalTime) { ILRCTimer timer = GetTimer(sequence); if (timer != null) { timer.ResetTotalTime(totalTime); } }
//---------------------------------------------- /// 重置Timer /// @sequence //---------------------------------------------- public void ResetTimer(int sequence) { ILRCTimer timer = GetTimer(sequence); if (timer != null) { timer.Reset(); } }
//---------------------------------------------- /// 暂停Timer /// @sequence //---------------------------------------------- public void PauseTimer(int sequence) { ILRCTimer timer = GetTimer(sequence); if (timer != null) { timer.Pause(); } }
//-------------------------------------- /// 还差多少时间 //-------------------------------------- public int GetLeftTime(int sequence) { ILRCTimer timer = GetTimer(sequence); if (timer != null) { return(timer.GetLeftTime() / 1000); //转成多少秒 } return(-1); }
//---------------------------------------------- /// 获取Timer的当前时间 /// @sequence //---------------------------------------------- public int GetTimerCurrent(int sequence) { ILRCTimer timer = GetTimer(sequence); if (timer != null) { return(timer.CurrentTime); } return(-1); }
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); }