当前位置: 首页>>代码示例>>C++>>正文


C++ CMoveShape::AddSelectSelfPlayer方法代码示例

本文整理汇总了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;

	}
}
开发者ID:ueverything,项目名称:mmo-resourse,代码行数:101,代码来源:ShapeMessage.cpp


注:本文中的CMoveShape::AddSelectSelfPlayer方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。