Exemplo n.º 1
0
void AFPSGPlayerController::openInGameMenu()
{
	//GEngine->AddOnScreenDebugMessage(-1, 10.0f, FColor::Yellow, "AFPSGPlayerController::openPauseMenu");

	//Dont open/close the in game menu if it is disabled
	if (inGameMenuIsDisabled) return;

	//If in game menu is open, close it
	if (inGameMenuIsOpen)
	{
		inGameMenuIsOpen = false;
		bShowMouseCursor = false;

		//Set input to only accept game input (keyboard, mouse). Also turn on movement and look input
		FInputModeGameOnly inputMode;
		SetInputMode(inputMode);
		SetIgnoreLookInput(false);
		SetIgnoreMoveInput(false);

		//Remove the in game menu HUD from the screen
		FPSGUtility::destroyUserWidget(&HUDInGameMenu);

		//Set all other widgets to visible if they should be on screen
		if (HUDAlive != NULL && HUDDead != NULL && HUDInGameLeaderboard != NULL)
		{
			HUDAlive->SetVisibility(ESlateVisibility::SelfHitTestInvisible);
			HUDDead->SetVisibility(ESlateVisibility::SelfHitTestInvisible);
			HUDInGameLeaderboard->SetVisibility(ESlateVisibility::SelfHitTestInvisible);
		}
	}
	else
	{
		inGameMenuIsOpen = true;
		bShowMouseCursor = true;

		//Set input to accept UI input aswell as game input. Also turn of movement and look input
		FInputModeGameAndUI inputMode;
		inputMode.SetLockMouseToViewport(true);
		SetInputMode(inputMode);
		SetIgnoreLookInput(true);
		SetIgnoreMoveInput(true);
		
		//Set all other widgets to hidden if they are on the screen
		if (HUDAlive != NULL && HUDDead != NULL && HUDInGameLeaderboard != NULL)
		{
			HUDAlive->SetVisibility(ESlateVisibility::Hidden);
			HUDDead->SetVisibility(ESlateVisibility::Hidden);
			HUDInGameLeaderboard->SetVisibility(ESlateVisibility::Hidden);
		}
		
		//Create the in game menu HUD
		if (HUDInGameMenu == NULL)
		{
			HUDInGameMenu = FPSGUtility::createUserWidget(this, HUDInGameMenuTemplate, true);
		}
	}
}
Exemplo n.º 2
0
bool ATGCOPlayerController::SetPause(bool bPause, FCanUnpause CanUnpauseDelegate /*= FCanUnpause()*/)
{
	UE_LOG(LogOnline, Log, TEXT("Call SetPause"));
	SetIgnoreMoveInput(bPause);
	SetIgnoreLookInput(bPause);
	return APlayerController::SetPause(bPause, CanUnpauseDelegate);
}