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


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

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


在下文中一共展示了FlyoutMenu::GetChildCount方法的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();
	}
}
开发者ID:Au-heppa,项目名称:swarm-sdk,代码行数:97,代码来源:vingamechapterselect.cpp


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