/// <summary> /// 检查是否有新的客户端接出来 /// </summary> private void CheckConnecter() { for (int iIndex = 0; iIndex < m_Connecters.Length; iIndex++) { Connecter connecter = m_Connecters[iIndex]; // 检查是否已经处理过 if (connecter.IsNeedSlice == false) { continue; } // 获取连接出去的客户端 ClientSocketManager clientSocketManager = connecter.Slice(); if (clientSocketManager != null) { // 把连接出来的客户端放置入NetState中,当前的实例会保存在NetState.Instances中 NetState netState = new NetState(clientSocketManager, this); OnNetStateInit(netState); netState.Start(); } } }
/// <summary> /// 检查是否有新的客户端接过来 /// </summary> private void CheckListener() { for (int iIndex = 0; iIndex < m_Listeners.Length; iIndex++) { Listener listener = m_Listeners[iIndex]; // 获取连接的客户端 ClientSocketManager[] acceptedManager = listener.Slice(); for (int iIndex2 = 0; iIndex2 < acceptedManager.Length; iIndex2++) { ClientSocketManager clientSocketManager = acceptedManager[iIndex2]; if (clientSocketManager == null) { continue; } // 把连接过来的客户端放置入NetState中,当前的实例会保存在NetState.Instances中 NetState netState = new NetState(clientSocketManager, this); OnNetStateInit(netState); netState.Start(); } } }
/// <summary> /// 检查是否有新的客户端接出来 /// </summary> private void CheckConnecter() { for ( int iIndex = 0; iIndex < m_Connecters.Length; iIndex++ ) { Connecter connecter = m_Connecters[iIndex]; // 检查是否已经处理过 if ( connecter.IsNeedSlice == false ) continue; // 获取连接出去的客户端 ClientSocketManager clientSocketManager = connecter.Slice(); if ( clientSocketManager != null ) { // 把连接出来的客户端放置入NetState中,当前的实例会保存在NetState.Instances中 NetState netState = new NetState( clientSocketManager, this ); OnNetStateInit( netState ); netState.Start(); } } }
/// <summary> /// 检查是否有新的客户端接过来 /// </summary> private void CheckListener() { for ( int iIndex = 0; iIndex < m_Listeners.Length; iIndex++ ) { Listener listener = m_Listeners[iIndex]; // 获取连接的客户端 ClientSocketManager[] acceptedManager = listener.Slice(); for ( int iIndex2 = 0; iIndex2 < acceptedManager.Length; iIndex2++ ) { ClientSocketManager clientSocketManager = acceptedManager[iIndex2]; if ( clientSocketManager == null ) continue; // 把连接过来的客户端放置入NetState中,当前的实例会保存在NetState.Instances中 NetState netState = new NetState( clientSocketManager, this ); OnNetStateInit( netState ); netState.Start(); } } }