Esempio n. 1
0
//-----------------------------------------------------------------------------
// Purpose: Forces an update
//-----------------------------------------------------------------------------
void CBuildMenu::OnThink()
{
	//	CBasePlayer *pPlayer = C_BasePlayer::GetLocalPlayer();
	if ( BaseClass::IsVisible() == false )
		return;

	CalculateButtonState();

	for (int i = 0; i < TYPE_TOTAL; i++)
	{
		if ((spawnbuttons[i] && spawnbuttons[i]->IsCursorOver()) ||
			(spawnfives[i] && spawnfives[i]->IsCursorOver()))
		{
			ShowZombieInfo(i);
		}
	}

	//TGB: force close if not ZM
	C_HL2MP_Player *pPlayer = C_HL2MP_Player::GetLocalHL2MPPlayer();
	if (pPlayer && pPlayer->IsZM() == false)
	{
		//prevent edge cases with roundrestarts while panel is open
		DoClose();
	}
}
Esempio n. 2
0
//--------------------------------------------------------------
// Helper that closes the menu 
//--------------------------------------------------------------
void CBuildMenu::DoClose()
{
	Close();
	SetVisible( false );
	SetMouseInputEnabled( false );

	//bring viewport back up
	C_HL2MP_Player *pPlayer = C_HL2MP_Player::GetLocalHL2MPPlayer();
	if (pPlayer && pPlayer->IsZM())
	{
		//prevent edge cases with roundrestarts while panel is open
		m_pViewPort->ShowPanel( PANEL_VIEWPORT, true );
	}
	
	gViewPortInterface->ShowBackGround( false );
}
Esempio n. 3
0
//-----------------------------------------------------------------------------
// Purpose: shows the build menu
//-----------------------------------------------------------------------------
void CBuildMenu::ShowPanel(bool bShow)
{
//	CBasePlayer *pPlayer = C_BasePlayer::GetLocalPlayer();
	if ( BaseClass::IsVisible() == bShow )
		return;


	if ( bShow )
	{
		//TGB: manipmenu cannot be open open as it will conflict
		m_pViewPort->ShowPanel( PANEL_MANIPULATE, false );
		//viewport has to go too, or the build menu can sometimes become unresponsive to commands
		m_pViewPort->ShowPanel( PANEL_VIEWPORT, false );

		//TGB: update costs if necessary
		/*we print these live from the cvar now
		if (NeedCostsUpdate())
		{
			LoadControlSettings("Resource/UI/BuildMenu.res");
			PrintAllCosts();

			//it would be nice to save away the original unprinted strings for easy cost updating without reloading the .res
			//however, a change of zombiecosts should not happen often at all, at most once for each time you join a server
			
			DevMsg("Reloaded buildmenu\n");
		}*/

		//LAWYER:  ZombieFlags stuff
		CalculateButtonState();

		Activate();

		SetMouseInputEnabled( true ); 

		SetKeyBoardInputEnabled( zm_menus_use_keyboard.GetBool() );
	
		//// get key bindings if shown

		if( m_iJumpKey < 0 ) // you need to lookup the jump key AFTER the engine has loaded
		{
			m_iJumpKey = gameuifuncs->GetEngineKeyCodeForBind( "jump" ); 
		}

		//if ( m_iScoreBoardKey < 0 ) 
		//{
		//	m_iScoreBoardKey = gameuifuncs->GetEngineKeyCodeForBind( "showscores" );
		//}
	}
	else
	{
		SetVisible( false );
		SetMouseInputEnabled( false );

		//bring viewport back up
		C_HL2MP_Player *pPlayer = C_HL2MP_Player::GetLocalHL2MPPlayer();
		if (pPlayer && pPlayer->IsZM())
		{
			//prevent edge cases with roundrestarts while panel is open
			m_pViewPort->ShowPanel( PANEL_VIEWPORT, true );
		}

	}

	//m_pViewPort->ShowBackGround( bShow );
}