Beispiel #1
0
        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();
        }
Beispiel #2
0
        public bool Cancel(int id)
        {
            TimeItem item = TimeItem.GetTimeItemByID(id);

            if (item == null)
            {
                return(false);
            }

            item.Cancel();
            return(true);
        }
Beispiel #3
0
 public static void RemoveTimer(TimeItem item)
 {
     if (_items.Remove(item))
     {
         item.Cancel();
         if (_idles.Count < MAX_IDLE)
         {
             _idles.Add(item);
         }
         else
         {
             item.Dispose();
         }
     }
 }
Beispiel #4
0
    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);
    }