本文整理汇总了C++中CMoveShape::AddSelectSelfPlayer方法的典型用法代码示例。如果您正苦于以下问题:C++ CMoveShape::AddSelectSelfPlayer方法的具体用法?C++ CMoveShape::AddSelectSelfPlayer怎么用?C++ CMoveShape::AddSelectSelfPlayer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CMoveShape
的用法示例。
在下文中一共展示了CMoveShape::AddSelectSelfPlayer方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnShapeMessage
//.........这里部分代码省略.........
pMsg -> GetPlayer()->SendChangedSpeedToClients();
}
break;
// 客户端主动请求shape数据
case MSG_C2S_SHAPE_QUESTINFO:
{
}
break;
case MSG_C2S_SHAPE_EMOTION:
{
LONG lType = pMsg -> GetLong();
CGUID guid; pMsg -> GetGUID(guid);
DWORD dwEmotion = pMsg -> GetDWord();
CPlayer* pPlayer = pMsg -> GetPlayer();
if( pPlayer -> GetType() == lType &&
pPlayer -> GetExID() == guid )
{
pPlayer -> PerformEmotion( dwEmotion );
}
}
break;
case MSG_C2S_SHAPE_SETSELECTEDSHAPE:
{
//设定当前选择的目标
long lType = pMsg->GetLong();
CGUID guid = NULL_GUID;
pMsg->GetGUID(guid);
CPlayer *pPlayer = pMsg ->GetPlayer();
if (pPlayer)
{
CServerRegion *pRegion = dynamic_cast<CServerRegion*>(pPlayer->GetFather());
if(pRegion)
{
long lOldType = 0;
CGUID OldGuid;
pPlayer->GetTarget(OldGuid,lOldType);
if(OldGuid != guid)
{
CMoveShape* pMoveShape = dynamic_cast<CMoveShape*>(pRegion->FindChildObject(lOldType,OldGuid));
if(pMoveShape)
pMoveShape->RemoveSelectSelfPlayer(pPlayer->GetExID());
pPlayer->SetTarget(guid,lType);
if(guid != NULL_GUID)
{
pMoveShape = dynamic_cast<CMoveShape*>(pRegion->FindChildObject(lType,guid));
if(pMoveShape)
{
pMoveShape->AddSelectSelfPlayer(pPlayer->GetExID());
set<string> setDirtyAttr;
setDirtyAttr.insert("C_MaxHp");
setDirtyAttr.insert("Hp");
//更新属性
pMoveShape->UpdateHPMPToClient(setDirtyAttr);
}
}
}
}
}
}
break;
case MSG_C2S_SHAPE_GETTSELECTEDSHAPE:
{
// 获得当前选择的目标
CPlayer *pPlayer = pMsg->GetPlayer();
if (pPlayer)
{
long lType = 0;
CGUID guid = NULL_GUID;
pPlayer->GetTarget(guid,lType);
CServerRegion* pServerRegion = (CServerRegion*)(pPlayer->GetFather());
if(NULL == pServerRegion || guid == NULL_GUID)
return ;
CBaseObject *pObj = pServerRegion->FindChildObject(lType,guid);
CMoveShape *pMoveShape = dynamic_cast<CMoveShape*>(pObj);
if (pMoveShape)
{
long lTargetType = 0;
CGUID guidTarget = NULL_GUID;
pMoveShape->GetTarget(guidTarget,lTargetType);
if (guid != NULL_GUID)
{
CMessage msg(MSG_S2C_SHAPE_GETTSELECTEDSHAPE);
msg.Add(lTargetType);
msg.Add(guidTarget);
msg.SendToPlayer(pPlayer->GetExID());
}
}
}
}
break;
}
}