本文整理汇总了C++中FlyoutMenu::GetChild方法的典型用法代码示例。如果您正苦于以下问题:C++ FlyoutMenu::GetChild方法的具体用法?C++ FlyoutMenu::GetChild怎么用?C++ FlyoutMenu::GetChild使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FlyoutMenu
的用法示例。
在下文中一共展示了FlyoutMenu::GetChild方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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();
}
}