本文整理汇总了C++中Obj_Human::ChangeScene方法的典型用法代码示例。如果您正苦于以下问题:C++ Obj_Human::ChangeScene方法的具体用法?C++ Obj_Human::ChangeScene怎么用?C++ Obj_Human::ChangeScene使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Obj_Human
的用法示例。
在下文中一共展示了Obj_Human::ChangeScene方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Execute
uint WGCityCloseHandler::Execute( WGCityClose* pPacket, Player* pPlayer )
{
__ENTER_FUNCTION
PlayerID_t PlayerID = pPacket->GetPlayerID();
SceneID_t SceneID = pPacket->GetSceneID();
GamePlayer* pGamePlayer = g_pPlayerPool->GetPlayer(PlayerID);
if( pGamePlayer==NULL )
{
Assert(FALSE);
return PACKET_EXE_CONTINUE;
}
Obj_Human* pHuman = pGamePlayer->GetHuman();
Assert( pHuman );
Scene* pScene = pHuman->getScene();
Scene* pCityScene = g_pSceneManager->GetScene( SceneID ) ;
if( pScene==NULL ) return PACKET_EXE_CONTINUE;
if( pPlayer->IsServerPlayer() )
{//服务器收到世界服务器发来的数据
Assert( MyGetCurrentThreadID()==g_pServerManager->m_ThreadID );
pCityScene->SendPacket(pPacket,PlayerID);
return PACKET_EXE_NOTREMOVE ;
}
else if( pPlayer->IsGamePlayer() )
{
Assert( MyGetCurrentThreadID()==pCityScene->m_ThreadID ) ;
//1.场景中所有玩家移走
ScenePlayerManager* pCurScenePlayerManager = pCityScene->GetScenePlayerManager();
PlayerID_t PlayerInTheCity[MAX_PLAYER];
UINT PlayerNum = 0;
for(UINT i =0 ;i<pCurScenePlayerManager->GetPlayerNumber();i++ )
{
PlayerInTheCity[PlayerNum++] = pCurScenePlayerManager->GetPlayers()[i];
}
SceneID_t PortSceneID = pCityScene->m_SceneInitData.m_CityData.m_PortSceneID;
Scene* pPortScene = g_pSceneManager->GetScene( PortSceneID ) ;
WORLD_POS pos(150,100);
for(UINT i =0 ;i<PlayerNum;i++ )
{
GamePlayer* pGamePlayer = g_pPlayerPool->GetPlayer(PlayerInTheCity[i]);
if( pGamePlayer==NULL )
{
Assert(FALSE);
return PACKET_EXE_CONTINUE;
}
Obj_Human* pHuman = pGamePlayer->GetHuman();
pHuman->ChangeScene( SceneID, PortSceneID, pos, 9 ) ;
}
//2.清空入口场景的CityPortList中指向自己这项
if(!pPortScene->m_CityData.RemovePort(SceneID))
{
Assert(FALSE);
return PACKET_EXE_CONTINUE;
}
//3.清空自己的SCENE_INT_DATA
_CITY_GUID CityGuid = pCityScene->m_SceneInitData.m_CityData.m_Guid;
pCityScene->m_SceneInitData.m_CityData.CleanUp();
//通知world场景已经删除完毕
GWCityCloseSuccess* pMsgToWorld = (GWCityCloseSuccess*)g_pPacketFactoryManager->CreatePacket(PACKET_GW_CITYCLOSESUCCESS);
pMsgToWorld->SetCityGuid(CityGuid);
g_pServerManager->SendPacket( pMsgToWorld, INVALID_ID ) ;
}
return PACKET_EXE_CONTINUE ;
__LEAVE_FUNCTION
return PACKET_EXE_ERROR ;
}