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


C++ NFGUID::FromString方法代码示例

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


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

示例1: GetPlayerRoomIDList

bool NFCPVPMatchRedisModule::GetPlayerRoomIDList(const std::vector<NFGUID>& xPlayerList, std::vector<NFGUID>& vecRoomIDList)
{
	NF_SHARE_PTR<NFINoSqlDriver> pNoSqlDriver = m_pNoSqlModule->GetDriverBySuitConsistent();
    if (pNoSqlDriver)
    {
        std::vector<std::string> vFields;
        std::vector<std::string> vValues;
        std::string strKey = MakePlayerRoomKey();
        std::string strData;

        for (int i = 0; i < xPlayerList.size(); ++i)
        {
            vFields.push_back(xPlayerList[i].ToString());
        }

        if (pNoSqlDriver->HMGet(strKey, vFields, vValues))
        {
            for (int i = 0; i < vValues.size(); ++i)
            {
                NFGUID xIdent;
                xIdent.FromString(vValues[i]);
                vecRoomIDList.push_back(xIdent);
            }

            return true;
        }
    }

    return false;
}
开发者ID:xinst,项目名称:NoahGameFrame,代码行数:30,代码来源:NFCPVPMatchRedisModule.cpp

示例2: BroadcastMsgToTeam

bool NFCTeamModule::BroadcastMsgToTeam(const NFGUID& self, const NFGUID& xTeam, const uint16_t nMsgID, google::protobuf::Message& xData)
{
    std::vector<std::string> xPlayerList;
    std::vector<int> xGameIDList;

    std::vector<NFGUID> xPlayerIDList;
    if (!GetMemberList(self, xTeam, xPlayerIDList))
    {
        return false;
    }

    for (int i = 0; i < xPlayerIDList.size(); i++)
    {
        xPlayerList.push_back(xPlayerIDList[i].ToString());
    }

    for (int i = 0; i < xGameIDList.size() && i < xPlayerList.size(); i++)
    {
        int nGameID = xGameIDList[i];
        NFGUID xPlayer;
        xPlayer.FromString(xPlayerList[i]);
        m_pWorldNet_ServerModule->SendMsgToGame(nGameID, (NFMsg::EGameMsgID)nMsgID, xData, xPlayer);
    }

    return true;
}
开发者ID:ik3210,项目名称:NoahGameFrame,代码行数:26,代码来源:NFCTeamModule.cpp

示例3: GetStatusRoomID

bool NFCPVPMatchRedisModule::GetStatusRoomID(const int nPVPMode, const int nGrade, const int nStatus, std::vector<NFGUID>& xRoomIDList)
{
	NF_SHARE_PTR<NFINoSqlDriver> pNoSqlDriver = m_pNoSqlModule->GetDriverBySuitConsistent();
    if (pNoSqlDriver)
    {
        std::string strKey = MakeStatusRoomIDRedisKey(nPVPMode, nGrade, nStatus);
        std::string strData;

        std::vector<std::string> valueVec;
        if (pNoSqlDriver->HValues(strKey, valueVec))
        {
            for (int i = 0; i < valueVec.size(); i++)
            {
                NFGUID xIdent;
                xIdent.FromString(valueVec[i]);
                if (!xIdent.IsNull())
                {
                    xRoomIDList.push_back(xIdent);
                }
            }

            return true;
        }
    }

    return false;
}
开发者ID:xinst,项目名称:NoahGameFrame,代码行数:27,代码来源:NFCPVPMatchRedisModule.cpp

示例4: PopSinglePlayer

bool NFCPVPMatchRedisModule::PopSinglePlayer(NFGUID& self, const int nPVPMode, const int nGrade)
{
	NF_SHARE_PTR<NFINoSqlDriver> pNoSqlDriver = m_pNoSqlModule->GetDriverBySuitConsistent();
    if (pNoSqlDriver)
    {
        std::string strKey = MakeSingleWaitRedisKey(nPVPMode, nGrade);
        std::string strData;

        if (pNoSqlDriver->ListPop(strKey, strData))
        {
            return self.FromString(strData);
        }
    }

    return false;
}
开发者ID:xinst,项目名称:NoahGameFrame,代码行数:16,代码来源:NFCPVPMatchRedisModule.cpp

示例5: GetPlayerRoomID

bool NFCPVPMatchRedisModule::GetPlayerRoomID(const NFGUID& self, NFGUID& xRoomID)
{
	NF_SHARE_PTR<NFINoSqlDriver> pNoSqlDriver = m_pNoSqlModule->GetDriverBySuitConsistent();
    if (pNoSqlDriver)
    {
        std::string strKey = MakePlayerRoomKey();
        std::string strData;
        if (pNoSqlDriver->HGet(strKey, self.ToString(), strData))
        {
            if (xRoomID.FromString(strData))
            {
                return true;
            }
        }
    }

    return false;
}
开发者ID:xinst,项目名称:NoahGameFrame,代码行数:18,代码来源:NFCPVPMatchRedisModule.cpp

示例6: FromString

bool NFCProperty::FromString(const std::string& strData)
{
	const TDATA_TYPE eType = GetType();
	bool bRet = false;
	switch (eType)
	{
	case TDATA_INT:
	{
		NFINT64  nValue = 0;
		bRet = NF_StrTo(strData, nValue);
		SetInt(nValue);
	}
	break;

	case TDATA_FLOAT:
	{
		double  dValue = 0;
		bRet = NF_StrTo(strData, dValue);
		SetFloat(dValue);
	}
	break;

	case TDATA_STRING:
	{
		SetString(strData);
		bRet = true;
	}
	break;
	case TDATA_OBJECT:
	{
		NFGUID xID;

		bRet = xID.FromString(strData);
		SetObject(xID);
	}
	break;
	default:
		break;
	}

	return bRet;
}
开发者ID:B1sounours,项目名称:NoahGameFrame,代码行数:42,代码来源:NFCProperty.cpp

示例7: BroadcastMsgToRoom

bool NFCPVPMatchModule::BroadcastMsgToRoom(const NFGUID& self, const NFGUID& xRoomID, const uint16_t nMsgID, google::protobuf::Message& xData)
{
    std::vector<std::string> xPlayerList;
    std::vector<int64_t> xGameIDList;
    std::vector<NFGUID> xPlayerIDList;

    NFMsg::PVPRoomInfo xRoomInfo;
    if (!m_pPVPMatchRedisModule->GetRoomInfo(xRoomID, xRoomInfo))
    {
        return false;
    }

    for (int i = 0; i < xRoomInfo.xblueplayer_size(); i++)
    {
        xPlayerIDList.push_back(NFINetModule::PBToNF(xRoomInfo.xblueplayer(i)));
    }

    for (int i = 0; i < xRoomInfo.xredplayer_size(); i++)
    {
        xPlayerIDList.push_back(NFINetModule::PBToNF(xRoomInfo.xredplayer(i)));
    }

    for (int i = 0; i < xPlayerIDList.size(); i++)
    {
        xPlayerList.push_back(xPlayerIDList[i].ToString());
    }

    if (!m_pPlayerRedisModule->GetPlayerCacheGameID(xPlayerList, xGameIDList))
    {
        return false;
    }

    for (int i = 0; i < xGameIDList.size() && i < xPlayerList.size(); i++)
    {
        int nGameID = xGameIDList[i];
        NFGUID xPlayer;
        xPlayer.FromString(xPlayerList[i]);
        m_pWorldNet_ServerModule->SendMsgToGame(nGameID, (NFMsg::EGameMsgID)nMsgID, xData, xPlayer);
    }

    return true;
}
开发者ID:ketoo,项目名称:NoahGameFrame,代码行数:42,代码来源:NFCPVPMatchModule.cpp

示例8: PopSinglePlayerList

bool NFCPVPMatchRedisModule::PopSinglePlayerList(const int nPVPMode, const int nGrade, const int nCount, std::vector<NFGUID>& xPlayerList)
{
	NF_SHARE_PTR<NFINoSqlDriver> pNoSqlDriver = m_pNoSqlModule->GetDriverBySuitConsistent();
    if (pNoSqlDriver)
    {
        std::string strKey = MakeSingleWaitRedisKey(nPVPMode, nGrade);
        std::string strData;

        for (int i = 0; i < nCount; i++)
        {
            if (pNoSqlDriver->ListPop(strKey, strData))
            {
                NFGUID xIdent;
                xIdent.FromString(strData);

                xPlayerList.push_back(xIdent);
            }
        }
    }

    return false;
}
开发者ID:xinst,项目名称:NoahGameFrame,代码行数:22,代码来源:NFCPVPMatchRedisModule.cpp

示例9: GetRoleInfo

bool NFCAccountRedisModule::GetRoleInfo(const std::string & strAccount, std::string & strRoleName, NFGUID & id)
{
	std::string strAccountKey = m_pCommonRedisModule->GetAccountCacheKey(strAccount);
	NF_SHARE_PTR<NFINoSqlDriver> xNoSqlDriver = m_pNoSqlModule->GetDriverBySuit(strAccount);
	if (xNoSqlDriver)
	{
		if (xNoSqlDriver->Exists(strAccountKey))
		{
			std::string strID;
			bool bRoleNameRet = xNoSqlDriver->HGet(strAccountKey, NFrame::Player::Name(), strRoleName);
			bool bRoleIDRet = xNoSqlDriver->HGet(strAccountKey, NFrame::Player::ID(), strID);
			if (bRoleNameRet && bRoleIDRet
				&& !strRoleName .empty() && !strID.empty())
			{
				return id.FromString(strID);
			}

			return false;
		}
	}

	return false;
}
开发者ID:bluesky7290,项目名称:NoahGameFrame,代码行数:23,代码来源:NFCAccountRedisModule.cpp


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