// public void Start(ViTimer timer, UInt32 cnt, UInt32 span) { if (cnt > 0) { _reserveCnt = cnt - 1; _span = span; SetTime(timer.Time + _span); timer.Add(this); } }
public void SetReserveTime(ViTimer timer, UInt32 span, ViTime64 reserveTime) { if (span != 0) { _span = span; ViTime64 reserveTimeMod = (reserveTime > 0) ? (reserveTime - 1) : 0; _reserveCnt = (UInt32)(reserveTimeMod / _span); UInt32 reserveSpan = (UInt32)(reserveTimeMod % _span + 1); SetTime(timer.Time + reserveSpan); timer.Add(this); } }
public static void Test() { ViTimer timer = new ViTimer(); Listener listener = new Listener(); timer.Start(0, 10, 10, 10); listener._node.SetTime(10); listener._node._SetDelegate(listener.Func); timer.Add(listener._node); timer.Update(9); timer.Update(11); listener._node.Detach(); timer.End(); }
// internal override void _Exce(ViTimer timer) { if (_reserveCnt > 0) { --_reserveCnt; _delegate(this); SetTime(timer.Time + _span); timer.Add(this); } else { Callback dele = _delegate; _delegate = null; dele(this); _execTime = 0; _span = 0; } }
internal override void _Exce(ViTimer timer) { if (_reserveCnt == 0) { Callback dele = _endDelegate; _tickDelegate = null; _endDelegate = null; dele(this); // _execTime = 0; _span = 0; } else { _tickDelegate(this); --_reserveCnt; SetTime(timer.Time + _span); timer.Add(this); } }