Beispiel #1
0
        private void _onProcess(float tmSlice)
        {        //todo profile
            List <IProcess> _remove = new List <IProcess>();
            int             i       = 0;
            IProcess        p;

            // 统计消息处理时间,profiler分析
            double startTm = CCTime.getTickMillisec();

            for (i = 0; i < _processVec.Count; i++)
            {
                p = _processVec[i];
                if (p == null)
                {
                    GameTools.PrintError("processQueue onProcess null!");
                    continue;
                }

                if (p.pause)
                {
                    continue;
                }
                if (p.destroy)
                {
                    _remove.Add(p);
                    continue;
                }


                double beginTm = CCTime.getTickMillisec();

                p.updateProcess(tmSlice);

                double procTm = CCTime.getTickMillisec() - beginTm;
                ProfilerManager.inst.profilerMark(procTm, _debugFlag, p.processName);

                if (startTm - beginTm > _limittmMS)
                {
                    break;
                }
            }

            foreach (IProcess match in _remove)
            {
                for (i = _processVec.Count - 1; i >= 0; i--)
                {
                    p = _processVec[i];
                    if (match != p)
                    {
                        continue;
                    }
                    _processVec.RemoveAt(i);
                    break;
                }
            }
        }
Beispiel #2
0
        private void _onProcess(float tmSlice)
        {
            List <IProcess> list = new List <IProcess>();
            double          num  = (double)CCTime.getTickMillisec();

            for (int i = 0; i < this._processVec.Count; i++)
            {
                IProcess process = this._processVec[i];
                bool     flag    = process == null;
                if (flag)
                {
                    GameTools.PrintError("processQueue onProcess null!");
                }
                else
                {
                    bool pause = process.pause;
                    if (!pause)
                    {
                        bool destroy = process.destroy;
                        if (destroy)
                        {
                            list.Add(process);
                        }
                        else
                        {
                            double num2 = (double)CCTime.getTickMillisec();
                            process.updateProcess(tmSlice);
                            double procTm = (double)CCTime.getTickMillisec() - num2;
                            ProfilerManager.inst.profilerMark(procTm, this._debugFlag, process.processName);
                            bool flag2 = num - num2 > (double)this._limittmMS;
                            if (flag2)
                            {
                                break;
                            }
                        }
                    }
                }
            }
            foreach (IProcess current in list)
            {
                for (int i = this._processVec.Count - 1; i >= 0; i--)
                {
                    IProcess process = this._processVec[i];
                    bool     flag3   = current != process;
                    if (!flag3)
                    {
                        this._processVec.RemoveAt(i);
                        break;
                    }
                }
            }
        }
 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);
     }
 }
        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);
            }
        }