public Guid InitTimer(ETimerType timerType, TickController controller, int interval, Guid guid) { switch (timerType) { case ETimerType.System: { System.Timers.Timer wTimer = new System.Timers.Timer(); wTimer.Interval = interval * 1000; wTimer.Elapsed += new ElapsedEventHandler(Timer_Elapsed); TickTimers.Add(guid, new TTimer { Guid = guid, Type = timerType, Timer = wTimer, Controller = controller }); wTimer.Start(); } break; case ETimerType.Form: { System.Windows.Forms.Timer wTimer = new System.Windows.Forms.Timer(); wTimer.Interval = interval * 1000; wTimer.Tick += new EventHandler(Timer_Tick); TickTimers.Add(guid, new TTimer { Guid = guid, Type = timerType, Timer = wTimer, Controller = controller }); wTimer.Start(); } break; } return(guid); }
public void stopTimer(ETimerType ttype) { switch (ttype) { case ETimerType.ENOREPLY: _noreplyTimer.Stop(); break; case ETimerType.ERELEASED: _releasedTimer.Stop(); break; } }
/// <summary> /// Stop timer by timer type /// </summary> /// <param name="ttype">timer type</param> internal override bool StopTimer(ETimerType ttype) { bool success = false; switch (ttype) { case ETimerType.ENOREPLY: success = _noreplyTimer.Stop(); break; //case ETimerType.ERELEASED: // success = _releasedTimer.Stop(); // break; case ETimerType.ENORESPONSE: success = _noresponseTimer.Stop(); break; } return(success); }
private float limitTime; //上限 public Timer(float second, ETimerType type = ETimerType.ScaledTime) { timerType = type; limitTime = second; Initialize(); }
internal abstract bool startTimer(ETimerType ttype);
internal override bool startTimer(ETimerType ttype) { return(false); }
internal abstract bool StopTimer(ETimerType ttype);
internal override bool StopTimer(ETimerType ttype) { return false; }
public Guid InitTimer(ETimerType timerType, TickController controller, int interval) { return(InitTimer(timerType, controller, interval, Guid.NewGuid())); }
public void startLongTimer() { _endTime = Time.time+longCountdownTime; timerType = ETimerType.Long; }
public void startStandardTimer() { _endTime = Time.time+standardCountdownTime; timerType = ETimerType.Standard; }
internal override bool startTimer(ETimerType ttype) { return false; }
/// <summary> /// Stop timer by timer type /// </summary> /// <param name="ttype">timer type</param> internal override bool StopTimer(ETimerType ttype) { bool success = false; switch (ttype) { case ETimerType.ENOREPLY: success = _noreplyTimer.Stop(); break; case ETimerType.ERELEASED: success = _releasedTimer.Stop(); break; case ETimerType.ENORESPONSE: success = _noresponseTimer.Stop(); break; } return success; }
internal override bool StopTimer(ETimerType ttype) { return(false); }
public void stop() { timerType = ETimerType.Stopped; if(_labelComponent!=null) _labelComponent.text = ""; }