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


C++ Message::AddPayload方法代码示例

本文整理汇总了C++中Message::AddPayload方法的典型用法代码示例。如果您正苦于以下问题:C++ Message::AddPayload方法的具体用法?C++ Message::AddPayload怎么用?C++ Message::AddPayload使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Message的用法示例。


在下文中一共展示了Message::AddPayload方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: MessageResponse

void SessionSrv::MessageResponse(Message* message)
{
	CTaskID task_id = *(CTaskID*)message->ReadPayload(0);
	GS_INT taskType = (*(GS_INT*)message->ReadPayload(1));
	GS_DWORD taskResult = *(GS_DWORD*)message->ReadPayload(2);
	GS_DWORD taskDetailedResult = *(GS_DWORD*)message->ReadPayload(3);
#if defined(_XBOX) || defined(_XENON)
	GS_DWORD taskExtendedResult = *(GS_DWORD*)message->ReadPayload(4);
#endif

#if defined(_XBOX) || defined(_XENON)
	if (ERROR_SUCCESS == taskResult)
#elif defined(_PS3)
	if (0 == taskResult)
#endif
	{
		switch (taskType)
		{
		case EGSTaskType_SessionCreate:
		case EGSTaskType_SessionJoin:
			m_IsCreated = TRUE;
			break;
		case EGSTaskType_SessionStart:
			m_IsStarted = TRUE;
			break;
		case EGSTaskType_SessionEnd:
			m_IsStarted = FALSE;
			break;
		case EGSTaskType_SessionDelete:
		case EGSTaskType_SessionLeave:
			m_IsCreated = FALSE;
#if defined(_XBOX) || defined(_XENON)
			m_hSession = INVALID_HANDLE_VALUE;
#endif
			break;
		default:
			break;
		}
	}

	// Message to Interface
	Message* msg = Message::Create(EMessage_CallBackInterface);
	if (msg)
	{
		msg->AddPayload(taskType);

#if defined(_XBOX) || defined(_XENON)
		GS_BOOL result = (ERROR_SUCCESS == taskResult) ? TRUE : FALSE;
#elif defined(_PS3)
		GS_BOOL result = (0 == taskResult) ? TRUE : FALSE;
#else
		GS_BOOL result = TRUE;
#endif
		msg->AddPayload(result);

		msg->AddTarget(Master::G()->GetInterfaceMgr());

		Master::G()->GetMessageMgr()->Send(msg);

	}

}
开发者ID:CodeAsm,项目名称:gameservice,代码行数:62,代码来源:Session.cpp


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