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


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

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


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

示例1: UTIL_IncrementMapKey

void UTIL_IncrementMapKey( const char *pszCustomKey )
{
	if ( !pszCustomKey )
		return;

	char szFilename[ _MAX_PATH ];
	if ( !UTIL_GetMapLoadCountFileName( MAP_KEY_FILE, szFilename, _MAX_PATH ) )
		return;

	int iCount = 1;

	KeyValues *kvMapLoadFile = new KeyValues( MAP_KEY_FILE );
	if ( kvMapLoadFile )
	{
		kvMapLoadFile->LoadFromFile( g_pFullFileSystem, szFilename, "MOD" );

		char mapname[MAX_MAP_NAME];
		Q_FileBase( engine->GetLevelName(), mapname, sizeof( mapname) );
		Q_strlower( mapname );

		// Increment existing, or add a new one
		KeyValues *pMapKey = kvMapLoadFile->FindKey( mapname );
		if ( pMapKey )
		{
			iCount = pMapKey->GetInt( pszCustomKey, 0 ) + 1;
			pMapKey->SetInt( pszCustomKey, iCount );
		}
		else 
		{
			KeyValues *pNewKey = new KeyValues( mapname );
			if ( pNewKey )
			{
				pNewKey->SetString( pszCustomKey, "1" );
				kvMapLoadFile->AddSubKey( pNewKey );
			}
		}

		// Write it out

		// force create this directory incase it doesn't exist
		filesystem->CreateDirHierarchy( MAP_KEY_FILE_DIR, "MOD");

		CUtlBuffer buf( 0, 0, CUtlBuffer::TEXT_BUFFER );
		kvMapLoadFile->RecursiveSaveToFile( buf, 0 );
		g_pFullFileSystem->WriteFile( szFilename, "MOD", buf );

		kvMapLoadFile->deleteThis();
	}

	if ( IsX360() )
	{
#ifdef _X360
		xboxsystem->FinishContainerWrites();
#endif
	}
}
开发者ID:hekar,项目名称:luminousforts-codebase,代码行数:56,代码来源:cdll_util.cpp

示例2: ImageButton

CASW_VGUI_Computer_Frame::CASW_VGUI_Computer_Frame( vgui::Panel *pParent, const char *pElementName, C_ASW_Hack_Computer* pHackComputer ) 
:	vgui::Panel( pParent, pElementName ),
	CASW_VGUI_Ingame_Panel(),
	m_pHackComputer( pHackComputer )
{
	m_bHideLogoffButton = false;

	SetKeyBoardInputEnabled(true);
	m_fLastThinkTime = gpGlobals->curtime;
	m_pCurrentPanel = NULL;
	m_pMenuPanel = NULL;
	m_pSplash = NULL;
	m_bSetAlpha = false;

	m_pLogoffLabel = new ImageButton(this, "LogoffLabel", "");
	m_pLogoffLabel->AddActionSignalTarget(this);

	KeyValues *msg = new KeyValues("Command");	
	msg->SetString("command", "Logoff");
	m_pLogoffLabel->SetCommand(msg);

	KeyValues *cmsg = new KeyValues("Command");			
	cmsg->SetString( "command", "Cancel" );
	m_pLogoffLabel->SetCancelCommand( cmsg );
	
	m_pLogoffLabel->SetText("#asw_log_off");


	for (int i=0;i<3;i++)
	{
		m_pScan[i] = new vgui::ImagePanel(this, "ComputerScan0");
		m_pScan[i]->SetShouldScaleImage(true);
		m_pScan[i]->SetImage("swarm/Computer/ComputerScan");
	}
	m_pBackdropImage = new vgui::ImagePanel(this, "SplashImage");
	m_pBackdropImage->SetShouldScaleImage(true);
	m_iBackdropType = -1;
	SetBackdrop(0);
	
	RequestFocus();

	m_bPlayingSplash = !IsPDA();
}
开发者ID:Au-heppa,项目名称:swarm-sdk,代码行数:43,代码来源:asw_vgui_computer_frame.cpp

示例3:

KeyValues *CNodeCustom::AllocateKeyValues( int NodeIndex )
{
	KeyValues *pKV = BaseClass::AllocateKeyValues( NodeIndex );

	WriteJackDataFromKV( pKV, m_hszVarNames_In, m_hszVarNames_Out,
						GetNumJacks_In(), GetNumJacks_Out() );

	pKV->SetString( "szFunctionName", m_szFunctionName );
	pKV->SetString( "szFilePath", m_szFilePath );
	pKV->SetInt( "iInline", m_bInline ? 1 : 0 );

	CKVPacker::KVPack( m_pCode_Global, "szcode_global", pKV );
	CKVPacker::KVPack( m_pCode_Function, "szcode_body", pKV );
	//pKV->SetString( "szcode_global", m_pCode_Global );
	//pKV->SetString( "szcode_body", m_pCode_Function );
	pKV->SetInt( "iEnvFlags", m_iEnvFlags );

	return pKV;
}
开发者ID:BSVino,项目名称:source-shader-editor,代码行数:19,代码来源:vnode_custom.cpp

示例4: SetCustomStringList

//-----------------------------------------------------------------------------
// Purpose: Sets a custom string list
//-----------------------------------------------------------------------------
void CVarListPropertyPage::SetCustomStringList(const char *varName, const char *stringList)
{
	// find the item by name
	int itemID = m_pRulesList->GetItem(varName);
	KeyValues *rule = m_pRulesList->GetItem(itemID);
	if (!rule)
		return;

	rule->SetString("stringlist", stringList);
}
开发者ID:Axitonium,项目名称:SourceEngine2007,代码行数:13,代码来源:VarListPropertyPage.cpp

示例5: FinishClientPutInServer

void FinishClientPutInServer( CHL2MP_Player *pPlayer )
{
	pPlayer->InitialSpawn();
	//BB: we dont want players to spawn immediately when joining the server, we want them to auto spectate
	//pPlayer->Spawn();
	pPlayer->ChangeTeam( TEAM_SPECTATOR );


	char sName[128];
	Q_strncpy( sName, pPlayer->GetPlayerName(), sizeof( sName ) );
	
	// First parse the name and remove any %'s
	for ( char *pApersand = sName; pApersand != NULL && *pApersand != 0; pApersand++ )
	{
		// Replace it with a space
		if ( *pApersand == '%' )
				*pApersand = ' ';
	}

	// notify other clients of player joining the game
	UTIL_ClientPrintAll( HUD_PRINTNOTIFY, "#Game_connected", sName[0] != 0 ? sName : "<unconnected>" );

	if ( HL2MPRules()->IsTeamplay() == true )
	{
		ClientPrint( pPlayer, HUD_PRINTTALK, "You are on team %s1\n", pPlayer->GetTeam()->GetName() );
	}

	const ConVar *hostname = cvar->FindVar( "hostname" );
	const char *title = (hostname) ? hostname->GetString() : "MESSAGE OF THE DAY";

	KeyValues *data = new KeyValues("data");
	data->SetString( "title", title );		// info panel title
	data->SetString( "type", "1" );			// show userdata from stringtable entry
	data->SetString( "msg",	"motd" );		// use this stringtable entry
	data->SetBool( "unload", sv_motd_unload_on_dismissal.GetBool() );

	//BB: Display the team selection panel...
	pPlayer->ShowViewPortPanel( PANEL_TEAM, true, data );
	pPlayer->ShowViewPortPanel( PANEL_INFO, true, data );

	data->deleteThis();
}
开发者ID:rendenba,项目名称:source-sdk-2013,代码行数:42,代码来源:hl2mp_client.cpp

示例6: GetPlayerStarts

KeyValues* VMFExporter::GetPlayerStarts()
{
    KeyValues *pKeys = new KeyValues( "entity" );
    pKeys->SetInt( "id", m_iEntityCount++ );
    pKeys->SetString( "classname", "info_player_start" );
    pKeys->SetString( "angles", "0 0 0" );

    // put a single player start in the centre of the player start tile selected
    float player_start_x = 128.0f;
    float player_start_y = 128.0f;
    int half_map_size = MAP_LAYOUT_TILES_WIDE * 0.5f;
    player_start_x += (m_pMapLayout->m_iPlayerStartTileX - half_map_size) * ASW_TILE_SIZE;
    player_start_y += (m_pMapLayout->m_iPlayerStartTileY - half_map_size) * ASW_TILE_SIZE;

    char buffer[128];
    Q_snprintf(buffer, sizeof(buffer), "%f %f 1.0", player_start_x, player_start_y);
    pKeys->SetString( "origin", buffer );

    return pKeys;
}
开发者ID:Cre3per,项目名称:hl2sdk-csgo,代码行数:20,代码来源:VMFExporter.cpp

示例7: SetCompletionState

//-----------------------------------------------------------------------------
// Utility to set the completion state
//-----------------------------------------------------------------------------
void FileOpenStateMachine::SetCompletionState( FileOpenStateMachine::CompletionState_t state )
{
	m_CompletionState = state;
	if ( m_CompletionState == IN_PROGRESS )
		return;

	m_CurrentState = STATE_NONE;

	KeyValues *kv = new KeyValues( "FileStateMachineFinished" );
	kv->SetInt( "completionState", m_CompletionState );
	kv->SetInt( "wroteFile", m_bWroteFile );
	kv->SetString( "fullPath", m_FileName.Get() );
	kv->SetString( "fileType", m_bIsOpeningFile ? m_OpenFileType.Get() : m_SaveFileType.Get() );
	if ( m_pContextKeyValues )
	{
		kv->AddSubKey( m_pContextKeyValues );
		m_pContextKeyValues = NULL;
	}
	PostActionSignal( kv );
}
开发者ID:DeadZoneLuna,项目名称:SourceEngine2007,代码行数:23,代码来源:FileOpenStateMachine.cpp

示例8: Init

//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CStunEffect::Init( void ) 
{
	m_flDuration = 0.0f;
	m_flFinishTime = 0.0f;
	m_bUpdateView = true;

	KeyValues *pVMTKeyValues = new KeyValues( "UnlitGeneric" );
	pVMTKeyValues->SetString( "$basetexture", STUN_TEXTURE );
	m_EffectMaterial.Init( "__stuneffect", TEXTURE_GROUP_CLIENT_EFFECTS, pVMTKeyValues );
	m_StunTexture.Init( STUN_TEXTURE, TEXTURE_GROUP_CLIENT_EFFECTS );
}
开发者ID:Au-heppa,项目名称:source-sdk-2013,代码行数:14,代码来源:episodic_screenspaceeffects.cpp

示例9: SaveTheme

bool CLevelTheme::SaveTheme(const char *pszThemeName)
{
	char szFullFileName[MAX_PATH];
	Q_snprintf(szFullFileName, sizeof(szFullFileName), "tilegen/themes/%s.theme", pszThemeName);
	KeyValues *pThemeKeyValues = new KeyValues( pszThemeName );
	pThemeKeyValues->SetString("ThemeName", m_szName);
	pThemeKeyValues->SetString("ThemeDescription", m_szDescription);
	pThemeKeyValues->SetBool( "VMFTweak", m_bRequiresVMFTweak );
	pThemeKeyValues->SetBool( "SkipErrorCheck", m_bSkipErrorCheck );
	char buffer[128];
	Q_snprintf( buffer, sizeof( buffer ), "%f %f %f", m_vecAmbientLight.x, m_vecAmbientLight.y, m_vecAmbientLight.z );
	pThemeKeyValues->SetString( "AmbientLight", buffer );
	if (!pThemeKeyValues->SaveToFile(g_pFullFileSystem, szFullFileName, "GAME"))
	{
		Msg("Error: Failed to save theme %s\n", szFullFileName);
		return false;
	}
	// TODO: check the room templates folder for this theme exists
	return true;
}
开发者ID:Au-heppa,项目名称:swarm-sdk,代码行数:20,代码来源:LevelTheme.cpp

示例10: RecordWorldDecal

//-----------------------------------------------------------------------------
// Shared code
//-----------------------------------------------------------------------------
static inline void RecordWorldDecal( const Vector *pos, int index )
{
	if ( !ToolsEnabled() )
		return;

	if ( clienttools->IsInRecordingMode() )
	{
		KeyValues *msg = new KeyValues( "TempEntity" );

 		msg->SetInt( "te", TE_WORLD_DECAL );
 		msg->SetString( "name", "TE_WorldDecal" );
		msg->SetFloat( "time", gpGlobals->curtime );
		msg->SetFloat( "originx", pos->x );
		msg->SetFloat( "originy", pos->y );
		msg->SetFloat( "originz", pos->z );
		msg->SetString( "decalname", effects->Draw_DecalNameFromIndex( index ) );

		ToolFramework_PostToolMessage( HTOOLHANDLE_INVALID, msg );
		msg->deleteThis();
	}
}
开发者ID:0xFEEDC0DE64,项目名称:UltraGame,代码行数:24,代码来源:c_te_worlddecal.cpp

示例11: MountExtraContent

//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void MountExtraContent()
{
	memset(g_AppStatus, 0, sizeof(g_AppStatus));

	KeyValues *pMountList = new KeyValues( "MountList" );
	if( !pMountList->LoadFromFile( filesystem, "mountlist.txt" ) )
	{
		// Create default
		pMountList->SetString( "dota", "0" );
		pMountList->SetString( "left4dead", "0" );
		pMountList->SetString( "left4dead2", "0" );
		pMountList->SetString( "portal2", "0" );
		pMountList->SetString( "csgo", "0" );
		pMountList->SetString( "dearesther", "0" );
		
		pMountList->SaveToFile( filesystem, "mountlist.txt", "MOD" );
	}

	if( TryMountVPKGame( "DOTA", "../../common/dota 2 beta/dota", APP_DOTA, "dota", pMountList ) )
		PostProcessDota2( "models" );
	TryMountVPKGame( "Portal 2", "../../common/portal 2/portal2", APP_PORTAL2, "portal2", pMountList );
	TryMountVPKGame( "Left 4 Dead 2", "../../common/left 4 dead 2/left4dead2", APP_L4D2, "left4dead2", pMountList );
	TryMountVPKGame( "Left 4 Dead", "../../common/left 4 dead/left4dead", APP_L4D1, "left4dead", pMountList );
	TryMountVPKGame( "Counter-Strike Global Offensive", "../../common/Counter-Strike Global Offensive/csgo", APP_CSGO, "csgo", pMountList );
	TryMountVPKGame( "Dear Esther", "../../common/dear esther/dearesther", APP_DEARESTHER, "dearesther", pMountList );

	if( pMountList )
	{
		pMountList->deleteThis();
		pMountList = NULL;
	}
}
开发者ID:detoxhby,项目名称:lambdawars,代码行数:35,代码来源:wars_mount_system.cpp

示例12: ExpandTreeNode

//-----------------------------------------------------------------------------
// Purpose: expands a path
//-----------------------------------------------------------------------------
void DirectorySelectDialog::ExpandTreeNode(const char *path, int parentNodeIndex)
{
	// set the small wait cursor
	surface()->SetCursor(dc_waitarrow);

	// get all the subfolders of the current drive
	char searchString[512];
	sprintf(searchString, "%s*.*", path);

	//Updated to use IFileSystem instead of OS file enumeration functions. - Solokiller
	//Also includes better directory detection for special directories.
	FileFindHandle_t h;
	const char *pFileName = filesystem()->FindFirst( searchString, &h );
	for( ; pFileName; pFileName = filesystem()->FindNext( h ) )
	{
		if( !Q_stricmp( pFileName, ".." ) || !Q_stricmp( pFileName, "." ) )
			continue;

		KeyValues *kv = new KeyValues( "item" );
		kv->SetString( "Text", pFileName );
		// set the folder image
		kv->SetInt( "Image", 1 );
		kv->SetInt( "SelectedImage", 1 );
		kv->SetInt( "Expand", DoesDirectoryHaveSubdirectories( path, pFileName ) );
		m_pDirTree->AddItem( kv, parentNodeIndex );
	}
	filesystem()->FindClose( h );

	//Old code:
	/*
	_finddata_t wfd;
	memset(&wfd, 0, sizeof(_finddata_t));
	long hResult = _findfirst(searchString, &wfd);
	if (hResult != -1)
	{
		do
		{
			if ((wfd.attrib & _A_SUBDIR) && wfd.name[0] != '.')
			{
				KeyValues *kv = new KeyValues("item");
				kv->SetString("Text", wfd.name);
				// set the folder image
				kv->SetInt("Image", 1);
				kv->SetInt("SelectedImage", 1);
				kv->SetInt("Expand", DoesDirectoryHaveSubdirectories(path, wfd.name));	
				m_pDirTree->AddItem(kv, parentNodeIndex);
			}
		} while (_findnext(hResult, &wfd) == 0);
		_findclose(hResult);
	}
	*/
}
开发者ID:oskarlh,项目名称:HLEnhanced,代码行数:55,代码来源:DirectorySelectDialog.cpp

示例13: SaveList

void CShaderPrecache::SaveList()
{
	KeyValues *pKV = new KeyValues( "shaderlist" );

	for ( int i = 0; i < m_pPanelList.Count(); i++ )
	{
		char name[MAX_PATH];
		m_pPanelList[i].L->GetText( name, MAX_PATH );
		pKV->SetString( VarArgs( "shader_%03i", i ), name );
	}

	df_SaveDump_List( pKV );
}
开发者ID:BSVino,项目名称:source-shader-editor,代码行数:13,代码来源:vdialogsprecache.cpp

示例14: ImageButton

CASW_VGUI_Computer_Menu::CASW_VGUI_Computer_Menu( vgui::Panel *pParent, const char *pElementName, C_ASW_Hack_Computer* pHackComputer ) 
:	vgui::Panel( pParent, pElementName ),
	CASW_VGUI_Ingame_Panel(),
	m_pHackComputer( pHackComputer )
{
	for (int i=0;i<ASW_COMPUTER_MAX_MENU_ITEMS;i++)
	{		
		m_pMenuLabel[i] = new ImageButton(this, "ComputerMenuLabel", "");
		m_pMenuLabel[i]->AddActionSignalTarget(this);
		
		KeyValues *msg = new KeyValues("Command");
		char buffer[16];
		Q_snprintf(buffer, sizeof(buffer), "Option%d", i);
		msg->SetString("command", buffer);
		m_pMenuLabel[i]->SetCommand(msg);

		KeyValues *cmsg = new KeyValues("Command");			
		cmsg->SetString( "command", "Cancel" );
		m_pMenuLabel[i]->SetCancelCommand( cmsg );

		m_pMenuIcon[i] = new vgui::ImagePanel(this, "ComputerMenuIcon");
		m_pMenuIconShadow[i] = new vgui::ImagePanel(this, "ComputerMenuIconShadow");		
	}

	m_pBlackBar[0] = new vgui::ImagePanel(this, "ComputerMenuBar1");
	m_pBlackBar[1] = new vgui::ImagePanel(this, "ComputerMenuBar2");
	m_hCurrentPage = NULL;
	m_bFadingCurrentPage = false;
	m_iPrepareHackOption = -1;
	m_iMouseOverOption = -1;
	m_iOldMouseOverOption = -1;
	m_iPreviousHackOption = 0;
	m_bSetAlpha = false;
	m_iAutodownload = -1;

	m_pAccessDeniedLabel = new vgui::Label(this, "AccessDeniedLabel", "#asw_computer_access_denied");
	m_pAccessDeniedLabel->SetContentAlignment(vgui::Label::a_center);
	m_pInsufficientRightsLabel = new vgui::Label(this, "AccessDeniedLabel", "#asw_computer_insufficient_rights");	
}
开发者ID:BenLubar,项目名称:SwarmDirector2,代码行数:39,代码来源:asw_vgui_computer_menu.cpp

示例15: SetupSession

//---------------------------------------------------------------------
// Purpose: Send all properties and contexts to the matchmaking session
//---------------------------------------------------------------------
void CSessionOptionsDialog::SetupSession( void )
{
	KeyValues *pKeys = new KeyValues( "SessionKeys" );

	// Send user-selected properties and contexts
	for ( int i = 0; i < m_Menu.GetItemCount(); ++i )
	{
		COptionsItem *pItem = dynamic_cast< COptionsItem* >( m_Menu.GetItem( i ) );
		if ( !pItem )
		{                    
			continue;
		}		

		const sessionProperty_t &prop = pItem->GetActiveOption();

		KeyValues *pProperty = pKeys->CreateNewKey();
		pProperty->SetName( prop.szID );
		pProperty->SetInt( "type", prop.nType );
		pProperty->SetString( "valuestring", prop.szValue );
		pProperty->SetString( "valuetype", prop.szValueType );
		pProperty->SetInt( "optionindex", pItem->GetActiveOptionIndex() );
	}

	// Send contexts and properties parsed from the resource file
	for ( int i = 0; i < m_SessionProperties.Count(); ++i )
	{
		const sessionProperty_t &prop = m_SessionProperties[i];

		KeyValues *pProperty = pKeys->CreateNewKey();
		pProperty->SetName( prop.szID );
		pProperty->SetInt( "type", prop.nType );
		pProperty->SetString( "valuestring", prop.szValue );
		pProperty->SetString( "valuetype", prop.szValueType );
	}

	// Matchmaking will make a copy of these keys
	matchmaking->SetSessionProperties( pKeys );
	pKeys->deleteThis();
}
开发者ID:DeadZoneLuna,项目名称:SourceEngine2007,代码行数:42,代码来源:sessionoptionsdialog.cpp


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