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


C++ NFIDataList类代码示例

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


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

示例1: OnLoginEvent

int NFCLoginLogicModule::OnLoginEvent(const NFIDENTID& object, const int nEventID, const NFIDataList& var)
{
    if (3 != var.GetCount()
        || !var.TypeEx(TDATA_TYPE::TDATA_OBJECT, TDATA_TYPE::TDATA_STRING, TDATA_TYPE::TDATA_STRING, TDATA_TYPE::TDATA_UNKNOWN))
    {
        return -1;
    }

    //////////////////////////////////////////////////////////////////////////
    const NFIDENTID xIdent = var.Object(0);
    const std::string& strAccount = var.String(1);
    const std::string& strPassword = var.String(2);
	int64_t nState = -1;

	std::vector<std::string> xFieldVec;
	std::vector<std::string> xValueVec;
	xFieldVec.push_back("Password");

	if (m_pClusterSqlModule->Query("AccountInfo", strAccount, xFieldVec, xValueVec)
		&& xFieldVec.size() == xValueVec.size()
		&& strPassword == xValueVec[0])
	{
		//µÇ¼³É¹¦
		nState = 0;
	}

    NFCDataList valEventInfo;
    valEventInfo << nState << xIdent << strAccount;
    m_pEventProcessModule->DoEvent(NFIDENTID(), NFED_ON_CLIENT_LOGIN_RESULTS, valEventInfo);

    return 0;
}
开发者ID:joyfish,项目名称:NoahGameFrame,代码行数:32,代码来源:NFCLoginLogicModule.cpp

示例2: GetAroundObject

const int NFCGridModule::GetAroundObject(NFCSceneGridInfo* pGridInfo, NFIDataList& objectList, EGRID_AROUND eAround /*= EGRID_AROUND_9 */)
{
    if (!pGridInfo)
    {
        return 0;
    }

    NFCDataList gridList;
    if (GetAroundGrid(pGridInfo, gridList, eAround) > 0)
    {
        for (int i = 0; i < gridList.GetCount(); i++)
        {
            NFCSceneGridInfo* pGridInfo = (NFCSceneGridInfo*)(gridList.Pointer(i));
            if (pGridInfo)
            {
                NFIDENTID ident;
                bool bRet = pGridInfo->First(ident);
                while (bRet)
                {
                    objectList.Add(ident);
                    bRet = pGridInfo->Next(ident);
                }
            }
        }
    }

    return objectList.GetCount();
}
开发者ID:ming871,项目名称:NoahGameFrame,代码行数:28,代码来源:NFCGridModule.cpp

示例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;
}
开发者ID:joyfish,项目名称:NoahGameFrame,代码行数:10,代码来源:HelloWorld3Module.cpp

示例4: 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;
}
开发者ID:joyfish,项目名称:NoahGameFrame,代码行数:32,代码来源:NFCWorldToMasterModule.cpp

示例5: 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;
}
开发者ID:joyfish,项目名称:NoahGameFrame,代码行数:34,代码来源:NFCLoginNet_ServerModule.cpp

示例6: OnPlayerMoveEvent

int NFCGameScene::OnPlayerMoveEvent(const int nEventID, const NFIDataList& varDataList)
{
	const NFGUID &self = varDataList.Object(0);
	Sprite *pPlayer = m_Players.GetElement(self);
	const NFVector3 &toPos = varDataList.Vector3(2);
	
	pPlayer->stopAllActions();
	pPlayer->runAction(CCMoveTo::create(1.0f, Vec2(toPos.X(), toPos.Y())));

	return 0;
}
开发者ID:,项目名称:,代码行数:11,代码来源:

示例7: OnDisconnectEvent

int NFCLoginLogicModule::OnDisconnectEvent(const NFIDENTID& object, const int nEventID, const NFIDataList& var)
{
    if (2 != var.GetCount()
        || !var.TypeEx(TDATA_TYPE::TDATA_STRING, TDATA_TYPE::TDATA_STRING, TDATA_TYPE::TDATA_UNKNOWN))
    {
        return -1;
    }

    //std::string strAccount = var.String(0);

    return 0;
}
开发者ID:joyfish,项目名称:NoahGameFrame,代码行数:12,代码来源:NFCLoginLogicModule.cpp

示例8: 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;
}
开发者ID:zh423328,项目名称:NFServer,代码行数:50,代码来源:NFCHeroPropertyModule.cpp

示例9: 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;
}
开发者ID:joyfish,项目名称:NoahGameFrame,代码行数:50,代码来源:NFCLoginNet_ServerModule.cpp

示例10: OnPlayerChatEvent

int NFCGameScene::OnPlayerChatEvent(const int nEventID, const NFIDataList& varDataList)
{
	const NFGUID &self = varDataList.Object(0);
	Sprite *pPlayer = m_Players.GetElement(self);

	auto pChat = ui::Text::create(varDataList.String(3), "", 16);
	pChat->setAnchorPoint(Vec2(0.5, 0));
	pChat->setPosition(Vec2(pPlayer->getAnchorPointInPoints().x, pPlayer->getContentSize().height+ pChat->getContentSize().height));
	pPlayer->addChild(pChat);
	pChat->runAction(Sequence::create(FadeIn::create(0.5), DelayTime::create(5.0f), FadeIn::create(0.5), RemoveSelf::create(), NULL));
	pChat->runAction(MoveBy::create(0.5, Vec2(0, pChat->getContentSize().height)));

	return 0;
}
开发者ID:,项目名称:,代码行数:14,代码来源:

示例11: 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;
}
开发者ID:zh423328,项目名称:NFServer,代码行数:49,代码来源:NFCHeroPropertyModule.cpp

示例12: FindString

int NFCRecord::FindString(const int nCol, const std::string& value, NFIDataList& varResult)
{
    if (!ValidCol(nCol))
    {
        return -1;
    }

    if (TDATA_STRING != mVarRecordType->Type(nCol))
    {
        return -1;
    }


    {
        for (int64_t i = 0; i < mnMaxRow; ++i)
        {
            if (!IsUsed(i))
            {
                continue;
            }

            const std::string& strData = GetString(i, nCol);
            if (0 == strcmp(strData.c_str(), value.c_str()))
            {
                varResult << i;
            }
        }

        return varResult.GetCount();
    }

    return -1;
}
开发者ID:B1sounours,项目名称:NoahGameFrame,代码行数:33,代码来源:NFCRecord.cpp

示例13: FindObject

int NFCRecord::FindObject(const int nCol, const NFGUID& value, NFIDataList& varResult)
{
    if (!ValidCol(nCol))
    {
        return -1;
    }

    if (TDATA_OBJECT != mVarRecordType->Type(nCol))
    {
        return -1;
    }

    {
        for (int64_t i = 0; i < mnMaxRow; ++i)
        {
            if (!IsUsed(i))
            {
                continue;
            }

            if (GetObject(i, nCol) == value)
            {
                varResult << i;
            }
        }

        return varResult.GetCount();
    }

    return -1;
}
开发者ID:B1sounours,项目名称:NoahGameFrame,代码行数:31,代码来源:NFCRecord.cpp

示例14: OnSwapGSEvent

int NFCGameServerToWorldModule::OnSwapGSEvent(const NFIDENTID& object, const int nEventID, const NFIDataList& var)
{
    //如果是单服,则不允许切换gs
    if (5 != var.GetCount())
    {
        return 0;
    }

    //     int nGameServerID = var.Int(0);
    //     const std::string& strAccount = var.String(1);
    //     const std::string& strRoleName = var.String(2);
    //     int nSceneIndex = var.Int(3);
    //     int nPlayerConfigIndex = var.Int(4);
    //
    //     _tagGTG_SWAP_GAMESERVER swapGS;
    //
    //     swapGS._nGameServerID = nGameServerID;
    //     strcpy(swapGS._szAccount, strAccount.c_str());
    //     strcpy(swapGS._szRoleName, strRoleName.c_str());
    //     swapGS._nSceneIndex = nSceneIndex;
    //     swapGS._nPlayerConfigIndex = nPlayerConfigIndex;
    //
    //     RakNet::BitStream oBitStream;
    //     swapGS.EnCode(oBitStream);
    //
    //     SendBitStream(&oBitStream);

    return 0;
}
开发者ID:joyfish,项目名称:NoahGameFrame,代码行数:29,代码来源:NFCGameServerToWorldModule.cpp

示例15: FindFloat

int NFCRecord::FindFloat(const int nCol, const double value, NFIDataList& varResult)
{
    if (!ValidCol(nCol))
    {
        return -1;
    }

    if (TDATA_FLOAT != mVarRecordType->Type(nCol))
    {
        return -1;
    }

    for (int i = 0; i < mnMaxRow; ++i)
    {
        if (!IsUsed(i))
        {
            continue;
        }

        if (GetFloat(i, nCol) == value)
        {
            varResult << i;
        }
    }

    return varResult.GetCount();
}
开发者ID:B1sounours,项目名称:NoahGameFrame,代码行数:27,代码来源:NFCRecord.cpp


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