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


C++ KeyValues::GetWString方法代码示例

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


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

示例1: OnSetText

//-----------------------------------------------------------------------------
// Purpose: Sets the text from the message
//-----------------------------------------------------------------------------
void Label::OnSetText(KeyValues *params)
{
	KeyValues *pkvText = params->FindKey("text", false);
	if (!pkvText)
		return;

	if (pkvText->GetDataType() == KeyValues::TYPE_STRING)
	{
		SetText(pkvText->GetString());
	}
	else if (pkvText->GetDataType() == KeyValues::TYPE_WSTRING)
	{
		SetText(pkvText->GetWString());
	}
}
开发者ID:Baer42,项目名称:source-sdk-2013,代码行数:18,代码来源:Label.cpp

示例2: Activate

//=============================================================================
void Addons::Activate()
{
	BaseClass::Activate();

	m_GplAddons->RemoveAllPanelItems();
	m_addonInfoList.RemoveAll();
	m_pAddonList ? m_pAddonList->deleteThis() : NULL;

	//
	// Get the list of addons
	//

	// Load particular info for each addon
	if ( LoadAddonListFile( m_pAddonList ) )
	{
		for ( KeyValues *pCur = m_pAddonList->GetFirstValue(); pCur; pCur = pCur->GetNextValue() )
		{
			char szAddonDirName[60];
			bool bIsVPK = true;

			// If the entry in the list is a .vpk then 
			if ( V_stristr( pCur->GetName(), ".vpk" ) )
			{
				V_StripExtension( pCur->GetName(), szAddonDirName, sizeof( szAddonDirName ) );
				ExtractAddonMetadata( szAddonDirName );
			}
			else
			{
				bIsVPK = false;
				V_strncpy( szAddonDirName, pCur->GetName(), sizeof( szAddonDirName ) );
			}

			Addons::AddonInfo addonInfo;

			// Copy info to the AddonInfo struct
			KeyValues *pAddonInfo;

			if ( LoadAddonInfoFile( pAddonInfo, szAddonDirName, bIsVPK ) )
			{
				// Convert JPEG image to VTF, if necessary
				GetAddonImage( pCur->GetName(), addonInfo.szImageName, sizeof( addonInfo.szImageName ), bIsVPK  );

				// Copy values from particular keys
				V_strncpy( addonInfo.szDirectory, pCur->GetName(), sizeof( addonInfo.szDirectory ) ); 

				V_wcsncpy( addonInfo.szName, pAddonInfo->GetWString( "addontitle", g_pVGuiLocalize->Find( "#L4D360UI_Addon_None_Specified" ) ), sizeof( addonInfo.szName ) );
				V_wcsncpy( addonInfo.szAuthor, pAddonInfo->GetWString( "addonauthor", g_pVGuiLocalize->Find( "#L4D360UI_Addon_None_Specified" ) ), sizeof( addonInfo.szAuthor ) );
				V_wcsncpy( addonInfo.szDescription, pAddonInfo->GetWString( "addonDescription", g_pVGuiLocalize->Find( "#L4D360UI_Addon_None_Specified" ) ), sizeof( addonInfo.szDescription ) );
				addonInfo.bEnabled = pCur->GetInt() != 0;

				// Generate the types string based on the value of keys
				bool bCampaign = false, bMaps = false, bSkin = false, bWeapon = false, bBoss = false, bCommon = false, bSurvivor = false, bSound = false, bMusic = false, bScript = false, bProp = false;

				bCampaign = pAddonInfo->GetInt( "addonContent_Campaign" ) != 0;
				bMaps = ( pAddonInfo->GetInt( "addonContent_Map" ) != 0 ) && !bCampaign;
				bSkin = pAddonInfo->GetInt( "addonContent_Skin" ) != 0;
				bWeapon = pAddonInfo->GetInt( "addonContent_weapon" ) != 0;
				bBoss = pAddonInfo->GetInt( "addonContent_BossInfected" ) != 0;
				bCommon = pAddonInfo->GetInt( "addonContent_CommonInfected" ) != 0;
				bSurvivor = pAddonInfo->GetInt( "addonContent_Survivor" ) != 0;
				bSound = pAddonInfo->GetInt( "addonContent_Sound" ) != 0;
				bScript = pAddonInfo->GetInt( "addonContent_Script" ) != 0;
				bMusic = pAddonInfo->GetInt( "addonContent_Music" ) != 0;
				bProp = pAddonInfo->GetInt( "addonContent_prop" ) != 0;

				// Make the addon types string based on the flags
				addonInfo.szTypes[0] = NULL;
				bCampaign ? wcsncat( addonInfo.szTypes, g_pVGuiLocalize->Find( "#L4D360UI_Addon_Type_Campaign" ), sizeof( addonInfo.szTypes ) ) : NULL;
				bMaps ? wcsncat( addonInfo.szTypes, g_pVGuiLocalize->Find( "#L4D360UI_Addon_Type_Map" ), sizeof( addonInfo.szTypes ) ) : NULL;
				bSkin ? wcsncat( addonInfo.szTypes, g_pVGuiLocalize->Find( "#L4D360UI_Addon_Type_Skin" ), sizeof( addonInfo.szTypes ) ) : NULL;
				bWeapon ? wcsncat( addonInfo.szTypes, g_pVGuiLocalize->Find( "#L4D360UI_Addon_Type_Weapon" ), sizeof( addonInfo.szTypes ) ) : NULL;
				bBoss ? wcsncat( addonInfo.szTypes, g_pVGuiLocalize->Find( "#L4D360UI_Addon_Type_Boss" ), sizeof( addonInfo.szTypes ) ) : NULL;
				bCommon ? wcsncat( addonInfo.szTypes, g_pVGuiLocalize->Find( "#L4D360UI_Addon_Type_Common" ), sizeof( addonInfo.szTypes ) ) : NULL;
				bSurvivor ? wcsncat( addonInfo.szTypes, g_pVGuiLocalize->Find( "#L4D360UI_Addon_Type_Survivor" ), sizeof( addonInfo.szTypes ) ) : NULL;
				bSound ? wcsncat( addonInfo.szTypes, g_pVGuiLocalize->Find( "#L4D360UI_Addon_Type_Sound" ), sizeof( addonInfo.szTypes ) ) : NULL;
				bScript ? wcsncat( addonInfo.szTypes, g_pVGuiLocalize->Find( "#L4D360UI_Addon_Type_Script" ), sizeof( addonInfo.szTypes ) ) : NULL;
				bMusic ? wcsncat( addonInfo.szTypes, g_pVGuiLocalize->Find( "#L4D360UI_Addon_Type_Music" ), sizeof( addonInfo.szTypes ) ) : NULL;
				bProp ? wcsncat( addonInfo.szTypes, g_pVGuiLocalize->Find( "#L4D360UI_Addon_Type_Props" ), sizeof( addonInfo.szTypes ) ) : NULL;

				// Remove trailing ','
				if ( wcslen( addonInfo.szTypes ) )
				{
					wchar_t *pwcComma = wcsrchr( addonInfo.szTypes, ',' );
					if ( pwcComma )
					{
						*pwcComma = NULL;
					}
				}
			}

			m_addonInfoList.AddToTail( addonInfo );

			// Get rid of the temp files
			if ( bIsVPK )
			{
				char tempFilename[MAX_PATH];
				char modPath[MAX_PATH];
				
				GetPrimaryModDirectory( modPath, MAX_PATH );
//.........这里部分代码省略.........
开发者ID:Cre3per,项目名称:hl2sdk-csgo,代码行数:101,代码来源:vaddons.cpp


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