Ejemplo n.º 1
0
    private void checkEvent(LinkedList <TimerEvent> list, float totalTime)
    {
        LinkedListNode <TimerEvent> node     = list.First;
        List <TimerEvent>           tempList = new List <TimerEvent>();

        while (node != null)
        {
            TimerEvent e = node.Value;
            if (e._isDelete)
            {
                node = node.Next;
            }
            else
            {
                if (e._targetTime > totalTime)
                {
                    break;
                }
                e._offsetTime = totalTime - e._targetTime;
                e._callBack.onTimeUp(e._id, e._offsetTime);
                if (e._isLoop)
                {
                    int multi = (int)(e._offsetTime / e._nextTime);
                    e._offsetTime -= e._nextTime * multi;
                    tempList.Add(e.clone());
                }
                e.delete();
                node = node.Next;
            }
        }
        foreach (TimerEvent te in tempList)
        {
            register(te, list, totalTime);
        }
    }