Exemplo n.º 1
0
        //---------------------------------------------------------------------
        void _onTimer(object data)
        {
            if (Closed)
            {
                return;
            }

            LastTimeJeffies += TmSpan;
            var delta_tm = LastTimeJeffies - TimerShaft.GetTimeJeffies();

            var time_ev = new EbTimeEvent()
            {
                mExpires = TimerShaft.GetTimeJeffies() + delta_tm,
                onTime   = _onTimer,
                mData    = null
            };

            TimerShaft.AddTimer(time_ev);

            float tm = (float)Stopwatch.Elapsed.TotalSeconds;

            Stopwatch.Reset();
            Stopwatch.Start();
            FuncCb(LuaTable, tm);
        }
Exemplo n.º 2
0
        //---------------------------------------------------------------------
        public EbTimer(TimerShaft timer_shaft, ulong tm, LuaTable lua_table, DelegateLua2 cb)
        {
            TimerShaft      = timer_shaft;
            TmSpan          = tm;
            LuaTable        = lua_table;
            FuncCb          = cb;
            LastTimeJeffies = TimerShaft.GetTimeJeffies() + TmSpan;
            Closed          = false;
            Stopwatch       = new Stopwatch();
            Stopwatch.Start();

            var time_ev = new EbTimeEvent()
            {
                mExpires = TimerShaft.GetTimeJeffies() + TmSpan,
                onTime   = _onTimer,
                mData    = null
            };

            TimerShaft.AddTimer(time_ev);
        }