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


C++ FlyoutMenu::FindChildButtonByCommand方法代码示例

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


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

示例1: Activate


//.........这里部分代码省略.........
	if ( m_sldMusicVolume )
	{
		m_sldMusicVolume->Reset();
	}

	if ( m_drpCaptioning )
	{
		CGameUIConVarRef closecaption("closecaption");
		CGameUIConVarRef cc_subtitles("cc_subtitles");

		if ( !closecaption.GetBool() )
		{
			m_drpCaptioning->SetCurrentSelection( "#L4D360UI_AudioOptions_CaptionOff" );
		}
		else
		{
			if ( cc_subtitles.GetBool() )
			{
				m_drpCaptioning->SetCurrentSelection( "#L4D360UI_AudioOptions_CaptionSubtitles" );
			}
			else
			{
				m_drpCaptioning->SetCurrentSelection( "#L4D360UI_AudioOptions_CaptionOn" );
			}
		}

		FlyoutMenu *pFlyout = m_drpCaptioning->GetCurrentFlyout();
		if ( pFlyout )
		{
			pFlyout->SetListener( this );
		}
	}

	if ( m_drpLanguage )
	{
#if defined( _DEMO )
		// not allowing this for the demo, can't reboot to force english
		bool bIsLocalized = false;
#else
		bool bIsLocalized = XBX_IsAudioLocalized();
#endif
		if ( !bIsLocalized )
		{
			// hidden if we don't have an audio localization for our current non-english language
			// the audio is in english, there is no other choice for their audio
			m_drpLanguage->SetVisible( false );
		}
		else
		{
			// We're in a language other than english that has full audio localization (not all of them do)
			// let them select either their native language or english for thier audio if they're not in game
			m_drpLanguage->SetFlyout( "FlmLanguage" );

			char szLanguage[ 256 ];
			Q_snprintf( szLanguage, sizeof( szLanguage ), "#GameUI_Language_%s", XBX_GetLanguageString() );

			FlyoutMenu *pFlyout = m_drpLanguage->GetCurrentFlyout();
			if ( pFlyout )
			{
				Button *pCurrentLanguageButton = pFlyout->FindChildButtonByCommand( "CurrentXBXLanguage" );

				if ( pCurrentLanguageButton )
				{
					pCurrentLanguageButton->SetText( szLanguage );
					pCurrentLanguageButton->SetCommand( szLanguage );
					pFlyout->SetListener( this );
				}
			}

			m_drpLanguage->SetCurrentSelection( ( x360_audio_english.GetBool() ) ? ( "#GameUI_Language_English" ) : ( szLanguage ) );

			// Can't change language while in game
			m_drpLanguage->SetEnabled( !engine->IsInGame() || GameUI().IsInBackgroundLevel() );
		}
	}
	
	if ( m_drpGore )
	{
		CGameUIConVarRef z_wound_client_disabled ( "z_wound_client_disabled" );

		if ( z_wound_client_disabled.GetBool() )
		{
			m_drpGore->SetCurrentSelection( "#L4D360UI_Gore_Low" );
		}
		else
		{
			m_drpGore->SetCurrentSelection( "#L4D360UI_Gore_High" );
		}

		FlyoutMenu *pFlyout = m_drpGore->GetCurrentFlyout();
		if ( pFlyout )
		{
			pFlyout->SetListener( this );
		}
	}

	m_bDirtyVideoConfig = false;

	UpdateFooter();
}
开发者ID:Au-heppa,项目名称:swarm-sdk,代码行数:101,代码来源:vaudiovideo.cpp

示例2: OnCommand

//=============================================================================
void InGameChapterSelect::OnCommand(const char *command)
{
	if ( const char* szMissionItem = StringAfterPrefix( command, "cmd_campaign_" ) )
	{
		if ( !Q_stricmp( szMissionItem, m_chCampaign ) )
			return;	// Setting to same mission

		Q_strncpy( m_chCampaign, szMissionItem, ARRAYSIZE( m_chCampaign ) );

		// Determine current game settings
		KeyValues *pGameSettings = g_pMatchFramework->GetMatchNetworkMsgController()->GetActiveServerGameDetails( NULL );
		KeyValues::AutoDelete autodelete_pGameSettings( pGameSettings );
		if ( !pGameSettings )
			return;

		DropDownMenu *pMissionDropDown = dynamic_cast< DropDownMenu* >( FindChildByName( "DrpMission" ) );
		if( pMissionDropDown ) //we should become a listener for events pertaining to the mission flyout
		{
			FlyoutMenu* missionFlyout = pMissionDropDown->GetCurrentFlyout();
			if( missionFlyout )
			{
				missionFlyout->SetListener( this );
				if ( vgui::Button *pAddonBtn = missionFlyout->FindChildButtonByCommand( "cmd_addoncampaign" ) )
				{
					pAddonBtn->SetEnabled( false );
				}

				// Disable all other campaigns that cannot be used for a vote
				for ( int k = 0, kNum = missionFlyout->GetChildCount(); k < kNum; ++ k )
				{
					Panel *child = missionFlyout->GetChild( k );
					if ( BaseModHybridButton* button = dynamic_cast< BaseModHybridButton* >( child ) )
					{
						if ( const char* commandValue = button->GetCommand()->GetString( "command", NULL ) )
						{
							if ( char const *szMissionName = StringAfterPrefix( commandValue, "cmd_campaign_" ) )
							{
								pGameSettings->SetString( "game/campaign", szMissionName );
								pGameSettings->SetInt( "game/chapter", 1 );
								if ( !g_pMatchExtSwarm->GetMapInfo( pGameSettings ) )
								{
									button->SetEnabled( false );
								}
							}
						}
					}
				}
			}
		}

	}
	else if ( char const *szChapterSelected = StringAfterPrefix( command, "#L4D360UI_Chapter_" ) )
	{
		m_nChapter = atoi( szChapterSelected );
		UpdateChapterImage( m_chCampaign, m_nChapter );
	}
	else if ( !Q_stricmp( command, "Select" ) )
	{
		KeyValues *pGameSettings = g_pMatchFramework->GetMatchNetworkMsgController()->GetActiveServerGameDetails( NULL );
		KeyValues::AutoDelete autodelete_pGameSettings( pGameSettings );

		if ( !GameModeIsSingleChapter( pGameSettings->GetString( "game/mode" ) ) )
			m_nChapter = 1;

		pGameSettings->SetString( "game/campaign", m_chCampaign );
		pGameSettings->SetInt( "game/chapter", m_nChapter );

		char const *szVoteCommand = "ChangeChapter";

		int iUser = GetGameUIActiveSplitScreenPlayerSlot();
		GAMEUI_ACTIVE_SPLITSCREEN_PLAYER_GUARD( iUser );

		Panel *pDrpChapter = FindChildByName( "DrpChapter" );
		if ( !pDrpChapter || !pDrpChapter->IsEnabled() )
		{
			szVoteCommand = "ChangeMission";
			m_nChapter = 1;

			engine->ClientCmd( CFmtStr( "callvote %s %s;", szVoteCommand, m_chCampaign ) );
		}
		else if ( KeyValues *pInfoMap = g_pMatchExtSwarm->GetMapInfo( pGameSettings ) )
		{
			engine->ClientCmd( CFmtStr( "callvote %s %s;", szVoteCommand, pInfoMap->GetString( "map" ) ) );
		}

		GameUI().AllowEngineHideGameUI();
		engine->ClientCmd( "gameui_hide" );
		Close();
	}	
	else if ( !Q_strcmp( command, "Cancel" ) )
	{
		GameUI().AllowEngineHideGameUI();
		engine->ClientCmd("gameui_hide");
		Close();
	}
}
开发者ID:Au-heppa,项目名称:swarm-sdk,代码行数:97,代码来源:vingamechapterselect.cpp

示例3: Activate


//.........这里部分代码省略.........
			}
		}

		FlyoutMenu *pFlyout = m_drpCaptioning->GetCurrentFlyout();
		if ( pFlyout )
		{
			pFlyout->SetListener( this );
		}
	}

	if ( m_drpLanguage )
	{
		char szCurrentLanguage[50] = "";
		char szAvailableLanguages[512] = "";
		szAvailableLanguages[0] = '\0';

		// Fallback to current engine language
		engine->GetUILanguage( szCurrentLanguage, sizeof( szCurrentLanguage ));

		// In a Steam environment we get the current language 
#if !defined( NO_STEAM )
		// When Steam isn't running we can't get the language info... 
		if ( steamapicontext->SteamApps() )
		{
			Q_strncpy( szCurrentLanguage, steamapicontext->SteamApps()->GetCurrentGameLanguage(), sizeof(szCurrentLanguage) );
			Q_strncpy( szAvailableLanguages, steamapicontext->SteamApps()->GetAvailableGameLanguages(), sizeof(szAvailableLanguages) );
		}
#endif

		// Get the spoken language and store it for comparison purposes
		m_nCurrentAudioLanguage = PchLanguageToELanguage( szCurrentLanguage );

		// Set up the base string for each button command
		char szCurrentButton[ 32 ];
		Q_strncpy( szCurrentButton, VIDEO_LANGUAGE_COMMAND_PREFIX, sizeof( szCurrentButton ) );

		int iCommandNumberPosition = Q_strlen( szCurrentButton );
		szCurrentButton[ iCommandNumberPosition + 1 ] = '\0';

		// Check to see if we have a list of languages from Steam
		if ( szAvailableLanguages[0] != '\0' )
		{
			int iSelectedLanguage = 0;

			FlyoutMenu *pLanguageFlyout = m_drpLanguage->GetCurrentFlyout();

			// Loop through all the languages
			CSplitString languagesList( szAvailableLanguages, "," );

			for ( m_nNumAudioLanguages = 0; m_nNumAudioLanguages < languagesList.Count() && m_nNumAudioLanguages < MAX_DYNAMIC_AUDIO_LANGUAGES; ++m_nNumAudioLanguages )
			{
				szCurrentButton[ iCommandNumberPosition ] = m_nNumAudioLanguages + '0';
				m_nAudioLanguages[ m_nNumAudioLanguages ].languageCode = PchLanguageToELanguage( languagesList[ m_nNumAudioLanguages ] );

				SetFlyoutButtonText( szCurrentButton, pLanguageFlyout, GetLanguageVGUILocalization( m_nAudioLanguages[ m_nNumAudioLanguages ].languageCode ) );

				if ( m_nCurrentAudioLanguage == m_nAudioLanguages[ m_nNumAudioLanguages ].languageCode )
				{
					iSelectedLanguage = m_nNumAudioLanguages;
				}
			}

			// Change the height to fit the active items
			pLanguageFlyout->SetBGTall( m_nNumAudioLanguages * 20 + 5 );

			// Disable the remaining possible choices
			for ( int i = m_nNumAudioLanguages; i < MAX_DYNAMIC_AUDIO_LANGUAGES; ++i )
			{
				szCurrentButton[ iCommandNumberPosition ] = i + '0';

				Button *pButton = pLanguageFlyout->FindChildButtonByCommand( szCurrentButton );
				if ( pButton )
				{
					pButton->SetVisible( false );
				}
			}

			// Set the current selection
			szCurrentButton[ iCommandNumberPosition ] = iSelectedLanguage + '0';

			m_drpLanguage->SetCurrentSelection( szCurrentButton );

			m_nSelectedAudioLanguage = m_nAudioLanguages[ iSelectedLanguage ].languageCode;
		}

		m_drpLanguage->SetVisible( m_nNumAudioLanguages > 1 );
	}



	UpdateFooter( true );

	if ( m_sldGameVolume )
	{
		if ( m_ActiveControl )
			m_ActiveControl->NavigateFrom( );
		m_sldGameVolume->NavigateTo();
		m_ActiveControl = m_sldGameVolume;
	}
}
开发者ID:Muini,项目名称:Nag-asw,代码行数:101,代码来源:vaudio.cpp

示例4: InitLogoList


//.........这里部分代码省略.........
		Q_snprintf( filename, sizeof(filename), MULTIPLAYER_SPRAY_FOLDER "%s", pSprayKey->GetString() );

		if ( g_pFullFileSystem->FileExists( filename, "GAME" ) )
		{
			Q_SetExtension( filename, ".vmt", sizeof( filename ) );

			if ( g_pFullFileSystem->FileExists( filename, "GAME" ) )
			{
				Q_strncpy( filename, pSprayKey->GetString(), sizeof(filename) );

				Q_StripExtension( filename, m_nSpraypaint[ m_nNumSpraypaintLogos ].m_szFilename, sizeof(m_nSpraypaint[ m_nNumSpraypaintLogos ].m_szFilename) );
				m_nSpraypaint[ m_nNumSpraypaintLogos ].m_bCustom = false;

				szCurrentButton[ iCommandNumberPosition ] = m_nNumSpraypaintLogos + '0';
				SetFlyoutButtonText( szCurrentButton, pFlyout, pSprayKey->GetName() );

				// check to see if this is the one we have set
				Q_snprintf( filename, sizeof(filename), MULTIPLAYER_SPRAY_FOLDER "%s", pSprayKey->GetString() );
				if (!Q_stricmp(filename, logofile))
				{
					initialItem = m_nNumSpraypaintLogos;
				}

				++m_nNumSpraypaintLogos;
			}
		}

		pSprayKey = pSprayKey->GetNextKey();
	}

	// Look for custom sprays
	char directory[ MAX_PATH ];
	Q_strncpy( directory, MULTIPLAYER_SPRAY_FOLDER MULTIPLAYER_CUSTOM_SPRAY_FOLDER "*.vtf", sizeof( directory ) );

	FileFindHandle_t fh;
	const char *fn = g_pFullFileSystem->FindFirst( directory, &fh );

	if ( fn )
	{
		char filename[ MAX_PATH ];
		Q_snprintf( filename, sizeof(filename), MULTIPLAYER_SPRAY_FOLDER MULTIPLAYER_CUSTOM_SPRAY_FOLDER "%s", fn );
		Q_SetExtension( filename, ".vmt", sizeof( filename ) );

		if ( g_pFullFileSystem->FileExists( filename, "GAME" ) )
		{
			// Found at least one custom logo
			szCurrentButton[ iCommandNumberPosition ] = m_nNumSpraypaintLogos + '0';
			SetFlyoutButtonText( szCurrentButton, pFlyout, "#L4D360UI_Multiplayer_Cutsom_Logo" );
			m_nSpraypaint[ m_nNumSpraypaintLogos ].m_szFilename[ 0 ] = '\0';
			m_nSpraypaint[ m_nNumSpraypaintLogos ].m_bCustom = true;

			++m_nNumSpraypaintLogos;

			Q_strncpy( filename, logofile, sizeof(filename) );
			Q_StripFilename( filename );
			Q_strncat( filename, "/", sizeof(filename) );

			// If their current spray is one of the custom ones
			if ( Q_stricmp( filename, MULTIPLAYER_SPRAY_FOLDER MULTIPLAYER_CUSTOM_SPRAY_FOLDER ) == 0 )
			{
				// Check if the file exists
				if ( g_pFullFileSystem->FileExists( logofile, "GAME" ) )
				{
					// Check if it has a matching VMT
					Q_strncpy( filename, logofile, sizeof( filename ) );
					Q_SetExtension( filename, ".vmt", sizeof( filename ) );

					if ( g_pFullFileSystem->FileExists( filename, "GAME" ) )
					{
						// Set this custom logo as our initial item
						const char *pchShortName = Q_UnqualifiedFileName( logofile );

						initialItem = m_nNumSpraypaintLogos - 1;
						Q_StripExtension( pchShortName, m_nSpraypaint[ initialItem ].m_szFilename, sizeof(m_nSpraypaint[ initialItem ].m_szFilename) );
					}
				}
			}
		}
	}

	g_pFullFileSystem->FindClose( fh );

	// Change the height to fit the active items
	pFlyout->SetBGTall( m_nNumSpraypaintLogos * 20 + 5 );

	// Disable the remaining possible choices
	for ( int i = m_nNumSpraypaintLogos; i < MAX_SPRAYPAINT_LOGOS; ++i )
	{
		szCurrentButton[ iCommandNumberPosition ] = i + '0';

		Button *pButton = pFlyout->FindChildButtonByCommand( szCurrentButton );
		if ( pButton )
		{
			pButton->SetVisible( false );
		}
	}

	szCurrentButton[ iCommandNumberPosition ] = initialItem + '0';
	m_drpSpraypaint->SetCurrentSelection( szCurrentButton );
}
开发者ID:Randdalf,项目名称:bliink,代码行数:101,代码来源:vmultiplayer.cpp


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