public void Pause() { if (mIsPause) { return; } mLeftDelayTime = -1; //暂停 if (mTimeItem != null) { mLeftDelayTime = mTimeItem.SortScore - Timer.Instance.currentScaleTime; mTimeItem.Cancel(); mTimeItem = null; } mIsPause = true; mSource.Pause(); }
public bool Cancel(int id) { TimeItem item = TimeItem.GetTimeItemByID(id); if (item == null) { return(false); } item.Cancel(); return(true); }
public static void RemoveTimer(TimeItem item) { if (_items.Remove(item)) { item.Cancel(); if (_idles.Count < MAX_IDLE) { _idles.Add(item); } else { item.Dispose(); } } }
public static bool RemoveTimer(int id) { int count = _items.Count; for (int i = 0; i < count; i++) { TimeItem item = _items[i]; if (item.id == id) { _items.RemoveAt(i); item.Cancel(); if (_idles.Count < MAX_IDLE) { _idles.Add(item); } else { item.Dispose(); } return(true); } } return(false); }