예제 #1
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);
    }
예제 #2
0
    private static void _RegisterAgain(CallBackStruct cbs)
    {
        float callBackTime = CalcCallBackTime(cbs.delayTime);

        if (!eventsDic.ContainsKey(callBackTime))
        {
            eventsDic[callBackTime] = new List <CallBackStruct>();
        }

        eventsDic[callBackTime].Add(cbs);
        timerStructDic[cbs.timerId] = new TimerStruct(callBackTime, eventsDic[callBackTime].Count - 1);
    }
예제 #3
0
        private void bpd_addBreak(string reply, object userData)
        {
            Match match = RegexMan.BreakPointResult.Match(reply);

            if (match.Success)
            {
                int            number = Int32.Parse(match.Groups[(int)RegexMan.eBreakPointResult.number].Value);
                CallBackStruct cbs    = userData as CallBackStruct;
                mBreakPointToDispatch[number] = cbs.me;
                cbs.owner.yourBreakpointNumberIs(number);
            }
        }