//============================================================================= void InGameMainMenu::ApplySchemeSettings( vgui::IScheme *pScheme ) { BaseClass::ApplySchemeSettings( pScheme ); // We cant remove button and resize flyout menu from code, but we can use another .res file for base menu. #ifdef UI_USING_GAMEPLAYCONFIGDIALOG if ( demo_ui_enable.GetString()[0] ) { LoadControlSettings( CFmtStr( "Resource/UI/BaseModUI/InGameMainMenu_%s.res", demo_ui_enable.GetString() ) ); } else { LoadControlSettings( "Resource/UI/BaseModUI/InGameMainMenu.res" ); } #else // all that "demoui" stuff confuse me [str] const char *pSettings = "Resource/UI/BaseModUI/InGameMainMenu_NoGameplay.res"; #endif BaseModHybridButton *button = dynamic_cast< BaseModHybridButton* >( FindChildByName( "BtnDeveloperCommentaries" ) ); if ( button ) { #ifdef UI_USING_DEVCOMMENTARIES button->SetEnabled( true ); // we're not just removing button, because of ASWUI flyout system [str] // thought: maybe just use different control setting #endif } SetPaintBackgroundEnabled( true ); SetFooterState(); }
//============================================================================= void InGameDifficultySelect::LoadLayout() { BaseClass::LoadLayout(); CGameUIConVarRef z_difficulty("z_difficulty"); if ( z_difficulty.IsValid() ) { // set a label that tells us what the current difficulty is char chBuffer[64]; Q_snprintf( chBuffer, ARRAYSIZE( chBuffer ), "#L4D360UI_Difficulty_%s", z_difficulty.GetString() ); const char *pszDifficultyLoc = chBuffer; wchar_t *pwcDifficulty = g_pVGuiLocalize->Find( pszDifficultyLoc ); if ( pwcDifficulty ) { wchar_t szWideBuff[200]; g_pVGuiLocalize->ConstructString( szWideBuff, sizeof( szWideBuff ), g_pVGuiLocalize->Find( "#L4D360UI_GameSettings_Current_Difficulty" ), 1, pwcDifficulty ); SetControlString( "LblCurrentDifficulty", szWideBuff ); } // Disable the current difficulty's button, and navigate to it. BaseModHybridButton *pButton = dynamic_cast< BaseModHybridButton* >( FindChildByName( VarArgs( "Btn%s", z_difficulty.GetString() ) ) ); if ( pButton ) { pButton->SetEnabled( false ); pButton->NavigateTo(); } } }
void Demo_DisableButton( Button *pButton ) { BaseModHybridButton *pHybridButton = dynamic_cast<BaseModHybridButton *>(pButton); if (pHybridButton) { pHybridButton->SetEnabled( false ); char szTooltip[512]; wchar_t *wUnicode = g_pVGuiLocalize->Find( "#L4D360UI_MainMenu_DemoVersion" ); if ( !wUnicode ) wUnicode = L""; g_pVGuiLocalize->ConvertUnicodeToANSI( wUnicode, szTooltip, sizeof( szTooltip ) ); pHybridButton->SetHelpText( szTooltip , false ); } }