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


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

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


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

示例1: GetKeyValuesForEditor

KeyValues* CASW_Location_Group::GetKeyValuesForEditor()
{
    char buffer[64];
    KeyValues *pKeys = new KeyValues( "Group" );
    pKeys->SetInt( "RequiredUnlocks", m_iRequiredUnlocks );
    Q_snprintf( buffer, sizeof( buffer ), "%d %d %d %d", m_Color.r(), m_Color.g(), m_Color.b(), m_Color.a() );
    pKeys->SetString( "Color", buffer );
    pKeys->SetString( "Name", m_szGroupName );
    pKeys->SetString( "TitleText", m_szTitleText );
    pKeys->SetString( "DescriptionText", m_szDescriptionText );
    pKeys->SetString( "ImageName", m_szImageName );

    for ( int i = 0; i < m_UnlockedBy.Count(); i++ )
    {
        KeyValues *pKey = new KeyValues( "UnlockMissionID" );
        Q_snprintf( buffer, sizeof( buffer ), "%d", m_UnlockedBy[i] );
        pKey->SetStringValue( buffer );
        pKeys->AddSubKey( pKey );
    }
    for ( int i = 0; i < m_Locations.Count(); i++ )
    {
        KeyValues *pKey = m_Locations[i]->GetKeyValuesForEditor();
        pKeys->AddSubKey( pKey );
    }
    return pKeys;
}
开发者ID:BenLubar,项目名称:SwarmDirector2,代码行数:26,代码来源:asw_location_grid.cpp

示例2: OnCommand

//-----------------------------------------------------------------------------
// Purpose: handles button commands
//-----------------------------------------------------------------------------
void InputDialog::OnCommand(const char *command)
{
	if (!stricmp(command, "OK"))
	{
		int nTextLength = m_pInput->GetTextLength() + 1;
		char* txt = (char*)_alloca( nTextLength * sizeof(char) );
		m_pInput->GetText( txt, nTextLength );
		KeyValues *kv = new KeyValues( "InputCompleted", "text", txt );
		if ( m_pContextKeyValues )
		{
			kv->AddSubKey( m_pContextKeyValues );
			m_pContextKeyValues = NULL;
		}
		PostActionSignal( kv );
		CloseModal();
	}
	else if (!stricmp(command, "Cancel"))
	{
		KeyValues *kv = new KeyValues( "InputCanceled" );
		if ( m_pContextKeyValues )
		{
			kv->AddSubKey( m_pContextKeyValues );
			m_pContextKeyValues = NULL;
		}
		PostActionSignal( kv );
		CloseModal();
	}
	else
	{
		BaseClass::OnCommand(command);
	}
}
开发者ID:Bubbasacs,项目名称:FinalProj,代码行数:35,代码来源:inputdialog.cpp

示例3: KeyValues

KeyValues *InstantiateRule( const CTilegenMissionPreprocessor *pPreprocessor, const char *pRuleName )
{
	const CTilegenRule *pRule = pPreprocessor->FindRule( pRuleName );
	if ( pRule != NULL )
	{
		KeyValues *pNewKV = new KeyValues( "rule_instance", "name", pRuleName );
		for ( int i = 0; i < pRule->GetParameterCount(); ++ i )
		{
			if ( !pRule->IsParameterOptional( i ) )
			{
				const KeyValues *pDefaultValue = pRule->GetDefaultValue( i );
				KeyValues *pRuleInstanceParameter = new KeyValues( pRule->GetParameterName( i ) );
				if ( pDefaultValue != NULL )
				{
					pRuleInstanceParameter->AddSubKey( pDefaultValue->MakeCopy() );
				}
				else
				{
					pRuleInstanceParameter->SetString( NULL, "<Enter Value>" );
				}
				pNewKV->AddSubKey( pRuleInstanceParameter );
			}
		}
		return pNewKV;
	}
	return NULL;
}
开发者ID:BenLubar,项目名称:SwarmDirector2,代码行数:27,代码来源:rule_instance_node_panel.cpp

示例4: SaveRoomTemplate

bool CRoomTemplate::SaveRoomTemplate()
{
    if (!m_pLevelTheme)
        return false;

    char szThemeDirName[MAX_PATH];
    Q_snprintf(szThemeDirName, sizeof(szThemeDirName), "tilegen/roomtemplates/%s", m_pLevelTheme->m_szName);
    g_pFullFileSystem->CreateDirHierarchy( szThemeDirName, "GAME" );

    char szFullFileName[MAX_PATH];
    Q_snprintf( szFullFileName, sizeof(szFullFileName), "tilegen/roomtemplates/%s/%s.roomtemplate", m_pLevelTheme->m_szName, m_FullName );
    KeyValues *pRoomTemplateKeyValues = new KeyValues( m_FullName );
    pRoomTemplateKeyValues->SetInt( "TilesX", m_nTilesX );
    pRoomTemplateKeyValues->SetInt( "TilesY", m_nTilesY );
    pRoomTemplateKeyValues->SetInt( "SpawnWeight", m_nSpawnWeight );
    pRoomTemplateKeyValues->SetString( "RoomTemplateDescription", m_Description );
    pRoomTemplateKeyValues->SetString( "Soundscape", m_Soundscape );
    pRoomTemplateKeyValues->SetInt( "TileType", m_nTileType );

    // exits
    int iExits = m_Exits.Count();
    for (int i=0; i<iExits; i++)
    {
        KeyValues *pkvSubSection = new KeyValues("EXIT");
        pkvSubSection->SetInt("XPos", m_Exits[i]->m_iXPos);
        pkvSubSection->SetInt("YPos", m_Exits[i]->m_iYPos);
        pkvSubSection->SetInt("ExitDirection", (int) m_Exits[i]->m_ExitDirection);
        pkvSubSection->SetInt("ZChange", m_Exits[i]->m_iZChange);
        pkvSubSection->SetString("ExitTag", m_Exits[i]->m_szExitTag);
        pkvSubSection->SetBool("ChokeGrow", m_Exits[i]->m_bChokepointGrowSource);

        pRoomTemplateKeyValues->AddSubKey(pkvSubSection);
    }

    // tags
    KeyValues *pkvSubSection = new KeyValues("Tags");
    for ( int i=0; i<GetNumTags(); i++ )
    {
        pkvSubSection->AddSubKey( new KeyValues( "tag", NULL, GetTag( i ) ) );
    }
    pRoomTemplateKeyValues->AddSubKey(pkvSubSection);

    if (!pRoomTemplateKeyValues->SaveToFile(g_pFullFileSystem, szFullFileName, "GAME"))
    {
        Msg("Error: Failed to save room template %s\n", szFullFileName);
        return false;
    }
    return true;
}
开发者ID:Cre3per,项目名称:hl2sdk-csgo,代码行数:49,代码来源:RoomTemplate.cpp

示例5: KeyValues

/*
	char *name;
	bool bStatic;
	int min;
	int max;
*/
KeyValues *__AllocKV_Identifiers( IdentifierLists_t *pList )
{
	KeyValues *pIdents = new KeyValues("");

	for ( int i = 0; i < pList->hList_Combos.Count(); i++ )
		pIdents->AddSubKey( __AllocKV_Combo( i, pList->hList_Combos[i] ) );
	for ( int i = 0; i < pList->hList_EConstants.Count(); i++ )
		pIdents->AddSubKey( __AllocKV_EConst( i, pList->hList_EConstants[i] ) );
	for ( int i = 0; i < pList->hList_Textures.Count(); i++ )
		pIdents->AddSubKey( __AllocKV_Texture( i, pList->hList_Textures[i] ) );

	pIdents->SetInt( "i_numdcombos", pList->inum_DynamicCombos );

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

示例6: SaveTime

//Called every time a new time is achieved
void CTimer::SaveTime()
{
    const char *szMapName = gpGlobals->mapname.ToCStr();
    KeyValues *timesKV = new KeyValues(szMapName);
    int count = localTimes.Count();

    for (int i = 0; i < count; i++)
    {
        Time t = localTimes[i];
        char timeName[512];
        Q_snprintf(timeName, 512, "%i", t.ticks);
        KeyValues *pSubkey = new KeyValues(timeName);
        pSubkey->SetFloat("rate", t.tickrate);
        pSubkey->SetInt("date", t.date);
        timesKV->AddSubKey(pSubkey);
    }

    char file[MAX_PATH];
    Q_strcpy(file, c_mapDir);
    Q_strcat(file, szMapName, MAX_PATH);
    Q_strncat(file, c_timesExt, MAX_PATH);

    if (timesKV->SaveToFile(filesystem, file, "MOD", true))
    {
        Log("Successfully saved new time!\n");
        IGameEvent *savedEvent = gameeventmanager->CreateEvent("runtime_saved");
        if (savedEvent)
            gameeventmanager->FireEvent(savedEvent);
    }

    timesKV->deleteThis();
}
开发者ID:kirkelifson,项目名称:game,代码行数:33,代码来源:Timer.cpp

示例7: DeleteSelection

//-----------------------------------------------------------------------------
// Purpose: Delete selected entities/props. 
//-----------------------------------------------------------------------------
void CEditorSystem::DeleteSelection()
{
	if( !IsAnythingSelected() )
		return;

	KeyValues *pOperation = new KeyValues( "data" );
	pOperation->SetString("operation", "deleteflora");

	for( int i = 0; i < m_hSelectedEntities.Count(); i++ )
	{
		if( !m_hSelectedEntities[i] )
			continue;

		CWarsFlora *pFlora = dynamic_cast<CWarsFlora *>( m_hSelectedEntities[i].Get() );
		if( pFlora )
		{
			pOperation->AddSubKey( new KeyValues( "flora", "uuid", pFlora->GetFloraUUID() ) );
			pFlora->Remove();
		}
		else
		{
			m_hSelectedEntities[i]->Remove();
		}
	}

	m_hSelectedEntities.Purge();
	warseditorstorage->QueueClientCommand( pOperation );
}
开发者ID:detoxhby,项目名称:lambdawars,代码行数:31,代码来源:editorsystem.cpp

示例8: OnCommand

//-----------------------------------------------------------------------------
// Process commands
//-----------------------------------------------------------------------------
void CSaveDocumentQuery::OnCommand( char const *cmd )
{
	if ( !Q_stricmp( cmd, "yes" ) )
	{
		KeyValues *kv = new KeyValues( "OnSaveFile" );
		kv->SetString( "filename", m_szFileName );
		kv->SetString( "filetype", m_szFileType );
		kv->SetInt( "context", m_nContext );
		kv->SetPtr( "actionTarget", m_pActionSignalTarget );
		if ( m_pPostSaveKeyValues )
		{
			kv->AddSubKey( m_pPostSaveKeyValues->MakeCopy() );
		}
		vgui::ivgui()->PostMessage( m_pActionSignalTarget->GetVPanel(), kv, 0 );
		MarkForDeletion();
	}
	else if ( !Q_stricmp( cmd, "no" ) )
	{
		PostCommand( "OnMarkNotDirty" );
		if ( m_pPostSaveKeyValues )
		{
			vgui::ivgui()->PostMessage( m_pActionSignalTarget->GetVPanel(), m_pPostSaveKeyValues->MakeCopy(), 0 );
		}
		MarkForDeletion();
	}
	else if ( !Q_stricmp( cmd, "cancel" ) )
	{
		PostCommand( "OnCancelSaveDocument" );
		MarkForDeletion();
	}
	else
	{
		BaseClass::OnCommand( cmd );
	}
}
开发者ID:AluminumKen,项目名称:hl2sb-src,代码行数:38,代码来源:savedocumentquery.cpp

示例9: OnCommand

//-----------------------------------------------------------------------------
// On command
//-----------------------------------------------------------------------------
void CDmeLogEditFrame::OnCommand( const char *pCommand )
{
	if ( !Q_stricmp( pCommand, "Ok" ) )
	{
		KeyValues *pActionKeys = new KeyValues( "LogEdited" );
		if ( m_pContextKeyValues )
		{
			pActionKeys->AddSubKey( m_pContextKeyValues );

			// This prevents them from being deleted later
			m_pContextKeyValues = NULL;
		}

		PostActionSignal( pActionKeys );
		CloseModal();
		return;
	}

	if ( !Q_stricmp( pCommand, "Cancel" ) )
	{
		CloseModal();
		return;
	}

	BaseClass::OnCommand( pCommand );
}
开发者ID:DeadZoneLuna,项目名称:SourceEngine2007,代码行数:29,代码来源:dmelogeditpanel.cpp

示例10: AddFolder

void CRoomTemplateListPanel::AddFolder( const char *pFolderName )
{
	int nNumFolders = m_RoomTemplateFolders.Count();
	for ( int i = 0; i < nNumFolders; ++ i )
	{
		if ( Q_stricmp( pFolderName, m_RoomTemplateFolders[i].m_FolderName ) == 0 )
		{
			// Mark this folder as being used
			m_RoomTemplateFolders[i].m_pFolderButton->SetVisible( true );
			return;
		}
	}

	// New folder, create a new entry
	m_RoomTemplateFolders.AddToTail();
	Q_strncpy( m_RoomTemplateFolders[nNumFolders].m_FolderName, pFolderName, MAX_PATH );
	m_RoomTemplateFolders[nNumFolders].m_bExpanded = true;
	m_RoomTemplateFolders[nNumFolders].m_pFolderButton = new Button( this, "FolderButton", "", this, "ToggleFolder" );
	
	KeyValues *pMessageKV = new KeyValues( "ToggleFolder" );
	KeyValues *pIndexKV = new KeyValues( "folder" );
	pIndexKV->SetString( NULL, m_RoomTemplateFolders[nNumFolders].m_FolderName );
	pMessageKV->AddSubKey( pIndexKV );
	m_RoomTemplateFolders[nNumFolders].m_pFolderButton->SetCommand( pMessageKV );
}
开发者ID:Au-heppa,项目名称:swarm-sdk,代码行数:25,代码来源:RoomTemplateListPanel.cpp

示例11: LoadControlSettings

// Load the control settings 
void CBaseModFrame::LoadControlSettings( const char *dialogResourceName, const char *pathID, KeyValues *pPreloadedKeyValues, KeyValues *pConditions )
{
	// Use the keyvalues they passed in or load them using special hook for flyouts generation
	KeyValues *rDat = pPreloadedKeyValues;
	if ( !rDat )
	{
		// load the resource data from the file
		rDat  = new KeyValues(dialogResourceName);

		// check the skins directory first, if an explicit pathID hasn't been set
		bool bSuccess = false;
		if ( !IsX360() && !pathID )
		{
			bSuccess = rDat->LoadFromFile( g_pFullFileSystem, dialogResourceName, "SKIN" );
		}
		if ( !bSuccess )
		{
			bSuccess = rDat->LoadFromFile( g_pFullFileSystem, dialogResourceName, pathID );
		}
		if ( bSuccess )
		{
			if ( IsX360() )
			{
				rDat->ProcessResolutionKeys( surface()->GetResolutionKey() );
			}
			if ( pConditions && pConditions->GetFirstSubKey() )
			{
				GetBuildGroup()->ProcessConditionalKeys( rDat, pConditions );
			}
		}
	}

	// Find the auto-generated-chapter hook
	if ( KeyValues *pHook = rDat->FindKey( "FlmChapterXXautogenerated" ) )
	{
		const int numMaxAutogeneratedFlyouts = 20;
		for ( int k = 1; k <= numMaxAutogeneratedFlyouts; ++ k )
		{
			KeyValues *pFlyoutInfo = pHook->MakeCopy();
			
			CFmtStr strName( "FlmChapter%d", k );
			pFlyoutInfo->SetName( strName );
			pFlyoutInfo->SetString( "fieldName", strName );
			
			pFlyoutInfo->SetString( "ResourceFile", CFmtStr( "FlmChapterXXautogenerated_%d/%s", k, pHook->GetString( "ResourceFile" ) ) );

			rDat->AddSubKey( pFlyoutInfo );
		}

		rDat->RemoveSubKey( pHook );
		pHook->deleteThis();
	}

	BaseClass::LoadControlSettings( dialogResourceName, pathID, rDat, pConditions );
	if ( rDat != pPreloadedKeyValues )
	{
		rDat->deleteThis();
	}
}
开发者ID:Au-heppa,项目名称:swarm-sdk,代码行数:60,代码来源:basemodframe.cpp

示例12: df_SaveDump_File

/*
	CUtlVector< SimpleTexture* > hList_Textures;
	CUtlVector< SimpleCombo* > hList_Combos;
	CUtlVector< SimpleEnvConstant* > hList_EConstants;
*/
void df_SaveDump_File( const char *canvasname, const BasicShaderCfg_t &shader )
{
	KeyValues *pKV = new KeyValues( canvasname );
	char _path[MAX_PATH];
	Q_snprintf( _path, MAX_PATH, "%s/%s.dump", ::GetDumpDirectory(), canvasname );
	Q_FixSlashes( _path );

	pKV->SetString( "vs_name", shader.ProcVSName );
	pKV->SetString( "ps_name", shader.ProcPSName );
	pKV->SetString( "shader_filename", shader.Filename );
	pKV->SetString( GetDumpVersion_KeyName(), GetDumpVersion_Current() );

	pKV->SetInt( "i_sm", shader.iShaderModel );
	pKV->SetInt( "i_cull", shader.iCullmode );
	pKV->SetInt( "i_ablend", shader.iAlphablendmode );
	pKV->SetFloat( "fl_atestref", shader.flAlphaTestRef );
	pKV->SetInt( "i_dtest", shader.iDepthtestmode );
	pKV->SetInt( "i_dwrite", shader.iDepthwritemode );
	pKV->SetInt( "i_srgbw", shader.bsRGBWrite ? 1 : 0 );
	
	pKV->SetInt( "i_vfmt_flags", shader.iVFMT_flags );
	pKV->SetInt( "i_vfmt_texcoords", shader.iVFMT_numTexcoords );
	pKV->SetInt( "i_vfmt_udata", shader.iVFMT_numUserData );
	for ( int i = 0; i < 3; i++ )
	{
		char tmp[48];
		Q_snprintf( tmp, sizeof(tmp), "i_vfmt_texcoordDim_%i", i );
		pKV->SetInt( tmp, shader.iVFMT_texDim[i] );
	}

	pKV->SetInt( "i_vlit", shader.bVertexLighting );
	pKV->SetInt( "i_vrefract", shader.bRefractionSupport );

	KeyValues *pKVIdentVS = __AllocKV_Identifiers( shader.pVS_Identifiers );
	pKVIdentVS->SetName( "identifiers_VS" );
	pKV->AddSubKey( pKVIdentVS );

	KeyValues *pKVIdentPS = __AllocKV_Identifiers( shader.pPS_Identifiers );
	pKVIdentPS->SetName( "identifiers_PS" );
	pKV->AddSubKey( pKVIdentPS );

	pKV->SaveToFile( g_pFullFileSystem, _path, "MOD" );
	pKV->deleteThis();
}
开发者ID:BSVino,项目名称:source-shader-editor,代码行数:49,代码来源:gshaderdumps.cpp

示例13: 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:InfoSmart,项目名称:InSource-Singleplayer,代码行数:56,代码来源:cdll_util.cpp

示例14: GetDefaultCamera

KeyValues* VMFExporter::GetDefaultCamera()
{
    KeyValues *pKeys = new KeyValues( "cameras" );
    pKeys->SetInt( "activecamera", 0 );

    KeyValues *pSubKeys = new KeyValues( "camera" );
    pSubKeys->SetString( "position", "[135.491 -60.314 364.02]" );
    pSubKeys->SetString( "look", "[141.195 98.7571 151.25]" );
    pKeys->AddSubKey( pSubKeys );

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

示例15: OnRuleDetailsClicked

void CRulePickerDialog::OnRuleDetailsClicked( vgui::Panel *pPanel )
{
	CRuleDetailsPanel *pRuleDetails = dynamic_cast< CRuleDetailsPanel * >( pPanel );
	Assert( pPanel != NULL );

	KeyValues *pNewRuleInstance = InstantiateRule( m_pRulePreprocessor, pRuleDetails->GetRule()->GetName() );
	if ( pNewRuleInstance != NULL )
	{
		KeyValues *pMessage = new KeyValues( "RuleChanged" );
		pMessage->AddSubKey( pNewRuleInstance );
		PostActionSignal( pMessage );
	}
	OnClose();
}
开发者ID:BenLubar,项目名称:SwarmDirector2,代码行数:14,代码来源:rule_instance_node_panel.cpp


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