Added ability to check if input is allowed.

[REVIEW] [at]daren.cheng, [at]vincent.gauthier

#ROBOMERGE-AUTHOR: saad.nader
#ROBOMERGE-SOURCE: CL 19673608 via CL 19674174 via CL 19674269
#ROBOMERGE-BOT: UE5 (Release-Engine-Staging -> Main) (v938-19570697)

[CL 19676109 by saad nader in ue5-main branch]
This commit is contained in:
saad nader
2022-04-07 15:45:02 -04:00
parent 4cca25a55d
commit 7e680c8a13
2 changed files with 15 additions and 4 deletions
@@ -127,4 +127,17 @@ void UCommonUISubsystemBase::SetInputAllowed(bool bEnabled, const FName& Reason,
InputSubsystem->SetInputTypeFilter(ECommonInputType::Gamepad, Reason, !bEnabled);
InputSubsystem->SetInputTypeFilter(ECommonInputType::Touch, Reason, !bEnabled);
}
}
}
bool UCommonUISubsystemBase::IsInputAllowed(const ULocalPlayer* LocalPlayer) const
{
if (UCommonInputSubsystem* InputSubSystem = UCommonInputSubsystem::Get(LocalPlayer))
{
const bool bKeyboardAndMouseFiltered = InputSubSystem->GetInputTypeFilter(ECommonInputType::MouseAndKeyboard);
const bool bGamepadFiltered = InputSubSystem->GetInputTypeFilter(ECommonInputType::Gamepad);
const bool bTouchFiltered = InputSubSystem->GetInputTypeFilter(ECommonInputType::Touch);
return !bKeyboardAndMouseFiltered || !bGamepadFiltered || !bTouchFiltered;
}
return true;
}
@@ -26,8 +26,6 @@ public:
/** set the analytic provider for the CommonUI Widgets to use */
void SetAnalyticProvider(const TSharedPtr<IAnalyticsProviderET>& AnalyticProvider);
public:
// Gets Action Button Icon for current gamepad
UFUNCTION(BlueprintCallable, Category = CommonUISubsystem)
FSlateBrush GetInputActionButtonIcon(const FDataTableRowHandle& InputActionRowHandle, ECommonInputType InputType, const FName& GamepadName) const;
@@ -40,8 +38,8 @@ public:
//CommonUI.PanelPushed
void FireEvent_PanelPushed(const FString& PanelName) const;
public:
virtual void SetInputAllowed(bool bEnabled, const FName& Reason, const ULocalPlayer& LocalPlayer);
virtual bool IsInputAllowed(const ULocalPlayer* LocalPlayer) const;
private: