本文整理汇总了C++中NFCDataList::AddObject方法的典型用法代码示例。如果您正苦于以下问题:C++ NFCDataList::AddObject方法的具体用法?C++ NFCDataList::AddObject怎么用?C++ NFCDataList::AddObject使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NFCDataList
的用法示例。
在下文中一共展示了NFCDataList::AddObject方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnReqPVPApplyMatchProcess
void NFCPVPMatchModule::OnReqPVPApplyMatchProcess(const int nSockIndex, const int nMsgID, const char* msg, const uint32_t nLen)
{
CLIENT_MSG_PROCESS_NO_OBJECT(nSockIndex, nMsgID, msg, nLen, NFMsg::ReqPVPApplyMatch);
NFMsg::AckPVPApplyMatch xAck;
*xAck.mutable_self_id() = xMsg.self_id();
xAck.set_applytype(xMsg.applytype());
xAck.set_nresult(0);
switch (xMsg.applytype())
{
case NFMsg::ReqPVPApplyMatch::EApplyType_Single:
{
if (ApplyPVP(nPlayerID, xMsg.npvpmode(), xMsg.score()))
{
xAck.set_nresult(1);
}
NFGUID xRoomID;
if (m_pPVPMatchRedisModule->GetPlayerRoomID(nPlayerID, xRoomID))
{
NFMsg::PVPRoomInfo xRoomInfo;
if (m_pPVPMatchRedisModule->GetRoomInfo(xRoomID, xRoomInfo))
{
xAck.mutable_xroominfo()->CopyFrom(xRoomInfo);
}
}
m_pWorldNet_ServerModule->GetNetModule()->SendMsgPB(NFMsg::EGMI_ACK_PVPAPPLYMACTCH, xAck, nSockIndex, nPlayerID);
}
break;
case NFMsg::ReqPVPApplyMatch::EApplyType_Team:
{
if (xMsg.has_team_id())
{
NFGUID xTeamID = NFINetModule::PBToNF(xMsg.team_id());
if (!xTeamID.IsNull())
{
std::vector<NFGUID> xPlayerList;
if (m_pTeamModule->GetMemberList(nPlayerID, xTeamID, xPlayerList))
{
NFCDataList varMember;
for (size_t i = 0; i < xPlayerList.size(); i++)
{
varMember.AddObject(xPlayerList[i]);
}
if (TeamApplyPVP(xTeamID, varMember, xMsg.npvpmode(), xMsg.score()))
{
xAck.set_nresult(1);
NFGUID xRoomID;
if (m_pPVPMatchRedisModule->GetPlayerRoomID(nPlayerID, xRoomID))
{
NFMsg::PVPRoomInfo xRoomInfo;
if (m_pPVPMatchRedisModule->GetRoomInfo(xRoomID, xRoomInfo))
{
xAck.mutable_xroominfo()->CopyFrom(xRoomInfo);
}
}
m_pTeamModule->BroadcastMsgToTeam(nPlayerID, xTeamID, NFMsg::EGMI_ACK_PVPAPPLYMACTCH, xAck);
return;
}
}
}
}
m_pWorldNet_ServerModule->GetNetModule()->SendMsgPB(NFMsg::EGMI_ACK_PVPAPPLYMACTCH, xAck, nSockIndex, nPlayerID);
}
break;
default:
break;
}
}
示例2: ProcessBuffValuePropertyReferAbsoluteValue
int NFCBuffModule::ProcessBuffValuePropertyReferAbsoluteValue( const NFIDENTID& self, NFIBuffConfigModule::NFCBuffConfig* pBuffConfig, const NFIDENTID& releaserIdent )
{
//buff group property
int nBuffGroup = 0;
//RUNTIME_BUFF_INFO
NF_SHARE_PTR<NFIObject> pObject = m_pKernelModule->GetObject( self );
NF_SHARE_PTR<NFIRecord> pBuffRecord = pObject->GetRecordManager()->GetElement( mstrRunTimeEffectTable );
if ( pBuffRecord )
{
NF_SHARE_PTR<NFIRecord> pPropertyGroupRecord = pObject->GetRecordManager()->GetElement( mstrPropertyTable );
std::string strPropertyList;
std::string strPropertyName;
int* pnEffectValue = pBuffConfig->First( strPropertyName );
while ( pnEffectValue )
{
NF_SHARE_PTR<NFIProperty> pProperty = pObject->GetPropertyManager()->GetElement( strPropertyName );
if ( pProperty )
{
char szEffectValue[MAX_PATH] = {0};
printf( szEffectValue, "%d", *pnEffectValue );
strPropertyList.append( strPropertyName );
strPropertyList.append( "," );
strPropertyList.append( szEffectValue );
strPropertyList.append( ";" );
//相继设置属性到buff group,增值
//从属性系统得到属性应该在的col函数
int nPropertyGroupCol = 0;
int nPropertyBuffGroupRow = 0;
TDATA_TYPE eColType = pPropertyGroupRecord->GetColType( nPropertyGroupCol );
if ( NFIBuffConfigModule::BuffReverseType::ERT_NEED_REVERSE == pBuffConfig->NeedReverseType )
{
//需要还原
switch ( eColType )
{
case TDATA_INT:
pPropertyGroupRecord->SetInt( nPropertyBuffGroupRow, nPropertyGroupCol, *pnEffectValue );
break;
case TDATA_FLOAT:
pPropertyGroupRecord->SetFloat( nPropertyBuffGroupRow, nPropertyGroupCol, float( *pnEffectValue ) );
break;
case TDATA_DOUBLE:
pPropertyGroupRecord->SetDouble( nPropertyBuffGroupRow, nPropertyGroupCol, double( *pnEffectValue ) );
break;
default:
break;
}
}
else if ( NFIBuffConfigModule::BuffReverseType::ERT_NO_REVERSE == pBuffConfig->NeedReverseType )
{
//不需要还原
NFIDataList::TData valueEffectValue;
switch ( eColType )
{
case TDATA_INT:
valueEffectValue.nType = TDATA_INT;
valueEffectValue.variantData = NFINT64( *pnEffectValue );
break;
case TDATA_FLOAT:
valueEffectValue.nType = TDATA_FLOAT;
valueEffectValue.variantData = float( *pnEffectValue );
break;
case TDATA_DOUBLE:
valueEffectValue.nType = TDATA_DOUBLE;
valueEffectValue.variantData = double( *pnEffectValue );
break;
default:
break;
}
//const NFIDataList& oldValue = pProperty->GetValue();
pObject->GetPropertyManager()->SetProperty( strPropertyName, valueEffectValue );
}
pnEffectValue = pBuffConfig->Next( strPropertyName );
}
//还原与否,都需要保存在runtimebuff表
NFCDataList valueBuffProperty;
valueBuffProperty.AddString( strPropertyName.c_str() );
valueBuffProperty.AddObject( releaserIdent );
valueBuffProperty.AddFloat( pBuffConfig->EffectTimeInterval );
valueBuffProperty.AddInt( pBuffConfig->EffectTimeValue );
valueBuffProperty.AddString( strPropertyName.c_str() );
pBuffRecord->AddRow( -1, valueBuffProperty );
}
}
return 0;
}