Bugfix Widget Focus Not Correctly Being Set

This commit is contained in:
Philip W 2023-02-02 02:06:55 +00:00
parent e2f91a11b5
commit 014a670ec5

View File

@ -42,17 +42,16 @@ void ATurnBaseCombatV2::StartCombat(AActor* Enemy)
IronResource = 10; IronResource = 10;
SulfurResource = 10; SulfurResource = 10;
if (APlayerController* PC = Cast<APlayerController>(GetWorld()->GetFirstPlayerController()))
{
PC->bShowMouseCursor = true;
PC->bEnableClickEvents = true;
PC->bEnableMouseOverEvents = true;
}
//Disable Character Movement //Disable Character Movement
if (ACharacter* PlayerCharacter = Cast<ACharacter>(GetWorld()->GetFirstPlayerController()->GetPawn())) if (ACharacter* PlayerCharacter = Cast<ACharacter>(GetWorld()->GetFirstPlayerController()->GetPawn()))
{ {
PlayerCharacter->DisableInput(GetWorld()->GetFirstPlayerController()); PlayerCharacter->DisableInput(GetWorld()->GetFirstPlayerController());
} }
//Set to UI Mode Only
APlayerController* PlayerController = GetWorld()->GetFirstPlayerController();
PlayerController->SetInputMode(FInputModeUIOnly());
PlayerController->bShowMouseCursor = true;
CurrentComboString = ""; CurrentComboString = "";
UpdateComboString(CurrentComboString); UpdateComboString(CurrentComboString);
RevertActionPoints(); RevertActionPoints();
@ -73,17 +72,10 @@ void ATurnBaseCombatV2::EndCombat()
{ {
PlayerCharacter->EnableInput(GetWorld()->GetFirstPlayerController()); PlayerCharacter->EnableInput(GetWorld()->GetFirstPlayerController());
} }
if (APlayerController* PC = Cast<APlayerController>(GetWorld()->GetFirstPlayerController())) //Set to Game Mode Only
{ APlayerController* PlayerController = GetWorld()->GetFirstPlayerController();
PC->bShowMouseCursor = false; PlayerController->SetInputMode(FInputModeGameOnly());
PC->bEnableClickEvents = false; PlayerController->bShowMouseCursor = false;
PC->bEnableMouseOverEvents = false;
}
GetWorld()->GetFirstPlayerController()->SetIgnoreLookInput(false);
GetWorld()->GetFirstPlayerController()->SetIgnoreMoveInput(false);
GetWorld()->GetFirstPlayerController()->bShowMouseCursor = false;
GetWorld()->GetFirstPlayerController()->bEnableClickEvents = false;
GetWorld()->GetFirstPlayerController()->bEnableMouseOverEvents = false;
} }
void ATurnBaseCombatV2::FKeyPressed() void ATurnBaseCombatV2::FKeyPressed()