private bool Internal_AddTimer(string key, TIMER_MODE mode, float duration, TimerManagerHandlerArgs handler, params object[] args) { if (string.IsNullOrEmpty(key)) { return(false); } if (duration < 0.0f) { return(false); } Timer timer = new Timer(key, mode, Time.time, duration, handler, this, args); if (m_AddTimerList.ContainsKey(key)) { m_AddTimerList[key] = timer; } else { m_AddTimerList.Add(key, timer); } return(true); }
/// ----------------------------------------------------------------------------- /// <summary> /// 增加定时器 /// </summary> /// <param name=string.Empty></param> /// <returns></returns> /// ----------------------------------------------------------------------------- private static bool Internal_AddTimer(string key, TIMER_MODE mode, float duration, TimerManagerHandler handler) { if (string.IsNullOrEmpty(key)) { return(false); } if (duration < 0.0f) { return(false); } Timer timer = new Timer(key, mode, Time.realtimeSinceStartup, duration, handler); if (m_AddTimerList.ContainsKey(key)) { m_AddTimerList[key] = timer; } else { m_AddTimerList.Add(key, timer); } return(true); }
private bool Internal_AddTimer(string key, TIMER_MODE mode, float duration, TimerManagerHandlerArgs handler, int times = 0, params object[] args) { if (string.IsNullOrEmpty(key)) { return(false); } if (duration < 0.0f) { return(false); } var olderTimer = m_AddTimerList.Find(p => p.m_Name == key); if (olderTimer != null) { olderTimer.Copy(key, mode, Time.time, duration, handler, times, this, args); } else { Timer timer = new Timer(key, mode, Time.time, duration, handler, times, this, args); m_AddTimerList.Add(timer); } return(true); }
/// ----------------------------------------------------------------------------- /// <summary> /// /// </summary> /// <param name=""></param> /// <returns></returns> /// ----------------------------------------------------------------------------- public Timer(string name, TIMER_MODE mode, float startTime, float duration, TimerManagerHandler handler, TimerManager manager) { m_Name = name; m_Mode = mode; m_StartTime = startTime; m_duration = duration; m_TimerEvent = handler; m_Manger = manager; }
public Timer(string name, TIMER_MODE mode, float startTime, float duration, TimerManagerHandlerArgs handler, TimerManager manager, params object[] args) { m_Name = name; m_Mode = mode; m_StartTime = startTime; m_duration = duration; m_TimerArgsEvent = handler; m_Manger = manager; m_Args = args; }
public void Copy(string name, TIMER_MODE mode, float startTime, float duration, TimerManagerHandlerArgs handler, int times, TimerMgr manager, params object[] args) { m_Name = name; m_Mode = mode; m_StartTime = startTime; this.Duration = duration; m_TimerArgsEvent = handler; m_Manger = manager; m_Args = args; m_Times = times; }