void NFDBNet_ServerModule::OnSaveRoleDataProcess(const NFSOCK nSockIndex, const int nMsgID, const char * msg, const uint32_t nLen) { NFGUID nClientID; NFMsg::RoleDataPack xMsg; if (!m_pNetModule->ReceivePB(nMsgID, msg, nLen, xMsg, nClientID)) { return; } NFGUID nRoleID = NFINetModule::PBToNF(xMsg.id()); NFPlayerRedisModule* pPlayerRedisModule = (NFPlayerRedisModule*)m_pPlayerRedisModule; pPlayerRedisModule->SavePlayerData(nRoleID, xMsg); //m_pNetModule->SendMsgPB(NFMsg::EGMI_ACK_LOAD_ROLE_DATA, xMsg, nSockIndex); }
void NFCCreateRoleModule::OnDBLoadRoleDataProcess(const NFSOCK nSockIndex, const int nMsgID, const char * msg, const uint32_t nLen) { NFGUID nClientID; NFMsg::RoleDataPack xMsg; if (!m_pNetModule->ReceivePB(nMsgID, msg, nLen, xMsg, nClientID)) { //releasing all the resource that allow when the user login, then kick off the user // TODO //m_pGameServerNet_ServerModule->RemovePlayerGateInfo(); //Avtually, the developer may not know the user id in this situation, therefore the developer must record the login-time when the user coming //and check the time per min to kick off the user who are not active. return; } NFGUID nRoleID = NFINetModule::PBToNF(xMsg.id()); if (m_pKernelModule->GetObject(nRoleID)) { //it should be rebind with proxy's netobject m_pKernelModule->DestroyObject(nRoleID); } mxObjectDataCache[nRoleID] = xMsg; NF_SHARE_PTR<NFIGameServerNet_ServerModule::GateBaseInfo> pGateInfo = m_pGameServerNet_ServerModule->GetPlayerGateInfo(nRoleID); if (nullptr != pGateInfo) { if (pGateInfo->eStatus == NFIGameServerNet_ServerModule::GateBaseInfo::E_LOADING) { pGateInfo->eStatus = NFIGameServerNet_ServerModule::GateBaseInfo::E_LOADED; } } NFDataList var; var.AddString(NFrame::Player::GateID()); var.AddInt(pGateInfo->nGateID); var.AddString(NFrame::Player::GameID()); var.AddInt(pPluginManager->GetAppID()); var.AddString(NFrame::Player::HomeSceneID()); var.AddInt(1); var.AddString(NFrame::Player::SceneID()); var.AddInt(1); NF_SHARE_PTR<NFIObject> pObject = m_pKernelModule->CreateObject(nRoleID, 1, 0, NFrame::Player::ThisName(), "", var); if (nullptr == pObject) { //mRoleBaseData //mRoleFDData mxObjectDataCache.erase(nRoleID); return; } //get data first then create player m_pSceneProcessModule->RequestEnterScene(pObject->Self(), 1, -1, 0, NFDataList()); }