More work on Prompt Widget
This commit is contained in:
@@ -283,17 +283,12 @@ 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;
|
||||
}
|
||||
FName Id = IDS->GetMostRecentlyUsedHardwareDevice(Player->GetPlatformUserId()).HardwareDeviceIdentifier;
|
||||
|
||||
FString DeviceName = Device.HardwareDeviceIdentifier.ToString();
|
||||
if (DeviceName.Contains(TEXT("PS4")) || DeviceName.Contains(TEXT("PS5")) || DeviceName.Contains(TEXT("PlayStation")))
|
||||
{
|
||||
return ElxControllerType::PlayStationGamepad;
|
||||
}
|
||||
return ElxControllerType::XboxGamepad;
|
||||
if (Id == TEXT("ps3") || Id == TEXT("ps4") || Id == TEXT("ps5")) return ElxControllerType::PlayStationGamepad;
|
||||
if (Id == TEXT("xbox360") || Id == TEXT("xboxone")) return ElxControllerType::XboxGamepad;
|
||||
|
||||
// Unknown or unrecognized device — assume keyboard/mouse
|
||||
return ElxControllerType::KeyboardMouse;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user