1234567891011121314151617181920212223242526272829303132333435 |
- using CommonLang.IO;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- namespace CommonLang
- {
- public class SimpleTrigger
- {
- private long mNextTirggerTime;
- private int mInterval = 0;
- public SimpleTrigger(int interval)
- {
- this.mInterval = interval;
- this.Reset();
- }
- public void Reset()
- {
- this.mNextTirggerTime = CommonLang.CUtils.localTimeMS + this.mInterval;
- }
- public bool IsTrigger()
- {
- if(this.mNextTirggerTime < CommonLang.CUtils.localTimeMS)
- {
- this.mNextTirggerTime = CommonLang.CUtils.localTimeMS + this.mInterval;
- return true;
- }
- return false;
- }
- }
- }
|