本文整理汇总了C++中NF_SHARE_PTR::FindString方法的典型用法代码示例。如果您正苦于以下问题:C++ NF_SHARE_PTR::FindString方法的具体用法?C++ NF_SHARE_PTR::FindString怎么用?C++ NF_SHARE_PTR::FindString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NF_SHARE_PTR
的用法示例。
在下文中一共展示了NF_SHARE_PTR::FindString方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DeleteItem
bool NFCPackModule::DeleteItem( const NFGUID& self, const std::string& strItemConfigID, const int nCount )
{
if(nCount <= 0)
{
return false;
}
NF_SHARE_PTR<NFIObject> pObject = m_pKernelModule->GetObject( self );
if ( NULL == pObject )
{
return false;
}
//还得确定有这个装备
if (!m_pElementModule->ExistElement(NFrame::Item::ThisName(), strItemConfigID))
{
return false;
}
NF_SHARE_PTR<NFIRecord> pRecord = pObject->GetRecordManager()->GetElement( NFrame::Player::R_BagItemList() );
if (!pRecord)
{
return false;
}
NFCDataList varFindResult;
int nFindRowCount = pRecord->FindString(NFrame::Player::BagItemList_ConfigID, strItemConfigID, varFindResult);
if (nFindRowCount > 0)
{
int nNeedDelCount = nCount;
for (int i = 0; i < varFindResult.GetCount(); ++i)
{
int nFindRow = varFindResult.Int(i);
int nOldCount = pRecord->GetInt(nFindRow, NFrame::Player::BagItemList_ItemCount);
if (nOldCount > nNeedDelCount)
{
int nNewCount = nOldCount - nNeedDelCount;
pRecord->SetInt(nFindRow, NFrame::Player::BagItemList_ItemCount, nNewCount);
nNeedDelCount = 0;
}
else if (nOldCount == nNeedDelCount)
{
pRecord->Remove(nFindRow);
nNeedDelCount = 0;
}
else if (nOldCount < nNeedDelCount)
{
pRecord->Remove(nFindRow);
nNeedDelCount -= nOldCount;
}
}
if (nNeedDelCount <= 0)
{
return true;
}
}
return false;
}
示例2: AddHero
NFGUID NFCHeroModule::AddHero(const NFGUID& self, const std::string& strID)
{
NF_SHARE_PTR<NFIRecord> pHeroRecord = m_pKernelModule->FindRecord(self, NFrame::Player::PlayerHero::ThisName());
if (nullptr == pHeroRecord)
{
return NFGUID();
}
int nRow = pHeroRecord->FindString(NFrame::Player::PlayerHero::ConfigID, strID);
if (nRow >= 0)
{
return NFGUID();
}
NF_SHARE_PTR<NFDataList> xRowData = pHeroRecord->GetInitData();
NFGUID xHeroID = m_pKernelModule->CreateGUID();
xRowData->SetObject(NFrame::Player::PlayerHero::GUID, xHeroID);
xRowData->SetString(NFrame::Player::PlayerHero::ConfigID, strID);
xRowData->SetInt(NFrame::Player::PlayerHero::Activated, 0);
if (pHeroRecord->AddRow(-1, *xRowData) < 0)
{
return NFGUID();
}
AddToFightList(self, xHeroID);
return xHeroID;
}
示例3: CreateItemInTempBag
bool NFCPackModule::CreateItemInTempBag(const NFGUID & self, const std::string & strConfigName, const int nCount)
{
NF_SHARE_PTR<NFIRecord> pRecord = m_pKernelModule->FindRecord(self, NFrame::Player::TempItemList::ThisName());
if (nullptr == pRecord)
{
return false;
}
NFDataList varFindResult;
int nFindRowCount = pRecord->FindString(NFrame::Player::TempItemList::ConfigID, strConfigName, varFindResult);
if (nFindRowCount <= 0)
{
NF_SHARE_PTR<NFDataList> xRowData = pRecord->GetInitData();
xRowData->SetString(NFrame::Player::TempItemList::ConfigID, strConfigName);
xRowData->SetInt(NFrame::Player::TempItemList::ItemCount, nCount);
pRecord->AddRow(-1, *xRowData);
}
else
{
int nFindRow = varFindResult.Int32(0);
int nOldCount = pRecord->GetInt32(nFindRow, NFrame::Player::TempItemList::ItemCount);
int nNewCount = nOldCount + nCount;
pRecord->SetInt(nFindRow, NFrame::Player::TempItemList::ItemCount, nNewCount);
}
return true;
}
示例4: ExistSkill
int NFCSkillModule::ExistSkill( const NFGUID& self, const std::string& strSkillName )
{
NF_SHARE_PTR<NFIRecord> pRecord = m_pKernelModule->FindRecord( self, mstrSkillTableName );
if ( pRecord )
{
NFCDataList varResult;
pRecord->FindString( EGameSkillStoreType::EGSST_TYPE_SKILL_CONFIGID, strSkillName.c_str(), varResult );
if ( varResult.GetCount() == 1 )
{
return varResult.Int( 0 );
}
}
return -1;
}
示例5: GetHeroGUID
NFGUID NFCHeroModule::GetHeroGUID(const NFGUID& self, const std::string& strID)
{
NF_SHARE_PTR<NFIRecord> pHeroRecord = m_pKernelModule->FindRecord(self, NFrame::Player::PlayerHero::ThisName());
if (nullptr == pHeroRecord)
{
return NFGUID();
}
int nRow = pHeroRecord->FindString(NFrame::Player::PlayerHero::ConfigID, strID);
if (nRow < 0)
{
return NFGUID();
}
return pHeroRecord->GetObject(nRow, NFrame::Player::PlayerHero::GUID);
}
示例6: CreateItem
bool NFCPackModule::CreateItem( const NFGUID& self, const std::string& strConfigName, const int nCount )
{
if (nCount <= 0)
{
return 0;
}
NF_SHARE_PTR<NFIObject> pObject = m_pKernelModule->GetObject( self );
if ( NULL == pObject )
{
return 0;
}
//还得确定有这个装备
bool bExist = m_pElementModule->ExistElement(NFrame::Item::ThisName(), strConfigName );
if ( !bExist )
{
return 0;
}
NF_SHARE_PTR<NFIRecord> pRecord = pObject->GetRecordManager()->GetElement( NFrame::Player::R_BagItemList() );
if (!pRecord)
{
return 0;
}
NFCDataList varFindResult;
int nFindRowCount = pRecord->FindString(NFrame::Player::BagItemList_ConfigID, strConfigName, varFindResult);
if (nFindRowCount <= 0)
{
NF_SHARE_PTR<NFIDataList> xRowData = pRecord->GetInitData();
xRowData->SetString(NFrame::Player::BagItemList_ConfigID, strConfigName);
xRowData->SetInt(NFrame::Player::BagItemList_ItemCount, nCount);
xRowData->SetInt(NFrame::Player::BagItemList_Date, NFTime::GetNowTime());
}
else
{
int nFindRow = varFindResult.Int(0);
int nOldCount = pRecord->GetInt(nFindRow, NFrame::Player::BagItemList_ItemCount);
int nNewCount = nOldCount + nCount;
pRecord->SetInt(nFindRow, NFrame::Player::BagItemList_ItemCount, nNewCount);
}
return 0;
}
示例7: EnoughItem
bool NFCPackModule::EnoughItem( const NFGUID& self, const std::string& strItemConfigID, const int nCount )
{
if(nCount <= 0)
{
return false;
}
NF_SHARE_PTR<NFIObject> pObject = m_pKernelModule->GetObject( self );
if ( NULL == pObject )
{
return false;
}
//还得确定有这个装备
bool bExist = m_pElementModule->ExistElement(NFrame::Item::ThisName(), strItemConfigID );
if ( !bExist )
{
return false;
}
NF_SHARE_PTR<NFIRecord> pRecord = pObject->GetRecordManager()->GetElement( NFrame::Player::R_BagItemList() );
if (!pRecord)
{
return false;
}
NFCDataList varFindResult;
int nFindRowCount = pRecord->FindString(NFrame::Player::BagItemList_ConfigID, strItemConfigID, varFindResult);
if (nFindRowCount > 0)
{
int nTotalCount = 0;
for (int i = 0; i < varFindResult.GetCount(); ++i)
{
int nFindRow = varFindResult.Int(i);
int nOldCount = pRecord->GetInt(nFindRow, NFrame::Player::BagItemList_ItemCount);
nTotalCount += nOldCount;
}
if (nTotalCount > 0)
{
return true;
}
}
return false;
}