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


C++ Monster::GetID方法代码示例

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


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

示例1: EditMonster

void MonsterManager::EditMonster(Monster* monster)
{
	for (int i=0; i<m_pListCtrl->GetItemCount(); ++i) {
		CString strID = m_pListCtrl->GetItemText(i, 0);
		UINT uinId = atoi(strID);
		Monster* pMon = this->FindMonster(uinId);
		if (pMon == NULL) continue;
		if (pMon->GetID() != monster->GetID()) continue;
		MONINFO& info = pMon->GetMonInfo();

		int index = i;

		CString strTmp;

		strTmp.Format("[%d]%s(%d¼¶)", pMon->GetBaseID(), Misc::utf8ToGbk(pMon->getBaseName()).c_str(), pMon->GetLevel());
		m_pListCtrl->SetItemText(index, 1, strTmp);		// Ãû³Æ

		strTmp.Format("%d", info.num);
		m_pListCtrl->SetItemText(index, 2, strTmp);		// ÊýÁ¿

		strTmp.Format("%d", info.ai);
		m_pListCtrl->SetItemText(index, 3, strTmp);		// ÖÇÄÜ

		strTmp.Format("%d", info.speed);
		m_pListCtrl->SetItemText(index, 4, strTmp);		// ÒÆËÙ

		strTmp.Format("%d", info.view);
		m_pListCtrl->SetItemText(index, 5, strTmp);		// ÊÓÒ°

		strTmp.Format("%d", info.dropInfo[0].dropType);
		m_pListCtrl->SetItemText(index, 6, strTmp);		// BOSSµôÂä

		strTmp.Format("%d", info.dropInfo[0].dropId);
		m_pListCtrl->SetItemText(index, 7, strTmp);		// µôÂä±àºÅ

		strTmp.Format("%d", info.dropInfo[0].dropProb);
		m_pListCtrl->SetItemText(index, 8, strTmp);		// µôÂä¸ÅÂÊ

		strTmp.Format("%d", info.reviveTime);
		m_pListCtrl->SetItemText(index, 9, strTmp);		// ¸´»îʱ¼ä
	}
}
开发者ID:ueverything,项目名称:easyserver,代码行数:42,代码来源:MonsterManager.cpp

示例2: _LoadGameDatabase

Void GameplayManager::_LoadGameDatabase( const GChar * strPath )
{
    // List everything in current path
    Bool bIsDirectory = false;
    GChar strFileName[FILENAME_LENGTH + 1];

    Bool bContinue = SystemFn->ListDirectoryFirst( strPath, &bIsDirectory, strFileName, FILENAME_LENGTH );

    while( bContinue ) {
        // Build sub path
        GChar strSubPath[PATHNAME_LENGTH + 1];
        StringFn->Format( strSubPath, TEXT("%s/%s"), strPath, strFileName );

        // Sub-directory case
        if ( bIsDirectory ) {
            // Recurse
            _LoadGameDatabase( strSubPath );

            // Next file
            bContinue = SystemFn->ListDirectoryNext( &bIsDirectory, strFileName, FILENAME_LENGTH );
            continue;
        }

        // File case, load XML
        XMLDocument * pMonsterFile = XMLDocument::CreateDocument( strSubPath );

        Assert( pMonsterFile != NULL );
        Assert( StringFn->Cmp(pMonsterFile->GetTagName(), TEXT("MonsterFile")) == 0 );

            // Load skills
        const XMLNode * pSkillListNode = pMonsterFile->GetChildByTag( TEXT("SkillList"), 0 );
        Assert( pSkillListNode != NULL );

        UInt iCount = pSkillListNode->GetChildCount();
        for ( UInt i = 0; i < iCount; ++i ) {
            const XMLNode * pSkillNode = pSkillListNode->GetChildByTag( TEXT("Skill"), i );
            Assert( pSkillNode != NULL );

            Skill * pSkill = Skill::StaticLoad( pSkillNode );

            Bool bInserted = m_mapSkills.Insert( pSkill->GetID(), pSkill );
            Assert( bInserted );
        }

            // Load monsters
        const XMLNode * pMonsterListNode = pMonsterFile->GetChildByTag( TEXT("MonsterList"), 0 );
        Assert( pMonsterListNode != NULL );

        iCount = pMonsterListNode->GetChildCount();
        for( UInt i = 0; i < iCount;  ++i ) {
            XMLNode * pMonsterNode = pMonsterListNode->GetChildByTag( TEXT("Monster"), i );
            Assert( pMonsterNode != NULL );

            Monster hMonster;
            hMonster.Load( pMonsterNode );

            Bool bInserted = m_mapMonsters.Insert( hMonster.GetID(), hMonster );
            Assert( bInserted );
        }

        // Done with this one
        XMLDocument::DestroyDocument( pMonsterFile );
        pMonsterFile = NULL;

        // Next file
        bContinue = SystemFn->ListDirectoryNext( &bIsDirectory, strFileName, FILENAME_LENGTH );
    }
}
开发者ID:Shikifuyin,项目名称:Scarab-Engine,代码行数:68,代码来源:GameplayManager.cpp


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