本文整理汇总了C++中NFDataList::AddString方法的典型用法代码示例。如果您正苦于以下问题:C++ NFDataList::AddString方法的具体用法?C++ NFDataList::AddString怎么用?C++ NFDataList::AddString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NFDataList
的用法示例。
在下文中一共展示了NFDataList::AddString方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnAckSearchOpponentProcess
void NFCGamePVPModule::OnAckSearchOpponentProcess(const NFSOCK nSockIndex, const int nMsgID, const char * msg, const uint32_t nLen)
{
CLIENT_MSG_PROCESS(nMsgID, msg, nLen, NFMsg::AckSearchOppnent);
if (!m_pKernelModule->ExistObject(nPlayerID))
{
return;
}
m_pKernelModule->SetPropertyObject(nPlayerID, NFrame::Player::OpponentFighting(), NFGUID());
m_pKernelModule->SetPropertyInt(nPlayerID, NFrame::Player::FightingStar(), 0);
m_pKernelModule->SetPropertyInt(nPlayerID, NFrame::Player::PVPType(), NFMsg::EPVPType::PVP_INDIVIDUAL);
m_pSceneProcessModule->RequestEnterScene(nPlayerID, xMsg.scene_id(), 0, NFDataList());
int nNoWSceneID = m_pKernelModule->GetPropertyInt(nPlayerID, NFrame::Player::SceneID());
int nGroupID = m_pKernelModule->GetPropertyInt(nPlayerID, NFrame::Player::GroupID());
if (nNoWSceneID != xMsg.scene_id())
{
return;
}
//process opponent data
ProcessOpponentData(nPlayerID, xMsg);
m_pGameServerNet_ServerModule->SendMsgToGate(NFMsg::EGMI_ACK_SEARCH_OPPNENT, std::string(msg, nLen), nPlayerID);
for (int i = 0; i < xMsg.title().building_size(); ++i)
{
const NFMsg::TileBuilding& xTileBuilding = xMsg.title().building().Get(i);
NFGUID xBuildingID = NFINetModule::PBToNF(xTileBuilding.guid());
NFVector3 vPos;
vPos.SetX(xTileBuilding.x());
vPos.SetY(xTileBuilding.y());
std::string strCnfID = xTileBuilding.configid();
NFDataList xDataArg;
xDataArg.AddString(NFrame::NPC::Position());
xDataArg.AddVector3(vPos);
xDataArg.AddString(NFrame::NPC::MasterID());
xDataArg.AddObject(NFINetModule::PBToNF(xMsg.opponent()));
xDataArg.AddString(NFrame::NPC::AIOwnerID());
xDataArg.AddObject(nPlayerID);
xDataArg.AddString(NFrame::NPC::NPCType());
xDataArg.AddInt(NFMsg::ENPCType::ENPCTYPE_TURRET);
m_pKernelModule->CreateObject(xBuildingID, nNoWSceneID, nGroupID, NFrame::NPC::ThisName(), strCnfID, xDataArg);
}
}
示例2: OnChatProcess
//--------------------------------------------收消息-------------------------------------------------------------
void NFCChatLogic::OnChatProcess(const NFSOCK nSockIndex, const int nMsgID, const char* msg, const uint32_t nLen)
{
NFGUID nPlayerID;
NFMsg::ReqAckPlayerChat xMsg;
if (!NFINetModule::ReceivePB(nMsgID, msg, nLen, xMsg, nPlayerID))
{
return;
}
NFDataList var;
var.AddObject(NFINetModule::PBToNF(xMsg.chat_id()));
var.AddInt(xMsg.chat_type());
var.AddString(xMsg.chat_name());
var.AddString(xMsg.chat_info());
var.AddInt(xMsg.container_data_size());
for (size_t i = 0; i < xMsg.container_data_size(); i++)
{
var.AddInt(xMsg.container_data(i).containertype());
var.AddString(xMsg.container_data(i).data_info());
}
switch (xMsg.chat_type())
{
case NFMsg::ReqAckPlayerChat_EGameChatType::ReqAckPlayerChat_EGameChatType_EGCT_WORLD:
{
DoEvent(E_ChatEvent_ChatWorld, var);
}
break;
case NFMsg::ReqAckPlayerChat_EGameChatType::ReqAckPlayerChat_EGameChatType_EGCT_GUILD:
{
DoEvent(E_ChatEvent_ChatGuild, var);
}
break;
case NFMsg::ReqAckPlayerChat_EGameChatType::ReqAckPlayerChat_EGameChatType_EGCT_PRIVATE:
{
DoEvent(E_ChatEvent_ChatPrivate, var);
}
break;
case NFMsg::ReqAckPlayerChat_EGameChatType::ReqAckPlayerChat_EGameChatType_EGCT_TEAM:
{
DoEvent(E_ChatEvent_ChatTeam, var);
}
break;
default:
break;;
}
}
示例3: OnReqSwichServer
void NFCGSSwichServerModule::OnReqSwichServer(const NFSOCK nSockIndex, const int nMsgID, const char* msg, const uint32_t nLen)
{
CLIENT_MSG_PROCESS_NO_OBJECT(nMsgID, msg, nLen, NFMsg::ReqSwitchServer);
if (nPlayerID != NFINetModule::PBToNF(xMsg.selfid()))
{
return;
}
if (xMsg.target_serverid() != pPluginManager->GetAppID())
{
m_pLogModule->LogNormal(NFILogModule::NLL_ERROR_NORMAL, nPlayerID, "Target server is not this server", xMsg.target_serverid(), __FUNCTION__, __LINE__);
return;
}
const NFGUID nClientID = NFINetModule::PBToNF(xMsg.client_id());
const int nGateID = (int)xMsg.gate_serverid();
const int nSceneID = (int)xMsg.sceneid();
const int nGroup = (int)xMsg.groupid();
//if (!AddPlayerGateInfo(nPlayerID, nClientID, nGateID))
// {
// return;
// }
NFDataList var;
var.AddString(NFrame::Player::GateID());
var.AddInt(nGateID);
NF_SHARE_PTR<NFIObject> pObject = m_pKernelModule->CreateObject(nPlayerID, nSceneID, 0, NFrame::Player::ThisName(), "", var);
if (NULL == pObject.get())
{
//mRoleBaseData
//mRoleFDData
return;
}
pObject->SetPropertyInt(NFrame::Player::GateID(), nGateID);
pObject->SetPropertyInt(NFrame::Player::GameID(), pPluginManager->GetAppID());
m_pKernelModule->DoEvent(pObject->Self(), NFrame::Player::ThisName(), CLASS_OBJECT_EVENT::COE_CREATE_FINISH, NFDataList());
m_pScenemodule->RequestEnterScene(pObject->Self(), nSceneID, nGroup, 0, NFDataList());
//m_pEventModule->DoEvent(pObject->Self(), NFED_ON_CLIENT_ENTER_SCENE, varEntry);
if (!m_pGameServerNet_ServerModule->AddPlayerGateInfo(nPlayerID, nClientID, nGateID))
{
m_pKernelModule->DestroyObject(nPlayerID);
return ;
}
m_pGameServerNet_ServerModule->SendMsgPBToGate(NFMsg::EGMI_REQSWICHSERVER, xMsg, nPlayerID);
m_pNetClientModule->SendSuitByPB(NF_SERVER_TYPES::NF_ST_WORLD, nPlayerID.ToString(), NFMsg::EGMI_ACKSWICHSERVER, xMsg);
}
示例4: OnDBLoadRoleDataProcess
void NFCCreateRoleModule::OnDBLoadRoleDataProcess(const NFSOCK nSockIndex, const int nMsgID, const char * msg, const uint32_t nLen)
{
NFGUID nClientID;
NFMsg::RoleDataPack xMsg;
if (!m_pNetModule->ReceivePB(nMsgID, msg, nLen, xMsg, nClientID))
{
//releasing all the resource that allow when the user login, then kick off the user
// TODO
//m_pGameServerNet_ServerModule->RemovePlayerGateInfo();
//Avtually, the developer may not know the user id in this situation, therefore the developer must record the login-time when the user coming
//and check the time per min to kick off the user who are not active.
return;
}
NFGUID nRoleID = NFINetModule::PBToNF(xMsg.id());
if (m_pKernelModule->GetObject(nRoleID))
{
//it should be rebind with proxy's netobject
m_pKernelModule->DestroyObject(nRoleID);
}
mxObjectDataCache[nRoleID] = xMsg;
NF_SHARE_PTR<NFIGameServerNet_ServerModule::GateBaseInfo> pGateInfo = m_pGameServerNet_ServerModule->GetPlayerGateInfo(nRoleID);
if (nullptr != pGateInfo)
{
if (pGateInfo->eStatus == NFIGameServerNet_ServerModule::GateBaseInfo::E_LOADING)
{
pGateInfo->eStatus = NFIGameServerNet_ServerModule::GateBaseInfo::E_LOADED;
}
}
NFDataList var;
var.AddString(NFrame::Player::GateID());
var.AddInt(pGateInfo->nGateID);
var.AddString(NFrame::Player::GameID());
var.AddInt(pPluginManager->GetAppID());
var.AddString(NFrame::Player::HomeSceneID());
var.AddInt(1);
var.AddString(NFrame::Player::SceneID());
var.AddInt(1);
NF_SHARE_PTR<NFIObject> pObject = m_pKernelModule->CreateObject(nRoleID, 1, 0, NFrame::Player::ThisName(), "", var);
if (nullptr == pObject)
{
//mRoleBaseData
//mRoleFDData
mxObjectDataCache.erase(nRoleID);
return;
}
//get data first then create player
m_pSceneProcessModule->RequestEnterScene(pObject->Self(), 1, -1, 0, NFDataList());
}
示例5: OnClienEnterGameProcess
void NFCCreateRoleModule::OnClienEnterGameProcess(const NFSOCK nSockIndex, const int nMsgID, const char * msg, const uint32_t nLen)
{
NFGUID nClientID;
NFMsg::ReqEnterGameServer xMsg;
if (!m_pNetModule->ReceivePB( nMsgID, msg, nLen, xMsg, nClientID))
{
return;
}
NFGUID nRoleID = NFINetModule::PBToNF(xMsg.id());
if (m_pKernelModule->GetObject(nRoleID))
{
//it should be rebind with proxy's netobject
m_pKernelModule->DestroyObject(nRoleID);
}
//////////////////////////////////////////////////////////////////////////
NF_SHARE_PTR<NFIGameServerNet_ServerModule::GateBaseInfo> pGateInfo = m_pGameServerNet_ServerModule->GetPlayerGateInfo(nRoleID);
if (nullptr != pGateInfo)
{
m_pGameServerNet_ServerModule->RemovePlayerGateInfo(nRoleID);
}
NF_SHARE_PTR<NFIGameServerNet_ServerModule::GateServerInfo> pGateServerinfo = m_pGameServerNet_ServerModule->GetGateServerInfoBySockIndex(nSockIndex);
if (nullptr == pGateServerinfo)
{
return;
}
int nGateID = -1;
if (pGateServerinfo->xServerData.pData)
{
nGateID = pGateServerinfo->xServerData.pData->server_id();
}
if (nGateID < 0)
{
return;
}
if (!m_pGameServerNet_ServerModule->AddPlayerGateInfo(nRoleID, nClientID, nGateID))
{
return;
}
if (m_pPlayerRedisModule->LoadPlayerData(nRoleID))
{
int nHomeSceneID = m_pPlayerRedisModule->GetPlayerHomeSceneID(nRoleID);
if (nHomeSceneID <= 0)
{
nHomeSceneID = m_pPVPModule->RandomTileScene();
}
NFDataList var;
var.AddString(NFrame::Player::Name());
var.AddString(xMsg.name());
var.AddString(NFrame::Player::GateID());
var.AddInt(nGateID);
var.AddString(NFrame::Player::GameID());
var.AddInt(pPluginManager->GetAppID());
var.AddString(NFrame::Player::HomeSceneID());
var.AddInt(nHomeSceneID);
var.AddString(NFrame::Player::SceneID());
var.AddInt(nHomeSceneID);
var.AddString(NFrame::Player::ViewOppnent());
var.AddObject(nRoleID);
NF_SHARE_PTR<NFIObject> pObject = m_pKernelModule->CreateObject(nRoleID, nHomeSceneID, 0, NFrame::Player::ThisName(), "", var);
if (nullptr == pObject)
{
//mRoleBaseData
//mRoleFDData
return;
}
//get data first then create player
m_pSceneProcessModule->RequestEnterScene(pObject->Self(), nHomeSceneID, -1, 0, NFDataList());
}
}
示例6: UseItem
bool NFCItemModule::UseItem(const NFGUID & self, const std::string & strItemID, const NFGUID & xTargetID)
{
int nCount = 1;
if (!m_pElementModule->ExistElement(strItemID) || !m_pKernelModule->GetObject(xTargetID))
{
return false;
}
if (!ConsumeDataItemProperty(self, strItemID))
{
return false;
}
if (!m_pPackModule->DeleteItem(self, strItemID, nCount))
{
return false;
}
NFMsg::EItemType eItemType = (NFMsg::EItemType)m_pElementModule->GetPropertyInt(strItemID, NFrame::Item::ItemType());
NF_SHARE_PTR<NFIItemConsumeProcessModule> pConsumeProcessModule = m_pItemConsumeManagerModule->GetConsumeModule(eItemType);
if (!pConsumeProcessModule)
{
return false;
}
switch (eItemType)
{
case NFMsg::EItemType::EIT_CARD:
case NFMsg::EItemType::EIT_EQUIP:
case NFMsg::EItemType::EIT_GEM:
case NFMsg::EItemType::EIT_TOKEN:
{
if (pConsumeProcessModule->ConsumeLegal(self, strItemID, NFDataList()) == 0)
{
pConsumeProcessModule->ConsumeProcess(self, strItemID, NFDataList());
}
}
break;
case NFMsg::EItemType::EIT_ITEM:
{
NFDataList xTarget;
xTarget.AddObject(xTargetID);
xTarget.AddString(strItemID); //this is Item Config ID
xTarget.AddInt(nCount); //this is Item Count to Consume
if (pConsumeProcessModule->ConsumeLegal(self, strItemID, xTarget) == 0)
{
pConsumeProcessModule->ConsumeProcess(self, strItemID, xTarget);
}
}
break;
break;
default:
break;
}
/* AddItemEffectDataProperty(self, xTargetID, strItemID);
const std::string& strAwardPackID = m_pElementModule->GetPropertyString(strItemID, "AwardData");
if (!strAwardPackID.empty())
{
DoAwardPack( self, strAwardPackID);
}
*/
return false;
}