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


C++ TextEntry::SetVisible方法代码示例

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


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

示例1: OnCommand

//=============================================================================
void Multiplayer::OnCommand(const char *command)
{
	if( Q_stricmp( "#GameUI_Headphones", command ) == 0 )
	{
		CGameUIConVarRef snd_surround_speakers("Snd_Surround_Speakers");
		snd_surround_speakers.SetValue( "0" );
	}
	
	else if ( char const *sz = StringAfterPrefix( command, "#GameUI_DownloadFilter_" ) )
	{
		CGameUIConVarRef  cl_downloadfilter( "cl_downloadfilter" );
		cl_downloadfilter.SetValue( sz );
	}
	else if ( char const *sz = StringAfterPrefix( command, "ColorBlind" ) )
	{
		CGameUIConVarRef cl_colorblind( "cl_colorblind" );
		cl_colorblind.SetValue( sz );
	}
	else if ( char const *sz = StringAfterPrefix( command, "GameInstructor" ) )
	{
		CGameUIConVarRef gameinstructor_enable( "gameinstructor_enable" );
		gameinstructor_enable.SetValue( !Q_stricmp( sz, "Enabled" ) );
	}
	else if ( char const *sz = StringAfterPrefix( command, "AllowFreeLook" ) )
	{
		CGameUIConVarRef spec_allowroaming( "spec_allowroaming" );
		spec_allowroaming.SetValue( !Q_stricmp( sz, "Enabled" ) );
	}
	else if ( char const *sz = StringAfterPrefix( command, "MpLanGames" ) )
	{
		CGameUIConVarRef net_allow_multicast( "net_allow_multicast" );
		net_allow_multicast.SetValue( !Q_stricmp( sz, "Enabled" ) );
	}

	else if ( StringHasPrefix( command, "_spraypaint" ) )
	{
		int iCommandNumberPosition = Q_strlen( MULTIPLAYER_SPRAYPAINT_COMMAND_PREFIX );
		int iLogo = clamp( command[ iCommandNumberPosition ] - '0', 0, m_nNumSpraypaintLogos - 1 );

		if ( m_nSpraypaint[ iLogo ].m_bCustom && m_nSpraypaint[ iLogo ].m_szFilename[ 0 ] == '\0' )
		{
			// Select a file from the custom directory!
			if ( m_hSelectSprayDialog )
			{
				// Always start fresh so the directory refreshes
				m_hSelectSprayDialog->DeletePanel();
				m_hSelectSprayDialog = NULL;
			}

			m_hSelectSprayDialog = new FileOpenDialog(this, "#L4D360UI_Multiplayer_Cutsom_Logo", true);
			m_hSelectSprayDialog->SetProportional( false );
			m_hSelectSprayDialog->SetDeleteSelfOnClose( false );
			m_hSelectSprayDialog->AddFilter("*.vtf", "*.vtf", true);
			m_hSelectSprayDialog->AddActionSignalTarget(this);

			char szCustomSprayDir[ MAX_PATH ];
			Q_snprintf( szCustomSprayDir, sizeof( szCustomSprayDir ), "%s/" MULTIPLAYER_SPRAY_FOLDER MULTIPLAYER_CUSTOM_SPRAY_FOLDER, engine->GetGameDirectory() );
			m_hSelectSprayDialog->SetStartDirectoryContext( "SelectCustomLogo", szCustomSprayDir );

			m_hSelectSprayDialog->DoModal(false);
			m_hSelectSprayDialog->Activate();

			// Hide directory buttons
			m_hSelectSprayDialog->SetControlVisible( "FolderUpButton", false );
			m_hSelectSprayDialog->SetControlVisible( "NewFolderButton", false );
			m_hSelectSprayDialog->SetControlVisible( "OpenInExplorerButton", false );
			m_hSelectSprayDialog->SetControlVisible( "LookInLabel", false );
			m_hSelectSprayDialog->SetControlVisible( "FullPathEdit", false );
			m_hSelectSprayDialog->SetControlVisible( "FileNameLabel", false );

			for ( int i = 0; i < m_hSelectSprayDialog->GetChildCount(); ++i )
			{
				// Need to hide text entry box so they can't manually type ".." and go back a dir
				TextEntry *pTextEntry = dynamic_cast<TextEntry*>( m_hSelectSprayDialog->GetChild( i ) );

				if ( pTextEntry && !dynamic_cast<ComboBox*>( pTextEntry ) )
				{
					pTextEntry->SetVisible( false );
				}
			}
		}
		else
		{
			char *pchCustomPath = ( ( m_nSpraypaint[ iLogo ].m_bCustom ) ? ( MULTIPLAYER_CUSTOM_SPRAY_FOLDER ) : ( "" ) );

			char rootFilename[MAX_PATH];
			Q_snprintf( rootFilename, sizeof(rootFilename), MULTIPLAYER_SPRAY_FOLDER "%s%s.vtf", pchCustomPath, m_nSpraypaint[ iLogo ].m_szFilename );

			CGameUIConVarRef cl_logofile( "cl_logofile", true );
			cl_logofile.SetValue( rootFilename );

			RemapLogo( m_nSpraypaint[ iLogo ].m_szFilename, m_pSprayLogo, pchCustomPath );

			// Clear out the custom image's filename so they will be forced to reselect
			for ( int i = 0; i < MAX_SPRAYPAINT_LOGOS; ++i )
			{
				if ( m_nSpraypaint[ iLogo ].m_bCustom )
				{
					m_nSpraypaint[ iLogo ].m_szFilename[ 0 ] = '\0';
//.........这里部分代码省略.........
开发者ID:Randdalf,项目名称:bliink,代码行数:101,代码来源:vmultiplayer.cpp


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