本文整理汇总了C++中CObjectManager::NewPlayerOther方法的典型用法代码示例。如果您正苦于以下问题:C++ CObjectManager::NewPlayerOther方法的具体用法?C++ CObjectManager::NewPlayerOther怎么用?C++ CObjectManager::NewPlayerOther使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CObjectManager
的用法示例。
在下文中一共展示了CObjectManager::NewPlayerOther方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: mapPos
uint GCNewPlayer_MoveHandler :: Execute( GCNewPlayer_Move* pPacket, Player* pPlayer )
{
//__ENTER_FUNCTION
//AxTrace(0, 2, "GCNewPlayerHandler");
// return PACKET_EXE_CONTINUE ;
//当前流程是主流程
if(CGameProcedure::GetActiveProcedure() == (CGameProcedure*)CGameProcedure::s_pProcMain)
{
CObjectManager* pObjectManager = CObjectManager::GetMe();
//检查位置是否合法
if(!CWorldManager::GetMe()->GetActiveScene()->IsValidPosition(fVector2(pPacket->getWorldPos().m_fX, pPacket->getWorldPos().m_fZ)))
{
TDThrow("ERROR POSITION @ GCNewPlayer_MoveHandler");
}
//创建玩家
CObject_PlayerOther* pOther = (CObject_PlayerOther*)(pObjectManager->FindServerObject( (INT)pPacket->getObjID() ));
fVector3 fvGame;
CGameProcedure::s_pGfxSystem->Axis_Trans(
CRenderSystem::AX_PLAN, fVector3(pPacket->getWorldPos().m_fX, 0.0f, pPacket->getWorldPos().m_fZ),
CRenderSystem::AX_GAME, fvGame);
if ( pOther == NULL )
{
pOther = pObjectManager->NewPlayerOther( (INT)pPacket->getObjID() );
SObjectInit initPlayerOther;
initPlayerOther.m_fvPos = fvGame;
pOther->Initial( &initPlayerOther );
}
else
{
fVector2 mapPos(fvGame.x, fvGame.z);
pOther->SetMapPosition(mapPos);
pOther->Enable( OSF_VISIABLE );
pOther->Disalbe( OSF_OUT_VISUAL_FIELD );
}
////激活鼠标查询
//if(pOther->GetRenderInterface())
//{
// pOther->Enable(OSF_RAY_QUERY);
//}
//更新装备信息
pOther->GetCharacterData()->Set_EquipVer(pPacket->getEquipVer());
//跟新移动速度
pOther->GetCharacterData()->Set_MoveSpeed(pPacket->getMoveSpeed());
// move to command
{
WORLD_POS posTarget;
posTarget.m_fX = pPacket->getTargetPos().m_fX;
posTarget.m_fZ = pPacket->getTargetPos().m_fZ;
SCommand_Object cmdTemp;
cmdTemp.m_wID = OC_MOVE;
cmdTemp.m_auParam[0] = 0;
cmdTemp.m_anParam[1] = pPacket->getHandleID();
cmdTemp.m_anParam[2] = 1;
cmdTemp.m_apParam[3] = &posTarget;
pOther->PushCommand(&cmdTemp );
}
//放入Ask队列
CObjectManager::GetMe()->GetLoadQueue()->TryAddLoadTask(pOther->GetID(), CObject_Character::CT_PLAYEROTHER);
// tempcode{
// 此版不做服务器繁忙客户端延后发消息的处理
// CGCharAskBaseAttrib msgAskBaseAttrib;
// msgAskBaseAttrib.setTargetID( (INT)pPacket->getObjID() );
// CNetManager::GetMe()->SendPacket( &msgAskBaseAttrib );
//AxTrace(0, 0, "[%d]Ask %d", m_hmObject.size(), pPacket->getObjID());
// }
pOther->PushDebugString("GCNewPlayer");
pOther->SetMsgTime(CGameProcedure::s_pTimeSystem->GetTimeNow());
}
return PACKET_EXE_CONTINUE ;
//__LEAVE_FUNCTION
return PACKET_EXE_ERROR ;
//__ENTER_FUNCTION
// AxTrace(0, 2, "GCNewPlayerHandler");
//
// //当前流程是主流程
// if(CGameProcedure::GetActiveProcedure() == (CGameProcedure*)CGameProcedure::s_pProcMain)
// {
// CObjectManager* pObjectManager = CObjectManager::GetMe();
//
// //创建玩家
// CObject_PlayerOther* pOther = pObjectManager->CreatePlayerOther(
// (INT)pPacket->getObjID(),
// (INT)pPacket->getRace(),
//.........这里部分代码省略.........
示例2: mapPos
uint GCNewPlayerHandler :: Execute( GCNewPlayer* pPacket, Player* pPlayer )
{
//__ENTER_FUNCTION
//当前流程是主流程
if(CGameProcedure::GetActiveProcedure() == (CGameProcedure*)CGameProcedure::s_pProcMain)
{
CObjectManager* pObjectManager = CObjectManager::GetMe();
//检查位置是否合法
if(!CWorldManager::GetMe()->GetActiveScene()->IsValidPosition(fVector2(pPacket->getWorldPos().m_fX, pPacket->getWorldPos().m_fZ)))
{
TDThrow("ERROR POSITION @ GCNewPlayerHandler");
}
//创建玩家
CObject_PlayerOther* pOther = (CObject_PlayerOther*)(pObjectManager->FindServerObject( (INT)pPacket->getObjID()));
fVector3 fvGame;
CGameProcedure::s_pGfxSystem->Axis_Trans(
CRenderSystem::AX_PLAN, fVector3(pPacket->getWorldPos().m_fX, 0.0f, pPacket->getWorldPos().m_fZ),
CRenderSystem::AX_GAME, fvGame);
FLOAT fFaceDir = pPacket->getDir();
if ( pOther == NULL )
{
pOther = pObjectManager->NewPlayerOther( (INT)pPacket->getObjID() );
SObjectInit initPlayerOther;
initPlayerOther.m_fvPos = fvGame;
initPlayerOther.m_fvRot = fVector3( 0.f, fFaceDir, 0.f );
pOther->Initial( &initPlayerOther );
fVector2 mapPos(fvGame.x, fvGame.z);
pOther->SetMapPosition( mapPos );
}
else
{
fVector2 mapPos(fvGame.x, fvGame.z);
pOther->SetMapPosition( mapPos );
pOther->SetFaceDir( fFaceDir );
pOther->Enable( OSF_VISIABLE );
pOther->Disalbe( OSF_OUT_VISUAL_FIELD );
}
//更新装备信息
pOther->GetCharacterData()->Set_EquipVer(pPacket->getEquipVer());
pOther->GetCharacterData()->Set_MoveSpeed(pPacket->getMoveSpeed());
////激活鼠标查询
//if(pOther->GetRenderInterface())
//{
// pOther->Enable(OSF_RAY_QUERY);
//}
SCommand_Object cmdTemp;
cmdTemp.m_wID = OC_IDLE;
cmdTemp.m_afParam[0] = fvGame.x;
cmdTemp.m_afParam[1] = fvGame.z;
cmdTemp.m_abParam[2] = FALSE;
pOther->PushCommand(&cmdTemp );
//放入Ask队列
CObjectManager::GetMe()->GetLoadQueue()->TryAddLoadTask(pOther->GetID(), CObject_Character::CT_PLAYEROTHER);
// tempcode{
// 此版不做服务器繁忙客户端延后发消息的处理
// CGCharAskBaseAttrib msgAskBaseAttrib;
// msgAskBaseAttrib.setTargetID( (INT)pPacket->getObjID() );
// CNetManager::GetMe()->SendPacket( &msgAskBaseAttrib );
//AxTrace(0, 0, "[%d]Ask %d", m_hmObject.size(), pPacket->getObjID());
// }
//如果是自己,退出死亡效果
if(pOther == (CObject_PlayerOther*)pObjectManager->GetMySelf())
{
CGameProcedure::s_pGfxSystem->Scene_SetPostFilter_Death(FALSE);
}
pOther->PushDebugString("GCNewPlayer");
pOther->SetMsgTime(CGameProcedure::s_pTimeSystem->GetTimeNow());
}
return PACKET_EXE_CONTINUE ;
//__LEAVE_FUNCTION
return PACKET_EXE_ERROR ;
}