Beispiel #1
0
 public void AddTimer(string timerId, float delayTime, float intervalTime, int count, TimerContent.TickFunc call, object pArgs = null)
 {
     AddTimer(timerId, 0f, 0f, delayTime, intervalTime, call, pArgs, count);
 }
Beispiel #2
0
        public void AddTimer(string timerId, float startTime, float endTime, float delayTime, float intervalTime, TimerContent.TickFunc call, object pArgs, int count)
        {
            if (_timerMap.ContainsKey(timerId))
            {
                print("timerID重名了");
                return;
            }

            TimerContent item = new TimerContent();

            item.timerID       = timerId;
            item.tickCount     = count;
            item.callback      = call;
            item.delay         = delayTime;
            item.currTickCount = 0;

            if (startTime < Time.time)
            {
                item.sTime = Time.time;
            }
            else
            {
                item.sTime = startTime;
            }

            if (endTime < Time.time)
            {
                item.eTime = Time.time;
            }
            else
            {
                item.eTime = endTime;
            }

            if (delayTime > 0)
            {
                item.eTime += delayTime;
                //print("@@@:" + item.eTime);
            }

            item.args     = pArgs;
            item.interval = intervalTime;


            _runTimers.Add(item);
            _timerMap[timerId] = item;
        }
Beispiel #3
0
 public void AddTimer(string timerId, float delayTime, TimerContent.TickFunc call, object pArgs = null)
 {
     AddTimer(timerId, 0f, 0f, delayTime, 0, call, pArgs, 1);
 }