Esempio n. 1
0
    private static float CalcCallBackTime(float delayTime)
    {
        float dlyTime = MFMath.OneDecimal(delayTime);
        float curTime = MFMath.OneDecimal(Time.time);

        return(curTime + dlyTime);
    }
Esempio n. 2
0
    public static void Update()
    {
        float curTime = MFMath.OneDecimal(Time.time);
        List <CallBackStruct> cbsList;

        if (!eventsDic.TryGetValue(curTime, out cbsList))
        {
            return;
        }

        for (int i = 0; i < cbsList.Count; i++)
        {
            CallBackStruct cbs = cbsList[i];
            if (cbs.active)
            {
                cbs.action();
            }

            timerStructDic.Remove(cbs.timerId);
            // 循环定时器被注销之后就不会再次触发
            if (cbs.active && cbs.type == TimerType.forever)
            {
                _RegisterAgain(cbs);
            }
        }

        cbsList.Clear();
        eventsDic.Remove(curTime);
    }