This commit is contained in:
FlaminSarge 2025-12-16 01:19:52 -08:00 committed by GitHub
commit cc965e902c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 42 additions and 0 deletions

View File

@ -686,6 +686,14 @@ void CClassLoadoutPanel::OnKeyCodePressed( vgui::KeyCode code )
OnCommand( VarArgs("change%d", nSelected ) );
}
}
else if ( nButtonCode == KEY_XBUTTON_X || nButtonCode == STEAMCONTROLLER_X )
{
int nSelected = GetFirstSelectedItemIndex( true );
if( nSelected != -1 )
{
OnCommand( VarArgs("preview%d", nSelected ) );
}
}
else
{
BaseClass::OnKeyCodePressed( code );
@ -930,6 +938,23 @@ void CClassLoadoutPanel::OnItemPanelMouseReleased( vgui::Panel *panel )
}
}
void CClassLoadoutPanel::OnItemPanelMouseRightRelease( vgui::Panel *panel )
{
CItemModelPanel *pItemPanel = dynamic_cast < CItemModelPanel * > ( panel );
if ( pItemPanel && IsVisible() )
{
for ( int i = 0; i < m_pItemModelPanels.Count(); i++ )
{
if ( m_pItemModelPanels[i] == pItemPanel )
{
OnCommand( VarArgs("preview%d", i) );
return;
}
}
}
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
@ -1215,6 +1240,22 @@ void CClassLoadoutPanel::OnCommand( const char *command )
return;
}
else if ( !V_strnicmp( command, "preview", 7 ) )
{
const char *pszNum = command+7;
if ( pszNum && pszNum[0] )
{
int iSlot = atoi(pszNum);
if ( iSlot >= 0 && iSlot < CLASS_LOADOUT_POSITION_COUNT && m_iCurrentClassIndex != TF_CLASS_UNDEFINED )
{
if ( m_iCurrentSlotIndex != iSlot )
{
m_iCurrentSlotIndex = iSlot;
UpdateModelPanels();
}
}
}
}
else if ( !V_strnicmp( command, "options", 7 ) )
{
const char *pszNum = command + 7;

View File

@ -84,6 +84,7 @@ public:
CEconItemView *GetItemInSlot( int iSlot );
MESSAGE_FUNC_PTR( OnItemPanelMouseReleased, "ItemPanelMouseReleased", panel );
MESSAGE_FUNC_PTR( OnItemPanelMouseRightRelease, "ItemPanelMouseRightRelease", panel );
MESSAGE_FUNC_PARAMS( OnSelectionReturned, "SelectionReturned", data );
MESSAGE_FUNC( OnCancelSelection, "CancelSelection" );
MESSAGE_FUNC( OnClosing, "Closing" );