Bugfix Pause Menu not Focusing upon Construction

This commit is contained in:
Rafal Swierczek 2024-02-08 19:50:04 +00:00
parent 543c20ea51
commit 50d017caa5
6 changed files with 21 additions and 18 deletions

View File

@ -9,13 +9,11 @@
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="dfa3053d-1d51-4dad-9270-4c17e086f627" name="Changes" comment=""> <list default="true" id="dfa3053d-1d51-4dad-9270-4c17e086f627" name="Changes" comment="">
<change beforePath="$PROJECT_DIR$/.idea/.idea.EndlessVendetta/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/.idea.EndlessVendetta/.idea/workspace.xml" afterDir="false" /> <change beforePath="$PROJECT_DIR$/.idea/.idea.EndlessVendetta/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/.idea.EndlessVendetta/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Content/FirstPerson/Blueprints/BP_FirstPersonCharacter.uasset" beforeDir="false" afterPath="$PROJECT_DIR$/Content/FirstPerson/Blueprints/BP_FirstPersonCharacter.uasset" afterDir="false" /> <change beforePath="$PROJECT_DIR$/Content/Dialogue/BP_DialogueUI.uasset" beforeDir="false" afterPath="$PROJECT_DIR$/Content/Dialogue/BP_DialogueUI.uasset" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Content/PauseMenu/Tabs/WBP_BountiesTab.uasset" beforeDir="false" /> <change beforePath="$PROJECT_DIR$/Content/PauseMenu/WBP_PauseMenu.uasset" beforeDir="false" afterPath="$PROJECT_DIR$/Content/PauseMenu/WBP_PauseMenu.uasset" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Content/StarterContent/Blueprints/Blueprint_CeilingLight.uasset" beforeDir="false" afterPath="$PROJECT_DIR$/Content/StarterContent/Blueprints/Blueprint_CeilingLight.uasset" afterDir="false" /> <change beforePath="$PROJECT_DIR$/Content/StarterContent/Architecture/Floor_400x400.uasset" beforeDir="false" afterPath="$PROJECT_DIR$/Content/StarterContent/Architecture/Floor_400x400.uasset" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Content/StarterContent/HDRI/HDRI_Epic_Courtyard_Daylight.uasset" beforeDir="false" afterPath="$PROJECT_DIR$/Content/StarterContent/HDRI/HDRI_Epic_Courtyard_Daylight.uasset" afterDir="false" /> <change beforePath="$PROJECT_DIR$/Content/StarterContent/Props/MaterialSphere.uasset" beforeDir="false" afterPath="$PROJECT_DIR$/Content/StarterContent/Props/MaterialSphere.uasset" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Source/EndlessVendetta/Characters/BountyHunterCharacter.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/Source/EndlessVendetta/Characters/BountyHunterCharacter.cpp" afterDir="false" /> <change beforePath="$PROJECT_DIR$/Source/EndlessVendetta/Characters/BountyHunterCharacter.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/Source/EndlessVendetta/Characters/BountyHunterCharacter.cpp" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Source/EndlessVendetta/Characters/BountyHunterCharacter.h" beforeDir="false" afterPath="$PROJECT_DIR$/Source/EndlessVendetta/Characters/BountyHunterCharacter.h" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Source/EndlessVendetta/PauseMenu/BountiesTab.h" beforeDir="false" afterPath="$PROJECT_DIR$/Source/EndlessVendetta/PauseMenu/BountiesTab.h" afterDir="false" />
</list> </list>
<option name="SHOW_DIALOG" value="false" /> <option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" /> <option name="HIGHLIGHT_CONFLICTS" value="true" />
@ -135,7 +133,7 @@
<workItem from="1707046474738" duration="8878000" /> <workItem from="1707046474738" duration="8878000" />
<workItem from="1707103463352" duration="6662000" /> <workItem from="1707103463352" duration="6662000" />
<workItem from="1707304148719" duration="10277000" /> <workItem from="1707304148719" duration="10277000" />
<workItem from="1707409116575" duration="3559000" /> <workItem from="1707409116575" duration="8922000" />
</task> </task>
<servers /> <servers />
</component> </component>

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -127,21 +127,24 @@ void ABountyHunterCharacter::CreatePauseMenuTabs()
void ABountyHunterCharacter::TogglePauseMenu() void ABountyHunterCharacter::TogglePauseMenu()
{ {
const bool bOpenNewPauseMenu = !IsValid(PauseMenu); const bool bOpenNewPauseMenu = !IsValid(PauseMenu);
FInputModeUIOnly UIOnly; FInputModeGameAndUI UIAndGameOnly;
FInputModeGameOnly GameOnly; FInputModeGameOnly GameOnly;
APlayerController* PC = Cast<APlayerController>(GetController()); APlayerController* PC = Cast<APlayerController>(GetController());
InPauseMenu = bOpenNewPauseMenu; InPauseMenu = bOpenNewPauseMenu;
bOpenNewPauseMenu ? PC->SetInputMode(UIAndGameOnly) : PC->SetInputMode(GameOnly);
PC->SetIgnoreMoveInput(bOpenNewPauseMenu); PC->SetIgnoreMoveInput(bOpenNewPauseMenu);
PC->SetIgnoreLookInput(bOpenNewPauseMenu); PC->SetIgnoreLookInput(bOpenNewPauseMenu);
PC->SetShowMouseCursor(bOpenNewPauseMenu); PC->SetShowMouseCursor(bOpenNewPauseMenu);
if (!bOpenNewPauseMenu) if (!bOpenNewPauseMenu)
{ {
PauseMenu->RemoveFromParent(); PauseMenu->RemoveFromParent();
PauseMenu = nullptr; PauseMenu = nullptr;
return; return;
} }
PauseMenu = CreateWidget<UPauseMenuClass>(GetWorld(), PauseMenuWidgetClass); PauseMenu = CreateWidget<UPauseMenuClass>(GetWorld(), PauseMenuWidgetClass, FName("PauseMenu"));
PauseMenu->AddToViewport(50); PauseMenu->AddToViewport(50);
PauseMenu->OpenNewTab(BountiesTab); PauseMenu->OpenNewTab(BountiesTab);
PauseMenu->OpenedBountiesTab.AddDynamic(this, &ABountyHunterCharacter::OpenBountiesTab); PauseMenu->OpenedBountiesTab.AddDynamic(this, &ABountyHunterCharacter::OpenBountiesTab);
@ -149,6 +152,8 @@ void ABountyHunterCharacter::TogglePauseMenu()
PauseMenu->OpenedNavigationTab.AddDynamic(this, &ABountyHunterCharacter::OpenNavigationTab); PauseMenu->OpenedNavigationTab.AddDynamic(this, &ABountyHunterCharacter::OpenNavigationTab);
PauseMenu->OpenedSettingsTab.AddDynamic(this, &ABountyHunterCharacter::OpenSettingsTab); PauseMenu->OpenedSettingsTab.AddDynamic(this, &ABountyHunterCharacter::OpenSettingsTab);
PauseMenu->OpenedQuitTab.AddDynamic(this, &ABountyHunterCharacter::OpenQuitTab); PauseMenu->OpenedQuitTab.AddDynamic(this, &ABountyHunterCharacter::OpenQuitTab);
PauseMenu->SetVisibility(ESlateVisibility::Visible);
PauseMenu->SetFocus();
} }
void ABountyHunterCharacter::ReturnToOpenWorldEarly() void ABountyHunterCharacter::ReturnToOpenWorldEarly()