本文整理汇总了C++中NFIDataList::Int方法的典型用法代码示例。如果您正苦于以下问题:C++ NFIDataList::Int方法的具体用法?C++ NFIDataList::Int怎么用?C++ NFIDataList::Int使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NFIDataList
的用法示例。
在下文中一共展示了NFIDataList::Int方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnSelectWorldResultsEvent
int NFCLoginNet_ServerModule::OnSelectWorldResultsEvent(const NFIDENTID& object, const int nEventID, const NFIDataList& var)
{
if (7 != var.GetCount()
|| !var.TypeEx(TDATA_TYPE::TDATA_INT, TDATA_TYPE::TDATA_OBJECT, TDATA_TYPE::TDATA_INT, TDATA_TYPE::TDATA_STRING,
TDATA_TYPE::TDATA_STRING, TDATA_TYPE::TDATA_INT, TDATA_TYPE::TDATA_STRING, TDATA_TYPE::TDATA_UNKNOWN))
{
return -1;
}
const int nWorldID = var.Int(0);
const NFIDENTID xClientIdent = var.Object(1);
const int nLoginID = var.Int(2);
const std::string& strAccount = var.String(3);
const std::string& strWorldAddress = var.String(4);
int nPort = var.Int(5);
const std::string& strWorldKey = var.String(6);
NF_SHARE_PTR<int> xFD = mxClientIdent.GetElement(xClientIdent);
if (xFD)
{
NFMsg::AckConnectWorldResult xMsg;
xMsg.set_world_id(nWorldID);
xMsg.mutable_sender()->CopyFrom(NFToPB(xClientIdent));
xMsg.set_login_id(nLoginID);
xMsg.set_account(strAccount);
xMsg.set_world_ip(strWorldAddress);
xMsg.set_world_port(nPort);
xMsg.set_world_key(strWorldKey);
SendMsgPB(NFMsg::EGameMsgID::EGMI_ACK_CONNECT_WORLD, xMsg, *xFD);
}
return 0;
}
示例2: OnSelectServerResultsEvent
int NFCWorldToMasterModule::OnSelectServerResultsEvent(const NFIDENTID& object, const int nEventID, const NFIDataList& var)
{
if (var.GetCount() != 7
|| !var.TypeEx(TDATA_TYPE::TDATA_INT, TDATA_TYPE::TDATA_OBJECT,
TDATA_TYPE::TDATA_INT, TDATA_TYPE::TDATA_STRING, TDATA_TYPE::TDATA_STRING,
TDATA_TYPE::TDATA_INT, TDATA_TYPE::TDATA_STRING, TDATA_TYPE::TDATA_UNKNOWN))
{
return 0;
}
const int nWorldID = var.Int(0);
const NFIDENTID xClientIdent = var.Object(1);
const int nLoginID = var.Int(2);
const std::string& strAccount = var.String(3);
const std::string& strWorldAddress = var.String(4);
const int nPort = var.Int(5);
const std::string& strKey = var.String(6);
NFMsg::AckConnectWorldResult xMsg;
xMsg.set_world_id(nWorldID);
xMsg.set_login_id(nLoginID);
xMsg.set_world_port(nPort);
xMsg.mutable_sender()->CopyFrom(NFINetModule::NFToPB(xClientIdent));
xMsg.set_account(strAccount);
xMsg.set_world_ip(strWorldAddress);
xMsg.set_world_key(strKey);
SendSuitByPB(NFMsg::EGMI_ACK_CONNECT_WORLD, xMsg);
return 0;
}
示例3:
int HelloWorld3Module::OnEvent(const NFIDENTID& self, const int event, const NFIDataList& arg)
{
//事件回调函数
std::cout << "OnEvent EventID: " << event << " self: " << self.nData64 << " argList: " << arg.Int(0) << " " << " " << arg.String(1) << std::endl;
m_pKernelModule->SetPropertyInt(self, "Hello", arg.Int(0));
m_pKernelModule->SetPropertyString(self, "Hello", arg.String(1));
return 0;
}
示例4: OnSelectServerEvent
int NFCWorldNet_ServerModule::OnSelectServerEvent(const NFIDENTID& object, const int nEventID, const NFIDataList& var)
{
if (4 != var.GetCount()
|| !var.TypeEx(TDATA_TYPE::TDATA_INT, TDATA_TYPE::TDATA_INT, TDATA_TYPE::TDATA_INT, TDATA_TYPE::TDATA_STRING, TDATA_TYPE::TDATA_UNKNOWN))
{
return 0;
}
const int nWorldID = var.Int(0);
const int nSenderAddress = var.Int(1);
const int nLoginID = var.Int(2);
const std::string& strAccount = var.String(3);
//////////////////////////////////////////////////////////////////////////
if (InThisWorld(strAccount))
{
return 0;
}
NF_SHARE_PTR<ServerData> pServerData = mProxyMap.First();
if (pServerData.get())
{
NFMsg::AckConnectWorldResult xData;
xData.set_world_id(nWorldID);
xData.set_sender_ip(nSenderAddress);
xData.set_login_id(nLoginID);
xData.set_account(strAccount);
xData.set_world_ip(pServerData->pData->server_ip());
xData.set_world_port(pServerData->pData->server_port());
xData.set_world_key(strAccount);
SendMsgPB(NFMsg::EGMI_ACK_CONNECT_WORLD, xData, pServerData->nFD);
//结果
NFCDataList varResult;
varResult << nWorldID << nSenderAddress << nLoginID << strAccount << pServerData->pData->server_ip() << pServerData->pData->server_port() << strAccount;
m_pEventProcessModule->DoEvent(NFIDENTID(), NFED_ON_CLIENT_SELECT_SERVER_RESULTS, varResult);
}
return 0;
}
示例5: OnLoginResultsEvent
int NFCLoginNet_ServerModule::OnLoginResultsEvent(const NFIDENTID& object, const int nEventID, const NFIDataList& var)
{
if (3 != var.GetCount()
|| !var.TypeEx(TDATA_TYPE::TDATA_INT, TDATA_TYPE::TDATA_OBJECT, TDATA_TYPE::TDATA_STRING, TDATA_TYPE::TDATA_UNKNOWN))
{
return -1;
}
const int nState = var.Int(0);
const NFIDENTID xIdent = var.Object(1);
const std::string& strAccount = var.String(2);
NF_SHARE_PTR<int> xFD = mxClientIdent.GetElement(xIdent);
if (xFD)
{
if (0 != nState)
{
//此帐号密码错误或者被封号
//登录失败
NFMsg::AckEventResult xMsg;
xMsg.set_event_code(NFMsg::EGEC_ACCOUNTPWD_INVALID);
SendMsgPB(NFMsg::EGameMsgID::EGMI_ACK_LOGIN, xMsg, *xFD);
return 0;
}
NetObject* pNetObject = GetNet()->GetNetObject(*xFD);
if (pNetObject)
{
//记录他登录过
pNetObject->SetConnectKeyState(1);
pNetObject->SetAccount(strAccount);
}
//把服务器列表广播下去
NFMsg::AckEventResult xData;
xData.set_event_code(NFMsg::EGEC_ACCOUNT_SUCCESS);
SendMsgPB(NFMsg::EGameMsgID::EGMI_ACK_LOGIN, xData, *xFD);
//SynWorldToClient(unAddress);
m_pLogModule->LogNormal(NFILogModule::NLL_INFO_NORMAL, NFIDENTID(0, *xFD), "Login successed :", strAccount.c_str());
}
return 0;
}
示例6: CalHeroTalentProperty
bool NFCHeroPropertyModule::CalHeroTalentProperty(const NFGUID& self, const NFGUID& xHeroGUID, NFIDataList& xDataList)
{
NF_SHARE_PTR<NFIRecord> pHeroRecord = m_pKernelModule->FindRecord(self, NFrame::Player::R_PlayerHero());
if (nullptr == pHeroRecord)
{
return false;
}
NFCDataList varFind;
if (pHeroRecord->FindObject(NFrame::Player::PlayerHero_GUID, xHeroGUID, varFind) != 1)
{
return false;
}
const int nRow = varFind.Int(0);
NF_SHARE_PTR<NFIRecord> pHeroPropertyRecord = m_pKernelModule->FindRecord(self, NFrame::Player::R_HeroPropertyValue());
if (nullptr == pHeroPropertyRecord)
{
return false;
}
////////////////////Talent//////////////////////////////////////////////////////
xDataList.Clear();
for (int i = 0; i < pHeroPropertyRecord->GetCols(); ++i)
{
xDataList.AddInt(0);
}
for (int i = NFrame::Player::PlayerHero_Talent1; i <= NFrame::Player::PlayerHero_Talent5; ++i)
{
const std::string& strTalentID = pHeroRecord->GetString(nRow, i);
const std::string& strTalentEffectData = m_pElementModule->GetPropertyString(strTalentID, NFrame::Talent::EffectData());
if (!strTalentEffectData.empty())
{
//one talent
for (int j = 0; j < pHeroPropertyRecord->GetCols(); ++j)
{
const std::string& strColTag = pHeroPropertyRecord->GetColTag(j);
int nValue = m_pElementModule->GetPropertyInt(strTalentEffectData, strColTag);
int nOldValue = xDataList.Int(j);
xDataList.SetInt(j, nOldValue + nValue);
}
}
}
return true;
}
示例7: CalHeroEquipProperty
bool NFCHeroPropertyModule::CalHeroEquipProperty(const NFGUID& self, const NFGUID& xHeroGUID, NFIDataList& xDataList)
{
NF_SHARE_PTR<NFIRecord> pHeroRecord = m_pKernelModule->FindRecord(self, NFrame::Player::R_PlayerHero());
if (nullptr == pHeroRecord)
{
return false;
}
NFCDataList varFind;
if (pHeroRecord->FindObject(NFrame::Player::PlayerHero_GUID, xHeroGUID, varFind) != 1)
{
return false;
}
const int nRow = varFind.Int(0);
NF_SHARE_PTR<NFIRecord> pHeroPropertyRecord = m_pKernelModule->FindRecord(self, NFrame::Player::R_HeroPropertyValue());
if (nullptr == pHeroPropertyRecord)
{
return false;
}
////////////////////Equip//////////////////////////////////////////////////////
xDataList.Clear();
for (int i = 0; i < pHeroPropertyRecord->GetCols(); ++i)
{
xDataList.AddInt(0);
}
for (int i = NFrame::Player::PlayerHero_Equip1; i <= NFrame::Player::PlayerHero_Equip6; ++i)
{
NFCDataList EquipDataList;
const NFGUID xEquipID = pHeroRecord->GetObject(nRow, i);
if (!xEquipID.IsNull() && m_pEquipPropertyModule->CalEquipProperty(self, xEquipID, EquipDataList))
{
//one equip
for (int j = 0; j < pHeroPropertyRecord->GetCols(); ++j)
{
int nOldValue = xDataList.Int(j);
int nEquipValue = EquipDataList.Int(j);
xDataList.SetInt(j, nOldValue + nEquipValue);
}
}
}
return true;
}
示例8: OnObjectHPEvent
int NFCNPCRefreshModule::OnObjectHPEvent( const NFIDENTID& self, const std::string& strPropertyName, const NFIDataList& oldVar, const NFIDataList& newVar)
{
if ( newVar.Int( 0 ) <= 0 )
{
NFIDENTID identAttacker = m_pKernelModule->GetPropertyObject( self, "LastAttacker" );
if (!identAttacker.IsNull())
{
m_pEventProcessModule->DoEvent( self, NFED_ON_OBJECT_BE_KILLED, NFCDataList() << identAttacker );
m_pKernelModule->AddHeartBeat( self, "OnDeadDestroyHeart", this, &NFCNPCRefreshModule::OnDeadDestroyHeart, 5.0f, 1 );
}
}
return 0;
}
示例9: OnLeaveSceneEvent
int NFCSceneProcessModule::OnLeaveSceneEvent( const NFGUID& object, const int nEventID, const NFIDataList& var )
{
if (1 != var.GetCount()
|| !var.TypeEx(TDATA_TYPE::TDATA_INT, TDATA_TYPE::TDATA_UNKNOWN))
{
return -1;
}
NFINT32 nOldGroupID = var.Int(0);
if (nOldGroupID > 0)
{
int nSceneID = m_pKernelModule->GetPropertyInt(object, NFrame::Player::SceneID());
if (GetCloneSceneType(nSceneID) == SCENE_TYPE_CLONE_SCENE)
{
m_pKernelModule->ReleaseGroupScene(nSceneID, nOldGroupID);
m_pLogModule->LogNormal(NFILogModule::NLL_INFO_NORMAL, object, "DestroyCloneSceneGroup", nOldGroupID);
}
}
return 0;
}
示例10: FindRowByColValue
int NFCRecord::FindRowByColValue(const int nCol, const NFIDataList& var, NFIDataList& varResult)
{
if (!ValidCol(nCol))
{
return -1;
}
TDATA_TYPE eType = var.Type(0);
if (eType != mVarRecordType->Type(nCol))
{
return -1;
}
switch (eType)
{
case TDATA_INT:
return FindInt(nCol, var.Int(nCol), varResult);
break;
case TDATA_FLOAT:
return FindFloat(nCol, var.Float(nCol), varResult);
break;
case TDATA_STRING:
return FindString(nCol, var.String(nCol).c_str(), varResult);
break;
case TDATA_OBJECT:
return FindObject(nCol, var.Object(nCol), varResult);
break;
default:
break;
}
return -1;
}
示例11: OnRequireUseSkillPosEvent
int NFCSkillModule::OnRequireUseSkillPosEvent( const NFGUID& self, const int nEventID, const NFIDataList& var )
{
if ( var.GetCount() < 4 ||
!var.TypeEx(TDATA_OBJECT, TDATA_FLOAT, TDATA_FLOAT, TDATA_FLOAT, TDATA_OBJECT))
{
return 1;
}
int nSkillID = var.Int( 0 );
double fX = var.Float( 1 );
double fY = var.Float( 2 );
double fZ = var.Float( 3 );
//群伤,就只计算第一个人的闪避
//结果事件
// NFCDataList valueResult;
// valueResult.AddInt(nSkillID);
// valueResult.AddInt(nResult);
// valueResult.Append(var, 4, var.GetCount());
//
// m_pEventProcessModule->DoEvent(self, NFED_ON_CLIENT_USE_SKILL_POS_RESULT, valueResult);
return 0;
}
示例12: OnEnterSceneEvent
int NFCSceneProcessModule::OnEnterSceneEvent( const NFIDENTID& self, const int nEventID, const NFIDataList& var )
{
if ( var.GetCount() != 4
|| !var.TypeEx(TDATA_TYPE::TDATA_OBJECT, TDATA_TYPE::TDATA_INT,
TDATA_TYPE::TDATA_INT, TDATA_TYPE::TDATA_INT, TDATA_TYPE::TDATA_UNKNOWN))
{
return 0;
}
NFIDENTID ident = var.Object( 0 );
int nType = var.Int( 1 );
int nTargetScene = var.Int( 2 );
int nTargetGroupID = var.Int( 3 );
int nOldSceneID = m_pKernelModule->GetPropertyInt( self, "SceneID" );
char szSceneID[MAX_PATH] = {0};
sprintf(szSceneID, "%d", nTargetScene);
#ifdef NF_USE_ACTOR
int nActorID = m_pElementInfoModule->GetPropertyInt(szSceneID, "ActorID");
int nSelfActorID = pPluginManager->GetActorID();
if (nSelfActorID != nActorID)
{
m_pLogModule->LogNormal(NFILogModule::NLL_ERROR_NORMAL, ident, "target scene not runing in this server", nTargetScene);
return 1;
#endif
if ( self != ident )
{
m_pLogModule->LogNormal(NFILogModule::NLL_ERROR_NORMAL, ident, "you are not you self, but you want to entry this scene", nTargetScene);
return 1;
}
const int nNowContainerID = m_pKernelModule->GetPropertyInt(self, "SceneID");
const int nNowGroupID = m_pKernelModule->GetPropertyInt(self, "GroupID");
if (nNowContainerID == nTargetScene
&& nNowGroupID == nTargetGroupID)
{
//本来就是这个层这个场景就别切换了
m_pLogModule->LogNormal(NFILogModule::NLL_INFO_NORMAL, ident, "in same scene and group but it not a clone scene", nTargetScene);
return 1;
}
nTargetGroupID = CreateCloneScene( nTargetScene, nTargetGroupID, "File.xml", NFCDataList() );
if ( nTargetGroupID <= 0 )
{
m_pLogModule->LogNormal(NFILogModule::NLL_INFO_NORMAL, ident, "CreateCloneScene failed", nTargetScene);
return 0;
}
//得到坐标
float fX = 0.0f;
float fY = 0.0f;
float fZ = 0.0f;
const std::string& strRelivePosList = m_pElementInfoModule->GetPropertyString(szSceneID, "RelivePos");
NFCDataList valueRelivePosList( strRelivePosList.c_str(), ";" );
if ( valueRelivePosList.GetCount() >= 1 )
{
NFCDataList valueRelivePos( valueRelivePosList.String( 0 ).c_str(), "," );
if ( valueRelivePos.GetCount() == 3 )
{
fX = boost::lexical_cast<float>( valueRelivePos.String( 0 ) );
fY = boost::lexical_cast<float>( valueRelivePos.String( 1 ) );
fZ = boost::lexical_cast<float>( valueRelivePos.String( 2 ) );
}
}
NFCDataList xSceneResult( var );
xSceneResult.Add( fX );
xSceneResult.Add( fY );
xSceneResult.Add( fZ );
m_pEventProcessModule->DoEvent( self, NFED_ON_OBJECT_ENTER_SCENE_BEFORE, xSceneResult );
if(!m_pKernelModule->SwitchScene( self, nTargetScene, nTargetGroupID, fX, fY, fZ, 0.0f, var ))
{
m_pLogModule->LogNormal(NFILogModule::NLL_INFO_NORMAL, ident, "SwitchScene failed", nTargetScene);
return 0;
}
xSceneResult.Set(3, NFINT64(nTargetGroupID));//spicial
m_pEventProcessModule->DoEvent( self, NFED_ON_OBJECT_ENTER_SCENE_RESULT, xSceneResult );
return 0;
}
int NFCSceneProcessModule::OnLeaveSceneEvent( const NFIDENTID& object, const int nEventID, const NFIDataList& var )
{
if (1 != var.GetCount()
|| !var.TypeEx(TDATA_TYPE::TDATA_INT, TDATA_TYPE::TDATA_UNKNOWN))
{
return -1;
}
NFINT32 nOldGroupID = var.Int(0);
NF_SHARE_PTR<NFIObject> pObject = m_pKernelModule->GetObject(object);
if (pObject.get() && nOldGroupID > 0)
//.........这里部分代码省略.........
示例13: OnEnterSceneEvent
int NFCSceneProcessModule::OnEnterSceneEvent( const NFGUID& self, const int nEventID, const NFIDataList& var )
{
if ( var.GetCount() != 4
|| !var.TypeEx(TDATA_TYPE::TDATA_OBJECT, TDATA_TYPE::TDATA_INT,
TDATA_TYPE::TDATA_INT, TDATA_TYPE::TDATA_INT, TDATA_TYPE::TDATA_UNKNOWN))
{
return 0;
}
const NFGUID ident = var.Object( 0 );
const int nType = var.Int( 1 );
const int nTargetScene = var.Int( 2 );
const int nTargetGroupID = var.Int( 3 );
const int nNowSceneID = m_pKernelModule->GetPropertyInt( self, NFrame::Player::SceneID());
const int nNowGroupID = m_pKernelModule->GetPropertyInt(self, NFrame::Player::GroupID());
if ( self != ident )
{
m_pLogModule->LogNormal(NFILogModule::NLL_ERROR_NORMAL, ident, "you are not you self, but you want to entry this scene", nTargetScene);
return 1;
}
if (nNowSceneID == nTargetScene
&& nTargetGroupID == nNowGroupID)
{
//本来就是这个层这个场景就别切换了
m_pLogModule->LogNormal(NFILogModule::NLL_INFO_NORMAL, ident, "in same scene and group but it not a clone scene", nTargetScene);
return 1;
}
//每个玩家,一个副本
NFINT64 nNewGroupID = 0;
if (nTargetGroupID <= 0)
{
nNewGroupID = CreateCloneScene( nTargetScene );
}
else
{
nNewGroupID = nTargetGroupID;
}
if ( nNewGroupID <= 0 )
{
m_pLogModule->LogNormal(NFILogModule::NLL_INFO_NORMAL, ident, "CreateCloneScene failed", nTargetScene);
return 0;
}
//得到坐标
double fX = 0.0;
double fY = 0.0;
double fZ = 0.0;
const std::string strSceneID = lexical_cast<std::string>(nTargetScene);
const std::string& strRelivePosList = m_pElementInfoModule->GetPropertyString(strSceneID, NFrame::Scene::RelivePos());
NFCDataList valueRelivePosList( strRelivePosList.c_str(), ";" );
if ( valueRelivePosList.GetCount() >= 1 )
{
NFCDataList valueRelivePos( valueRelivePosList.String( 0 ).c_str(), "," );
if ( valueRelivePos.GetCount() == 3 )
{
fX = lexical_cast<double>( valueRelivePos.String( 0 ) );
fY = lexical_cast<double>( valueRelivePos.String( 1 ) );
fZ = lexical_cast<double>( valueRelivePos.String( 2 ) );
}
}
NFCDataList xSceneResult( var );
xSceneResult.Add( fX );
xSceneResult.Add( fY );
xSceneResult.Add( fZ );
m_pKernelModule->DoEvent( self, NFED_ON_OBJECT_ENTER_SCENE_BEFORE, xSceneResult );
if(!m_pKernelModule->SwitchScene( self, nTargetScene, nNewGroupID, fX, fY, fZ, 0.0f, var ))
{
m_pLogModule->LogNormal(NFILogModule::NLL_INFO_NORMAL, ident, "SwitchScene failed", nTargetScene);
return 0;
}
xSceneResult.Add( nNewGroupID );
m_pKernelModule->DoEvent( self, NFED_ON_OBJECT_ENTER_SCENE_RESULT, xSceneResult );
return 0;
}