public NetAgentBase GetNetAgent(ulong id) { NetAgentBase ret = null; m_netAgents.TryGetValue(id, out ret); return(ret); }
public ulong AddNetAgent(NetAgentBase netAgent) { ++m_lastId; netAgent.id = m_lastId; m_netAgents.Add(m_lastId, netAgent); return(m_lastId); }
public void RemoveNetAgent(ulong id) { NetAgentBase na = this.GetNetAgent(id); m_netAgents.Remove(id); if (null != na) { m_eventMgr.Fire(NetModuleEventDef.Remove_NetAgent, na); } }
protected override void OnUpdate() { base.OnUpdate(); List <ulong> toRemoveAgentIds = new List <ulong>(); var tmpAgents = new Dictionary <ulong, NetAgentBase>(m_netAgents); foreach (var kvPair in tmpAgents) { ulong id = kvPair.Key; NetAgentBase na = kvPair.Value; NetAgentState curr_state = na.GetState(); if (NetAgentState.Closed == curr_state || NetAgentState.Free == curr_state) { toRemoveAgentIds.Add(id); } na.UpdateIO(); } foreach (ulong id in toRemoveAgentIds) { RemoveNetAgent(id); } }
public void OnRemoveNetAgent(string evString, NetAgentBase netAgent) { // AppLog.Debug("OnRemoveNetAgent {0}", netAgent.id); }