本文整理汇总了C++中Account::SetCurGamedPlayerGuid方法的典型用法代码示例。如果您正苦于以下问题:C++ Account::SetCurGamedPlayerGuid方法的具体用法?C++ Account::SetCurGamedPlayerGuid怎么用?C++ Account::SetCurGamedPlayerGuid使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Account
的用法示例。
在下文中一共展示了Account::SetCurGamedPlayerGuid方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnLogMessage
//.........这里部分代码省略.........
}
char szGUID[128]="";
PlayerGuid.tostring(szGUID);
switch(lFlag)
{
case 1: // 正常退出
{
CPlayer* pPlayer = GetGame().GetMapPlayer(PlayerGuid);
if(NULL == pPlayer)
{
pPlayer = GetGame().NewRawPlayer(ePlayerQuitMsg);
pPlayer->SetExID(PlayerGuid);
// 更新WS上该玩家数据
DBReadSet setReadDB;
pMsg->GetDBReadSet(setReadDB);
pPlayer->DecodeFromDataBlock(setReadDB);
if(pPlayer)
{
if(GetNetHandler().IsServerReady(NF_DB_SERVER))
{
CWorldServerSession pSession(5000);
// 设置当前账号状态
Account* pAcc = NULL;
CEntityGroup* tDBLoginPlayer = NULL;
if(pPlayer->GetAccount())
pAcc = GetGame().GetEntityManager()->FindAccount(pPlayer->GetAccount());
if(pAcc)
{
if(pAcc->GetPlayerState() != PLAYER_STATE_VOID)
pAcc->SetPlayerState(PLAYER_STATE_BACKTOLOGIN);
pAcc->SetCurGamedPlayerGuid(NULL_GUID);
tDBLoginPlayer = pAcc->FindLoginPlayer(pPlayer->GetExID());
pSession.NakeSendSaveLoginPlayerDataMsg(pPlayer, tDBLoginPlayer);
}
else
{
tDBLoginPlayer = (CEntityGroup*)GetGame().GetEntityManager()->NewBaseEntity(string("[loginplayer]"), pPlayer->GetExID());
pSession.NakeSendSaveLoginPlayerDataMsg(pPlayer, tDBLoginPlayer);
GetGame().GetEntityManager()->DelBaseEntity((CBaseEntity*)tDBLoginPlayer);
}
CEntityGroup* tDBPlayer = (CEntityGroup*)GetGame().GetEntityManager()->NewBaseEntity(string("[player]"), pPlayer->GetExID());
pSession.NakeSendSavePlayerDataMsg(SAVE_DETAIL_ALL, pPlayer, tDBPlayer, true);
GetGame().GetEntityManager()->DelBaseEntity((CBaseEntity*)tDBPlayer);
GetGame().DelRawPlayer(pPlayer);
}
else
GetGame().PushSavePlayer(pPlayer);
}
return;
}
else
{
// 更新WS上该玩家数据
DBReadSet setReadDB;
pMsg->GetDBReadSet(setReadDB);
pPlayer->DecodeFromDataBlock(setReadDB);
pPlayer->SetPlayerLogin(false);
pPlayer->SetFirstLogin(false);
if(GetNetHandler().IsServerReady(NF_DB_SERVER))
{
const char* szCdkey = pPlayer->GetAccount();