//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void CTFFourTeamMenu::ShowPanel(bool bShow) { if (BaseClass::IsVisible() == bShow) return; if (!C_TFPlayer::GetLocalTFPlayer()) return; if (!gameuifuncs || !gViewPortInterface || !engine) return; if (bShow) { if (TFGameRules()->State_Get() == GR_STATE_TEAM_WIN && C_TFPlayer::GetLocalTFPlayer() && C_TFPlayer::GetLocalTFPlayer()->GetTeamNumber() != TFGameRules()->GetWinningTeam() && C_TFPlayer::GetLocalTFPlayer()->GetTeamNumber() != TEAM_SPECTATOR && C_TFPlayer::GetLocalTFPlayer()->GetTeamNumber() != TEAM_UNASSIGNED) { SetVisible(false); SetMouseInputEnabled(false); CHudNotificationPanel *pNotifyPanel = GET_HUDELEMENT(CHudNotificationPanel); if (pNotifyPanel) { pNotifyPanel->SetupNotifyCustom("#TF_CantChangeTeamNow", "ico_notify_flag_moving", C_TFPlayer::GetLocalTFPlayer()->GetTeamNumber()); } return; } gViewPortInterface->ShowPanel(PANEL_CLASS_RED, false); gViewPortInterface->ShowPanel(PANEL_CLASS_BLUE, false); gViewPortInterface->ShowPanel(PANEL_CLASS_GREEN, false); gViewPortInterface->ShowPanel(PANEL_CLASS_YELLOW, false); engine->CheckPoint("TeamMenu"); Activate(); SetMouseInputEnabled(true); // get key bindings if shown m_iTeamMenuKey = gameuifuncs->GetButtonCodeForBind("changeteam"); m_iScoreBoardKey = gameuifuncs->GetButtonCodeForBind("showscores"); switch (C_TFPlayer::GetLocalTFPlayer()->GetTeamNumber()) { case TF_TEAM_RED: GetFocusNavGroup().SetCurrentFocus(m_pRedTeamButton->GetVPanel(), m_pRedTeamButton->GetVPanel()); break; case TF_TEAM_BLUE: GetFocusNavGroup().SetCurrentFocus(m_pBlueTeamButton->GetVPanel(), m_pBlueTeamButton->GetVPanel()); break; case TF_TEAM_GREEN: GetFocusNavGroup().SetCurrentFocus(m_pGreenTeamButton->GetVPanel(), m_pGreenTeamButton->GetVPanel()); break; case TF_TEAM_YELLOW: GetFocusNavGroup().SetCurrentFocus(m_pYellowTeamButton->GetVPanel(), m_pYellowTeamButton->GetVPanel()); break; default: GetFocusNavGroup().SetCurrentFocus(m_pAutoTeamButton->GetVPanel(), m_pAutoTeamButton->GetVPanel()); break; } } else { SetVisible(false); SetMouseInputEnabled(false); } }
//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void CTFClassMenu::ShowPanel( bool bShow ) { if ( bShow ) { // can't change class if you're on the losing team during the "bonus time" after a team has won the round if ( TFGameRules()->State_Get() == GR_STATE_TEAM_WIN && C_TFPlayer::GetLocalTFPlayer() && C_TFPlayer::GetLocalTFPlayer()->GetTeamNumber() != TFGameRules()->GetWinningTeam() && C_TFPlayer::GetLocalTFPlayer()->GetTeamNumber() != TEAM_SPECTATOR && C_TFPlayer::GetLocalTFPlayer()->GetTeamNumber() != TEAM_UNASSIGNED && GetSpectatorMode() == OBS_MODE_NONE ) { SetVisible( false ); SetMouseInputEnabled( false ); CHudNotificationPanel *pNotifyPanel = GET_HUDELEMENT( CHudNotificationPanel ); if ( pNotifyPanel ) { pNotifyPanel->SetupNotifyCustom( "#TF_CantChangeClassNow", "ico_notify_flag_moving", C_TFPlayer::GetLocalTFPlayer()->GetTeamNumber() ); } return; } engine->CheckPoint( "ClassMenu" ); Activate(); SetMouseInputEnabled( true ); CLocalPlayerFilter filter; C_BaseEntity::EmitSound(filter, SOUND_FROM_UI_PANEL, pszBackgroundMusic); m_iClassMenuKey = gameuifuncs->GetButtonCodeForBind( "changeclass" ); m_iScoreBoardKey = gameuifuncs->GetButtonCodeForBind( "showscores" ); CImageMouseOverButton<CTFClassInfoPanel> *pInitialButton = GetCurrentClassButton(); for( int i = 0; i < GetChildCount(); i++ ) { CImageMouseOverButton<CTFClassInfoPanel> *button = dynamic_cast<CImageMouseOverButton<CTFClassInfoPanel> *>( GetChild( i ) ); if ( button ) { if ( button == pInitialButton ) { button->ShowPage(); button->SetArmed( true ); button->SetAsDefaultButton( 1 ); g_lastButton = button; } else { button->HidePage(); button->SetArmed( false ); } } } } else { // turn off all of our ClassInfo panels so the VCDs will stop playing for( int i = 0; i < GetChildCount(); i++ ) { CImageMouseOverButton<CTFClassInfoPanel> *button = dynamic_cast<CImageMouseOverButton<CTFClassInfoPanel> *>( GetChild( i ) ); if ( button ) { button->HidePage(); } } // everything is off so just reset these for next time g_lastButton = NULL; g_lastPanel = NULL; C_BaseEntity::StopSound(SOUND_FROM_UI_PANEL, pszBackgroundMusic); SetVisible( false ); SetMouseInputEnabled( false ); } }
//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void CTFTeamMenu::ShowPanel( bool bShow ) { if ( BaseClass::IsVisible() == bShow ) return; if ( !C_TFPlayer::GetLocalTFPlayer() ) return; if ( !gameuifuncs || !gViewPortInterface || !engine ) return; if ( bShow ) { if (TFGameRules()->IsFourTeamGame()) { gViewPortInterface->ShowPanel(PANEL_FOURTEAMSELECT, true); } else if (TFGameRules()->IsDeathmatch()) { gViewPortInterface->ShowPanel(PANEL_DEATHMATCHTEAMSELECT, true); } else { if (TFGameRules()->State_Get() == GR_STATE_TEAM_WIN && C_TFPlayer::GetLocalTFPlayer() && C_TFPlayer::GetLocalTFPlayer()->GetTeamNumber() != TFGameRules()->GetWinningTeam() && C_TFPlayer::GetLocalTFPlayer()->GetTeamNumber() != TEAM_SPECTATOR && C_TFPlayer::GetLocalTFPlayer()->GetTeamNumber() != TEAM_UNASSIGNED) { SetVisible(false); SetMouseInputEnabled(false); CHudNotificationPanel *pNotifyPanel = GET_HUDELEMENT(CHudNotificationPanel); if (pNotifyPanel) { pNotifyPanel->SetupNotifyCustom("#TF_CantChangeTeamNow", "ico_notify_flag_moving", C_TFPlayer::GetLocalTFPlayer()->GetTeamNumber()); } return; } gViewPortInterface->ShowPanel(PANEL_CLASS_RED, false); gViewPortInterface->ShowPanel(PANEL_CLASS_BLUE, false); gViewPortInterface->ShowPanel(PANEL_CLASS_GREEN, false); gViewPortInterface->ShowPanel(PANEL_CLASS_YELLOW, false); engine->CheckPoint("TeamMenu"); Activate(); SetMouseInputEnabled(true); // get key bindings if shown m_iTeamMenuKey = gameuifuncs->GetButtonCodeForBind("changeteam"); m_iScoreBoardKey = gameuifuncs->GetButtonCodeForBind("showscores"); switch (C_TFPlayer::GetLocalTFPlayer()->GetTeamNumber()) { case TF_TEAM_BLUE: if (IsConsole()) { m_pBlueTeamButton->OnCursorEntered(); m_pBlueTeamButton->SetDefaultAnimation("enter_enabled"); } GetFocusNavGroup().SetCurrentFocus(m_pBlueTeamButton->GetVPanel(), m_pBlueTeamButton->GetVPanel()); break; case TF_TEAM_RED: if (IsConsole()) { m_pRedTeamButton->OnCursorEntered(); m_pRedTeamButton->SetDefaultAnimation("enter_enabled"); } GetFocusNavGroup().SetCurrentFocus(m_pRedTeamButton->GetVPanel(), m_pRedTeamButton->GetVPanel()); break; default: if (IsConsole()) { m_pAutoTeamButton->OnCursorEntered(); m_pAutoTeamButton->SetDefaultAnimation("enter_enabled"); } GetFocusNavGroup().SetCurrentFocus(m_pAutoTeamButton->GetVPanel(), m_pAutoTeamButton->GetVPanel()); break; } } } else { if (TFGameRules()->IsFourTeamGame()) { gViewPortInterface->ShowPanel(PANEL_FOURTEAMSELECT, false); } else if (TFGameRules()->IsDeathmatch()) { gViewPortInterface->ShowPanel(PANEL_DEATHMATCHTEAMSELECT, false); } else { SetVisible(false); SetMouseInputEnabled(false); if (IsConsole()) { // Close the door behind us CTFTeamButton *pButton = dynamic_cast< CTFTeamButton *> (GetFocusNavGroup().GetCurrentFocus()); if (pButton) { pButton->OnCursorExited(); } } } } }