Exemplo n.º 1
0
        public void addEventTask(GameEvent evt, Action <GameEvent> listenerFun)
        {
            taskEvent taskEvent = taskEvent.alloc();

            taskEvent.evt         = evt;
            taskEvent.listenerFun = listenerFun;
            this._taskList.Add(taskEvent);
        }
Exemplo n.º 2
0
        public static void free(taskEvent te)
        {
            bool flag = te == null;

            if (!flag)
            {
                te.evt         = null;
                te.listenerFun = null;
                taskEvent.m_pool.AddLast(te);
            }
        }
Exemplo n.º 3
0
        static public taskEvent alloc()
        {
            if (m_pool.Count > 0)
            {
                taskEvent evt = m_pool.Last.Value;
                m_pool.RemoveLast();
                return(evt);
            }

            return(new taskEvent());
        }
Exemplo n.º 4
0
        static public void free(taskEvent te)
        {
            if (te == null)
            {
                return;
            }

            te.evt         = null;
            te.listenerFun = null;

            m_pool.AddLast(te);
        }
Exemplo n.º 5
0
 private void _process_updata(float tmSlice)
 {
     while (this._taskList.Count > 0)
     {
         taskEvent taskEvent = this._taskList[0];
         this._taskList.RemoveAt(0);
         double num = (double)CCTime.getTickMillisec();
         taskEvent.listenerFun(taskEvent.evt);
         double procTm = (double)CCTime.getTickMillisec() - num;
         ProfilerManager.inst.profilerMark(procTm, "gameEventDelegate", taskEvent.evt.type.ToString());
         taskEvent.free(taskEvent);
     }
 }
Exemplo n.º 6
0
        public static taskEvent alloc()
        {
            bool      flag = taskEvent.m_pool.Count > 0;
            taskEvent result;

            if (flag)
            {
                taskEvent value = taskEvent.m_pool.Last.Value;
                taskEvent.m_pool.RemoveLast();
                result = value;
            }
            else
            {
                result = new taskEvent();
            }
            return(result);
        }
        private void _process_updata(float tmSlice)
        {        //  todo time limit and profile
            while (_taskList.Count > 0)
            {
                taskEvent t = _taskList[0];
                _taskList.RemoveAt(0);

#if DEBUG
                // 统计消息处理时间,profiler分析
                double beginTm = CCTime.getTickMillisec();
#endif

                t.listenerFun(t.evt);

#if DEBUG
                double procTm = CCTime.getTickMillisec() - beginTm;

                ProfilerManager.inst.profilerMark(procTm, "gameEventDelegate", t.evt.type.ToString());
#endif

                taskEvent.free(t);
            }
        }