本文整理汇总了C++中FlyoutMenu类的典型用法代码示例。如果您正苦于以下问题:C++ FlyoutMenu类的具体用法?C++ FlyoutMenu怎么用?C++ FlyoutMenu使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了FlyoutMenu类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: UpdateFooterHelpText
void BaseModHybridButton::NavigateTo( )
{
BaseClass::NavigateTo( );
UpdateFooterHelpText();
FlyoutMenu* parentMenu = dynamic_cast< FlyoutMenu* >( GetParent() );
if( parentMenu )
{
parentMenu->NotifyChildFocus( this );
}
if (GetVParent())
{
KeyValues *msg = new KeyValues("OnHybridButtonNavigatedTo");
msg->SetInt("button", ToHandle() );
ivgui()->PostMessage(GetVParent(), msg, GetVPanel());
}
m_isNavigateTo = true;
if ( IsPC() )
{
RequestFocus( 0 );
}
}
示例2: OnSiblingHybridButtonOpened
void BaseModHybridButton::OnSiblingHybridButtonOpened()
{
if ( !IsPC() )
return;
bool bClosed = false;
FlyoutMenu *pActiveFlyout = FlyoutMenu::GetActiveMenu();
if ( pActiveFlyout )
{
BaseModHybridButton *button = dynamic_cast< BaseModHybridButton* >( pActiveFlyout->GetNavFrom() );
if ( button && button == this )
{
// We need to close the flyout attached to this button
FlyoutMenu::CloseActiveMenu();
bClosed = true;
}
}
if ( !bClosed )
{
SetClosed();
}
m_isNavigateTo = false;
}
示例3: GetCurrentFlyout
void DropDownMenu::CloseDropDown()
{
FlyoutMenu* flyout = GetCurrentFlyout();
if ( flyout && flyout->IsVisible() )
{
flyout->CloseMenu( m_pButton );
}
}
示例4: FindChildByName
//=============================================================================
void MainMenu::OnThink()
{
// need to change state of flyout if user suddenly disconnects
// while flyout is open
BaseModUI::FlyoutMenu *flyout = dynamic_cast< FlyoutMenu* >( FindChildByName( "FlmCampaignFlyout" ) );
if ( flyout )
{
BaseModHybridButton *pButton = dynamic_cast< BaseModHybridButton* >( flyout->FindChildButtonByCommand( "QuickMatchCoOp" ) );
if ( pButton )
{
if ( !CUIGameData::Get()->SignedInToLive() )
{
pButton->SetText( "#L4D360UI_QuickStart" );
if ( m_iQuickJoinHelpText != MMQJHT_QUICKSTART )
{
pButton->SetHelpText( "#L4D360UI_QuickMatch_Offline_Tip" );
m_iQuickJoinHelpText = MMQJHT_QUICKSTART;
}
}
else
{
pButton->SetText( "#L4D360UI_QuickMatch" );
if ( m_iQuickJoinHelpText != MMQJHT_QUICKMATCH )
{
pButton->SetHelpText( "#L4D360UI_QuickMatch_Tip" );
m_iQuickJoinHelpText = MMQJHT_QUICKMATCH;
}
}
}
}
if ( IsPC() )
{
FlyoutMenu *pFlyout = dynamic_cast< FlyoutMenu* >( FindChildByName( "FlmOptionsFlyout" ) );
if ( pFlyout )
{
const MaterialSystem_Config_t &config = materials->GetCurrentConfigForVideoCard();
pFlyout->SetControlEnabled( "BtnBrightness", !config.Windowed() );
}
}
BaseClass::OnThink();
}
示例5: cl_cloud_settings
//=============================================================================
void Cloud::Activate()
{
BaseClass::Activate();
if ( m_drpCloud )
{
CGameUIConVarRef cl_cloud_settings( "cl_cloud_settings" );
int iCloudSettings = cl_cloud_settings.GetInt();
if ( iCloudSettings == -1 || iCloudSettings != 0 )
{
m_bCloudEnabled = true;
m_drpCloud->SetCurrentSelection( "SteamCloudEnabled" );
}
else
{
m_bCloudEnabled = false;
m_drpCloud->SetCurrentSelection( "SteamCloudDisabled" );
}
FlyoutMenu *pFlyout = m_drpCloud->GetCurrentFlyout();
if ( pFlyout )
{
pFlyout->SetListener( this );
}
}
UpdateFooter();
if ( m_drpCloud )
{
if ( m_ActiveControl )
{
m_ActiveControl->NavigateFrom( );
}
m_drpCloud->NavigateTo();
m_ActiveControl = m_drpCloud;
}
}
示例6: Msg
//=============================================================================
void MainMenu::ApplySchemeSettings( IScheme *pScheme )
{
BaseClass::ApplySchemeSettings( pScheme );
const char *pSettings = "Resource/UI/BaseModUI/MainMenu.res";
#if !defined( _X360 )
if ( !g_pMatchFramework->GetMatchSystem() )
{
Msg( "BAD!\n" );
}
if ( !g_pMatchFramework->GetMatchSystem()->GetPlayerManager() )
{
Msg( "BAD PLAYER MANAGER!\n" );
}
if ( !g_pMatchFramework->GetMatchSystem()->GetPlayerManager()->GetLocalPlayer( 0 ) )
{
pSettings = "Resource/UI/BaseModUI/MainMenuStub.res";
}
#endif
LoadControlSettings( pSettings );
BaseModHybridButton *button = dynamic_cast< BaseModHybridButton* >( FindChildByName( "BtnPlaySolo" ) );
if ( button )
{
#ifdef _X360
button->SetText( ( XBX_GetNumGameUsers() > 1 ) ? ( "#L4D360UI_MainMenu_PlaySplitscreen" ) : ( "#L4D360UI_MainMenu_PlaySolo" ) );
button->SetHelpText( ( XBX_GetNumGameUsers() > 1 ) ? ( "#L4D360UI_MainMenu_OfflineCoOp_Tip" ) : ( "#L4D360UI_MainMenu_PlaySolo_Tip" ) );
#endif
}
#ifdef _X360
if ( !XBX_GetPrimaryUserIsGuest() )
{
wchar_t wszListText[ 128 ];
wchar_t wszPlayerName[ 128 ];
IPlayer *player1 = NULL;
if ( XBX_GetNumGameUsers() > 0 )
{
player1 = g_pMatchFramework->GetMatchSystem()->GetPlayerManager()->GetLocalPlayer( XBX_GetUserId( 0 ) );
}
IPlayer *player2 = NULL;
if ( XBX_GetNumGameUsers() > 1 )
{
player2 = g_pMatchFramework->GetMatchSystem()->GetPlayerManager()->GetLocalPlayer( XBX_GetUserId( 1 ) );
}
if ( player1 )
{
Label *pLblPlayer1GamerTag = dynamic_cast< Label* >( FindChildByName( "LblPlayer1GamerTag" ) );
if ( pLblPlayer1GamerTag )
{
g_pVGuiLocalize->ConvertANSIToUnicode( player1->GetName(), wszPlayerName, sizeof( wszPlayerName ) );
g_pVGuiLocalize->ConstructString( wszListText, sizeof( wszListText ), g_pVGuiLocalize->Find( "#L4D360UI_MainMenu_LocalProfilePlayer1" ), 1, wszPlayerName );
pLblPlayer1GamerTag->SetVisible( true );
pLblPlayer1GamerTag->SetText( wszListText );
}
}
if ( player2 )
{
Label *pLblPlayer2GamerTag = dynamic_cast< Label* >( FindChildByName( "LblPlayer2GamerTag" ) );
if ( pLblPlayer2GamerTag )
{
g_pVGuiLocalize->ConvertANSIToUnicode( player2->GetName(), wszPlayerName, sizeof( wszPlayerName ) );
g_pVGuiLocalize->ConstructString( wszListText, sizeof( wszListText ), g_pVGuiLocalize->Find( "#L4D360UI_MainMenu_LocalProfilePlayer2" ), 1, wszPlayerName );
pLblPlayer2GamerTag->SetVisible( true );
pLblPlayer2GamerTag->SetText( wszListText );
// in split screen, have player2 gamer tag instead of enable, and disable
SetControlVisible( "LblPlayer2DisableIcon", true );
SetControlVisible( "LblPlayer2Disable", true );
SetControlVisible( "LblPlayer2Enable", false );
}
}
else
{
SetControlVisible( "LblPlayer2DisableIcon", false );
SetControlVisible( "LblPlayer2Disable", false );
// not in split screen, no player2 gamertag, instead have enable
SetControlVisible( "LblPlayer2GamerTag", false );
SetControlVisible( "LblPlayer2Enable", true );
}
}
#endif
if ( IsPC() )
{
FlyoutMenu *pFlyout = dynamic_cast< FlyoutMenu* >( FindChildByName( "FlmOptionsFlyout" ) );
if ( pFlyout )
{
bool bUsesCloud = false;
//.........这里部分代码省略.........
示例7: mat_xbox_ishidef
//=============================================================================
void AudioVideo::Activate()
{
BaseClass::Activate();
#ifdef _X360
CGameUIConVarRef mat_xbox_ishidef( "mat_xbox_ishidef" );
CGameUIConVarRef mat_xbox_iswidescreen( "mat_xbox_iswidescreen" );
#endif
if ( m_sldBrightness )
{
m_sldBrightness->Reset();
m_sldBrightness->NavigateTo();
}
if ( m_drpColorMode )
{
CGameUIConVarRef mat_monitorgamma_tv_enabled( "mat_monitorgamma_tv_enabled" );
if ( mat_monitorgamma_tv_enabled.GetBool() )
{
m_drpColorMode->SetCurrentSelection( "#L4D360UI_ColorMode_Television" );
}
else
{
m_drpColorMode->SetCurrentSelection( "#L4D360UI_ColorMode_LCD" );
}
FlyoutMenu *pFlyout = m_drpColorMode->GetCurrentFlyout();
if ( pFlyout )
{
pFlyout->SetListener( this );
}
}
if ( m_sldFilmGrain )
{
m_sldFilmGrain->Reset();
#ifdef _X360
if ( !mat_xbox_ishidef.GetBool() )
{
m_sldFilmGrain->SetEnabled( false );
}
#endif
}
if ( m_drpSplitScreenDirection )
{
bool bWidescreen = false;
#ifdef _X360
bWidescreen = mat_xbox_iswidescreen.GetBool();
#endif
if ( !bWidescreen )
{
m_drpSplitScreenDirection->SetEnabled( false );
m_drpSplitScreenDirection->SetCurrentSelection( "#L4D360UI_SplitScreenDirection_Horizontal" );
}
else
{
CGameUIConVarRef ss_splitmode( "ss_splitmode" );
int iSplitMode = ss_splitmode.GetInt();
switch ( iSplitMode )
{
case 1:
m_drpSplitScreenDirection->SetCurrentSelection( "#L4D360UI_SplitScreenDirection_Horizontal" );
break;
case 2:
m_drpSplitScreenDirection->SetCurrentSelection( "#L4D360UI_SplitScreenDirection_Vertical" );
break;
default:
m_drpSplitScreenDirection->SetCurrentSelection( "#L4D360UI_SplitScreenDirection_Default" );
}
}
FlyoutMenu *pFlyout = m_drpSplitScreenDirection->GetCurrentFlyout();
if ( pFlyout )
{
pFlyout->SetListener( this );
}
}
if ( m_sldGameVolume )
{
m_sldGameVolume->Reset();
}
if ( m_sldMusicVolume )
{
m_sldMusicVolume->Reset();
}
if ( m_drpCaptioning )
{
CGameUIConVarRef closecaption("closecaption");
CGameUIConVarRef cc_subtitles("cc_subtitles");
//.........这里部分代码省略.........
示例8: SetPaintBackgroundEnabled
//=============================================================================
void InGameChapterSelect::ApplySchemeSettings(vgui::IScheme *pScheme)
{
BaseClass::ApplySchemeSettings(pScheme);
SetPaintBackgroundEnabled( true );
// Determine current game settings
KeyValues *pGameSettings = g_pMatchFramework->GetMatchNetworkMsgController()->GetActiveServerGameDetails( NULL );
KeyValues::AutoDelete autodelete_pGameSettings( pGameSettings );
char const *szGameMode = pGameSettings->GetString( "game/mode", "campaign" );
if ( !GameModeIsSingleChapter( szGameMode ) )
pGameSettings->SetInt( "game/chapter", 1 );
// Get mission and campaign info
KeyValues *pInfoMission = NULL;
KeyValues *pInfoChapter = g_pMatchExtSwarm->GetMapInfo( pGameSettings, &pInfoMission );
// Check if this is a custom mission?
if ( pInfoMission && !pInfoMission->GetBool( "builtin" ) )
pInfoChapter = pInfoMission = NULL; // trigger to use another builtin mission
if ( !pInfoMission || !pInfoChapter )
{
KeyValues *pAllMissions = g_pMatchExtSwarm->GetAllMissions();
for ( pInfoMission = pAllMissions ? pAllMissions->GetFirstTrueSubKey() : NULL;
pInfoMission; pInfoMission = pInfoMission->GetNextTrueSubKey() )
{
if ( !pInfoMission->GetBool( "builtin" ) )
continue;
pInfoChapter = pInfoMission->FindKey( CFmtStr( "modes/%s/1", szGameMode ) );
if ( pInfoChapter )
break;
}
}
Assert( pInfoMission && pInfoChapter );
// set the dropdowns
DropDownMenu *pMissionDropDown = dynamic_cast< DropDownMenu* >( FindChildByName( "DrpMission" ) );
DropDownMenu *pChapterDropDown = dynamic_cast< DropDownMenu* >( FindChildByName( "DrpChapter" ) );
if( pMissionDropDown && pChapterDropDown ) //missions change what the available campaigns are, we should listen on that flyout as well
{
pMissionDropDown->SetFlyout( CFmtStr( "FlmMission%s", szGameMode ) );
if ( pInfoMission && pInfoChapter )
{
pMissionDropDown->SetCurrentSelection( CFmtStr( "cmd_campaign_%s", pInfoMission->GetString( "name" ) ) );
Q_strncpy( m_chCampaign, pInfoMission->GetString( "name" ), ARRAYSIZE( m_chCampaign ) );
// Set this after setting the mission dropdown, as that will default the chapter to the first in the campaign
pChapterDropDown->SetCurrentSelection( CFmtStr( "#L4D360UI_Chapter_%d", pInfoChapter->GetInt( "chapter" ) ) );
m_nChapter = pInfoChapter->GetInt( "chapter" );
}
FlyoutMenu *flyout = pMissionDropDown->GetCurrentFlyout();
if( flyout )
{
flyout->CloseMenu( NULL );
}
flyout = pChapterDropDown->GetCurrentFlyout();
if( flyout )
{
flyout->CloseMenu( NULL );
}
if ( m_ActiveControl )
{
m_ActiveControl->NavigateFrom( );
}
pMissionDropDown->NavigateTo();
m_ActiveControl = pMissionDropDown;
// Chapters are directly selectable only in some game modes
pChapterDropDown->SetEnabled( GameModeIsSingleChapter( szGameMode ) );
}
SetPaintBackgroundEnabled( true );
SetupAsDialogStyle();
}
示例9: InitLogoList
void Multiplayer::InitLogoList()
{
if ( !m_drpSpraypaint )
{
return;
}
FlyoutMenu *pFlyout = m_drpSpraypaint->GetCurrentFlyout();
char szCurrentButton[ 32 ];
Q_strncpy( szCurrentButton, MULTIPLAYER_SPRAYPAINT_COMMAND_PREFIX, sizeof( szCurrentButton ) );
int iCommandNumberPosition = Q_strlen( szCurrentButton );
szCurrentButton[ iCommandNumberPosition + 1 ] = '\0';
// Find our logos
int initialItem = 0;
CGameUIConVarRef cl_logofile( "cl_logofile", true );
if ( !cl_logofile.IsValid() )
return;
const char *logofile = cl_logofile.GetString();
m_nNumSpraypaintLogos = 0;
KeyValues *pSpraysManifest = new KeyValues( "sprays_manifest" );
KeyValues::AutoDelete autoDelete( pSpraysManifest );
pSpraysManifest->LoadFromFile( g_pFullFileSystem, "scripts/sprays_manifest.txt", NULL );
KeyValues *pSprayKey = pSpraysManifest->GetFirstSubKey();
while ( m_nNumSpraypaintLogos < MAX_SPRAYPAINT_LOGOS - 1 && pSprayKey )
{
char filename[ MAX_PATH ];
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
//.........这里部分代码省略.........
示例10: surface
//=============================================================================
void MainMenu::ApplySchemeSettings( IScheme *pScheme )
{
BaseClass::ApplySchemeSettings( pScheme );
int screenWide, screenTall;
surface()->GetScreenSize( screenWide, screenTall );
float aspectRatio = (float)screenWide/(float)screenTall;
bool bIsWidescreen = aspectRatio >= 1.5999f;
DevMsg("Aspect Ratio: %f\n", aspectRatio);
const char *pSettings = "Resource/UI/BaseModUI/MainMenu.res";
if ( bIsWidescreen )
{
// use the widescreen version
pSettings = "Resource/UI/BaseModUI/MainMenu_widescreen.res";
Msg("Using widescreen scheme scheme file: %s\n", pSettings);
}
else
{
DevMsg("Using non-widescreen scheme file: %s\n", pSettings);
}
LoadControlSettings( pSettings );
/* BaseModHybridButton *button = dynamic_cast< BaseModHybridButton* >( FindChildByName( "BtnPlaySolo" ) );
if ( button )
{
}*/
if ( IsPC() )
{
FlyoutMenu *pFlyout = dynamic_cast< FlyoutMenu* >( FindChildByName( "FlmOptionsFlyout" ) );
if ( pFlyout )
{
bool bUsesCloud = false;
#ifdef IS_WINDOWS_PC
ISteamRemoteStorage *pRemoteStorage = SteamClient()?(ISteamRemoteStorage *)SteamClient()->GetISteamGenericInterface(
SteamAPI_GetHSteamUser(), SteamAPI_GetHSteamPipe(), STEAMREMOTESTORAGE_INTERFACE_VERSION ):NULL;
#else
ISteamRemoteStorage *pRemoteStorage = NULL;
AssertMsg( false, "This branch run on a PC build without IS_WINDOWS_PC defined." );
#endif
int32 availableBytes, totalBytes = 0;
if ( pRemoteStorage && pRemoteStorage->GetQuota( &totalBytes, &availableBytes ) )
{
if ( totalBytes > 0 )
{
bUsesCloud = true;
}
}
pFlyout->SetControlEnabled( "BtnCloud", bUsesCloud );
}
}
SetFooterState();
if ( IsPC() )
{
vgui::Panel *firstPanel = FindChildByName( "BtnCoOp" );
if ( firstPanel )
{
if ( m_ActiveControl )
{
m_ActiveControl->NavigateFrom( );
}
firstPanel->NavigateTo();
}
}
}
示例11: GetGameUIActiveSplitScreenPlayerSlot
void InGameMainMenu::OnThink()
{
int iSlot = GetGameUIActiveSplitScreenPlayerSlot();
GAMEUI_ACTIVE_SPLITSCREEN_PLAYER_GUARD( iSlot );
{
BaseModHybridButton *button = dynamic_cast< BaseModHybridButton* >( FindChildByName( "BtnOptions" ) );
if ( button )
{
BaseModUI::FlyoutMenu *flyout = dynamic_cast< FlyoutMenu* >( FindChildByName( "FlmOptionsFlyout" ) );
if ( flyout )
{
#ifdef _X360
bool bIsSplitscreen = ( XBX_GetNumGameUsers() > 1 );
#else
bool bIsSplitscreen = false;
#endif
Button *pButton = flyout->FindChildButtonByCommand( "EnableSplitscreen" );
if ( pButton )
{
pButton->SetVisible( !bIsSplitscreen );
}
pButton = flyout->FindChildButtonByCommand( "DisableSplitscreen" );
if ( pButton )
{
pButton->SetVisible( bIsSplitscreen );
}
}
}
}
if ( IsPC() )
{
FlyoutMenu *pFlyout = dynamic_cast< FlyoutMenu* >( FindChildByName( "FlmOptionsFlyout" ) );
if ( pFlyout )
{
const MaterialSystem_Config_t &config = materials->GetCurrentConfigForVideoCard();
pFlyout->SetControlEnabled( "BtnBrightness", !config.Windowed() );
}
}
BaseClass::OnThink();
if ( IsVisible() )
{
// Yield to generic wait screen or message box if one of those is present
WINDOW_TYPE arrYield[] = { WT_GENERICWAITSCREEN, WT_GENERICCONFIRMATION };
for ( int j = 0; j < ARRAYSIZE( arrYield ); ++ j )
{
CBaseModFrame *pYield = CBaseModPanel::GetSingleton().GetWindow( arrYield[j] );
if ( pYield && pYield->IsVisible() && !pYield->HasFocus() )
{
pYield->Activate();
pYield->RequestFocus();
}
}
}
}
示例12: GetScheme
//.........这里部分代码省略.........
break;
case Focus:
// active item
col.SetColor( 255, 255, 255, 255 );
bDrawGlow = true;
bAnimateGlow = true;
if ( m_nStyle == BUTTON_SIMPLE ||
m_nStyle == BUTTON_DROPDOWN ||
m_nStyle == BUTTON_DIALOG ||
m_nStyle == BUTTON_RED )
{
bDrawCursor = true;
}
break;
}
wchar_t szUnicode[512];
GetText( szUnicode, sizeof( szUnicode ) );
int len = V_wcslen( szUnicode );
int textWide, textTall;
surface()->GetTextSize( m_hTextFont, szUnicode, textWide, textTall );
textWide = clamp( textWide, 0, wide - m_textInsetX * 2 );
textTall = clamp( textTall, 0, tall - m_textInsetX * 2 );
int textInsetX = m_textInsetX;
if ( m_nStyle == BUTTON_DIALOG )
{
// dialog buttons are centered
textInsetX = ( wide - textWide ) / 2;
}
if ( FlyoutMenu::GetActiveMenu() && FlyoutMenu::GetActiveMenu()->GetNavFrom() != this )
{
bDrawCursor = false;
}
if ( bDrawCursor )
{
// draw backing rectangle
if ( curState == Open )
{
surface()->DrawSetColor( Color( 0, 0, 0, 255 ) );
surface()->DrawFilledRectFade( x, y, x+wide, y+tall, 0, 255, true );
}
// draw blotch
surface()->DrawSetColor( blotchColor );
if ( m_nStyle == BUTTON_DIALOG )
{
int blotchWide = textWide;
int blotchX = x + textInsetX;
surface()->DrawFilledRectFade( blotchX, y, blotchX + 0.50f * blotchWide, y+tall, 0, 150, true );
surface()->DrawFilledRectFade( blotchX + 0.50f * blotchWide, y, blotchX + blotchWide, y+tall, 150, 0, true );
}
else
{
int blotchWide = textWide + vgui::scheme()->GetProportionalScaledValueEx( GetScheme(), 40 );
int blotchX = x + textInsetX;
surface()->DrawFilledRectFade( blotchX, y, blotchX + 0.25f * blotchWide, y+tall, 0, 150, true );
surface()->DrawFilledRectFade( blotchX + 0.25f * blotchWide, y, blotchX + blotchWide, y+tall, 150, 0, true );
}
// draw border lines
surface()->DrawSetColor( borderColor );
示例13: snd_surround_speakers
//=============================================================================
void Audio::Activate()
{
BaseClass::Activate();
if ( m_sldGameVolume )
{
m_sldGameVolume->Reset();
}
if ( m_sldMusicVolume )
{
m_sldMusicVolume->Reset();
}
if ( m_drpSpeakerConfiguration )
{
CGameUIConVarRef snd_surround_speakers("Snd_Surround_Speakers");
switch ( snd_surround_speakers.GetInt() )
{
case 2:
m_drpSpeakerConfiguration->SetCurrentSelection( "#GameUI_2Speakers" );
break;
case 4:
m_drpSpeakerConfiguration->SetCurrentSelection( "#GameUI_4Speakers" );
break;
case 5:
m_drpSpeakerConfiguration->SetCurrentSelection( "#GameUI_5Speakers" );
break;
case 0:
default:
m_drpSpeakerConfiguration->SetCurrentSelection( "#GameUI_Headphones" );
break;
}
FlyoutMenu *pFlyout = m_drpSpeakerConfiguration->GetCurrentFlyout();
if ( pFlyout )
{
pFlyout->SetListener( this );
}
}
if ( m_drpSoundQuality )
{
CGameUIConVarRef Snd_PitchQuality("Snd_PitchQuality");
CGameUIConVarRef dsp_slow_cpu("dsp_slow_cpu");
int quality = 0;
if ( dsp_slow_cpu.GetBool() == false )
{
quality = 1;
}
if ( Snd_PitchQuality.GetBool() )
{
quality = 2;
}
switch ( quality )
{
case 1:
m_drpSoundQuality->SetCurrentSelection( "#GameUI_Medium" );
break;
case 2:
m_drpSoundQuality->SetCurrentSelection( "#GameUI_High" );
break;
case 0:
default:
m_drpSoundQuality->SetCurrentSelection( "#GameUI_Low" );
break;
}
FlyoutMenu *pFlyout = m_drpSoundQuality->GetCurrentFlyout();
if ( pFlyout )
{
pFlyout->SetListener( this );
}
}
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" );
}
}
//.........这里部分代码省略.........
示例14: joy_cfg_preset
//=============================================================================
void ControllerOptions::ResetControlValues( void )
{
// labels for button config and stick config
CGameUIConVarRef joy_cfg_preset( "joy_cfg_preset" );
int iButtonSetting = clamp( joy_cfg_preset.GetInt(), 0, 3 );
if ( m_pEditButtons )
{
m_pEditButtons->SetDropdownSelection( pszButtonSettingsDisplayName[iButtonSetting] );
}
CGameUIConVarRef joy_movement_stick("joy_movement_stick");
int iStickSetting = ( joy_movement_stick.GetInt() > 0 ) ? 1 : 0;
if ( m_pEditSticks )
{
static CGameUIConVarRef s_joy_legacy( "joy_legacy" );
if ( s_joy_legacy.IsValid() && s_joy_legacy.GetBool() )
{
iStickSetting += 2; // Go to the legacy version of the default/southpaw string.
}
m_pEditSticks->SetDropdownSelection( pszStickSettingsDisplayName[iStickSetting] );
}
if( m_pVerticalSensitivity )
{
m_pVerticalSensitivity->Reset();
}
if( m_pHorizontalSensitivity )
{
m_pHorizontalSensitivity->Reset();
}
if( m_pLookType )
{
m_pLookType->SetFlyout( "FlmLookType" );
CGameUIConVarRef joy_inverty("joy_inverty");
int iInvert = ( joy_inverty.GetInt() > 0 ) ? CONTROLLER_LOOK_TYPE_INVERTED : CONTROLLER_LOOK_TYPE_NORMAL;
m_pLookType->SetCurrentSelection( pszLookTypes[iInvert] );
FlyoutMenu *pFlyout = m_pLookType->GetCurrentFlyout();
if ( pFlyout )
{
pFlyout->SetListener( this );
}
}
if( m_pDuckMode )
{
m_pDuckMode->SetFlyout( "FlmDuckMode" );
CGameUIConVarRef option_duck_method("option_duck_method");
int iDuckMode = ( option_duck_method.GetInt() > 0 ) ? DUCK_MODE_TOGGLE : DUCK_MODE_HOLD;
m_pDuckMode->SetCurrentSelection( pszDuckModes[iDuckMode] );
FlyoutMenu *pFlyout = m_pDuckMode->GetCurrentFlyout();
if ( pFlyout )
{
pFlyout->SetListener( this );
}
}
}
示例15: Q_strncpy
//=============================================================================
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();
}
}