void DropDownMenu::ChangeSelection( SelectionChange_t eNext ) { if ( !IsEnabled() || !m_pButton || !m_pButton->IsEnabled() ) { CBaseModPanel::GetSingleton().PlayUISound( UISOUND_INVALID ); return; } FlyoutMenu *pFlyout = GetCurrentFlyout(); if ( pFlyout ) { Button *pCurrentButton = m_hCurrentFlyout->FindChildButtonByCommand( m_curSelText ); Button *pButton = ( eNext == SELECT_PREV ) ? ( m_hCurrentFlyout->FindPrevChildButtonByCommand( m_curSelText ) ) : ( m_hCurrentFlyout->FindNextChildButtonByCommand( m_curSelText ) ); if ( pButton ) { pButton->OnThink(); } // Find the next enabled option while ( pButton && pButton->GetCommand() && !( pButton == pCurrentButton || pButton->IsEnabled() ) ) { const char *pCommand = pButton->GetCommand()->GetString( "command", NULL ); pButton = ( eNext == SELECT_PREV ) ? ( m_hCurrentFlyout->FindPrevChildButtonByCommand( pCommand ) ) : ( m_hCurrentFlyout->FindNextChildButtonByCommand( pCommand ) ); if ( pButton ) { pButton->OnThink(); } } if ( pButton == pCurrentButton ) { CBaseModPanel::GetSingleton().PlayUISound( UISOUND_INVALID ); } else { CBaseModPanel::GetSingleton().PlayUISound( UISOUND_CLICK ); if ( pButton && pButton->GetCommand() ) { SetCurrentSelection( pButton->GetCommand()->GetString( "command", NULL ) ); } } } }