More progress on prompt
This commit is contained in:
@@ -14,6 +14,8 @@
|
||||
#include "EnhancedInputComponent.h"
|
||||
#include "Animation/AnimSequenceBase.h"
|
||||
#include "GameFramework/Pawn.h"
|
||||
#include "GameFramework/InputDeviceSubsystem.h"
|
||||
#include "GameFramework/InputSettings.h"
|
||||
|
||||
|
||||
#define LOCTEXT_NAMESPACE "Luprex Utility"
|
||||
@@ -275,3 +277,23 @@ void UlxUtilityLibrary::ValidateLuaExpr(
|
||||
FlxLockedWrapper w;
|
||||
Status = w.ValidateLuaExpr(Code, ErrorMessage);
|
||||
}
|
||||
|
||||
ElxControllerType UlxUtilityLibrary::DetectControllerType(ULocalPlayer *Player)
|
||||
{
|
||||
UInputDeviceSubsystem *IDS = GEngine->GetEngineSubsystem<UInputDeviceSubsystem>();
|
||||
if (!IDS) return ElxControllerType::KeyboardMouse;
|
||||
|
||||
FHardwareDeviceIdentifier Device = IDS->GetMostRecentlyUsedHardwareDevice(Player->GetPlatformUserId());
|
||||
if (Device.PrimaryDeviceType != EHardwareDevicePrimaryType::Gamepad)
|
||||
{
|
||||
return ElxControllerType::KeyboardMouse;
|
||||
}
|
||||
|
||||
FString DeviceName = Device.HardwareDeviceIdentifier.ToString();
|
||||
if (DeviceName.Contains(TEXT("PS4")) || DeviceName.Contains(TEXT("PS5")) || DeviceName.Contains(TEXT("PlayStation")))
|
||||
{
|
||||
return ElxControllerType::PlayStationGamepad;
|
||||
}
|
||||
return ElxControllerType::XboxGamepad;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user