NetObject* pNetObject = m_pNetModule->GetNet()->GetNetObject(sockIndex); if (pNetObject) { if (pNetObject->GetConnectKeyState() == 0) { //Normally, you could check the account and password is correct or not, but for our situation, it will correct by default as here is the tutorial code. int loginResult = 0;//0 means successful, else means error code from account platform. if (0 != loginResult) { std::ostringstream strLog; strLog << "Check password failed, Account = " << xMsg.account() << " Password = " << xMsg.password(); m_pLogModule->LogError(NFGUID(0, sockIndex), strLog, __FUNCTION__, __LINE__);
switch (xMsg.chat_channel()) { case NFMsg::ReqAckPlayerChat::EGCC_GLOBAL: { //this code means the game server will sends a message to all players who playing game m_pNetModule->SendMsgPBToAllClient(NFMsg::ACK_CHAT, xMsg); } break; case NFMsg::ReqAckPlayerChat::EGCC_ROOM: { constint sceneID = m_pKernelModule->GetPropertyInt(nPlayerID, NFrame::Player::SceneID()); constint groupID = m_pKernelModule->GetPropertyInt(nPlayerID, NFrame::Player::GroupID());
//this code means the game server will sends a message to all players who in the same room m_pGameServerNet_ServerModule->SendGroupMsgPBToGate(NFMsg::ACK_CHAT, xMsg, sceneID, groupID); } break; default: { //this code means the game server will sends a message yourself(nPlayerID) m_pGameServerNet_ServerModule->SendMsgPBToGate(NFMsg::ACK_CHAT, xMsg, nPlayerID); } break;; } }