public void addEventTask(GameEvent evt, Action <GameEvent> listenerFun) { taskEvent taskEvent = taskEvent.alloc(); taskEvent.evt = evt; taskEvent.listenerFun = listenerFun; this._taskList.Add(taskEvent); }
public static void free(taskEvent te) { bool flag = te == null; if (!flag) { te.evt = null; te.listenerFun = null; taskEvent.m_pool.AddLast(te); } }
static public taskEvent alloc() { if (m_pool.Count > 0) { taskEvent evt = m_pool.Last.Value; m_pool.RemoveLast(); return(evt); } return(new taskEvent()); }
static public void free(taskEvent te) { if (te == null) { return; } te.evt = null; te.listenerFun = null; m_pool.AddLast(te); }
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); } }
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); } }