コード例 #1
0
        public NetAgentBase GetNetAgent(ulong id)
        {
            NetAgentBase ret = null;

            m_netAgents.TryGetValue(id, out ret);
            return(ret);
        }
コード例 #2
0
 public ulong AddNetAgent(NetAgentBase netAgent)
 {
     ++m_lastId;
     netAgent.id = m_lastId;
     m_netAgents.Add(m_lastId, netAgent);
     return(m_lastId);
 }
コード例 #3
0
        public void RemoveNetAgent(ulong id)
        {
            NetAgentBase na = this.GetNetAgent(id);

            m_netAgents.Remove(id);
            if (null != na)
            {
                m_eventMgr.Fire(NetModuleEventDef.Remove_NetAgent, na);
            }
        }
コード例 #4
0
        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);
            }
        }
コード例 #5
0
ファイル: GameNet.cs プロジェクト: lingfan/lxl_cpp
 public void OnRemoveNetAgent(string evString, NetAgentBase netAgent)
 {
     // AppLog.Debug("OnRemoveNetAgent {0}", netAgent.id);
 }