File size: 2,633 Bytes
18a519f | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 | #if UNITY_EDITOR || UNITY_IOS || UNITY_TVOS
using UnityEngine.InputSystem.iOS.LowLevel;
using UnityEngine.InputSystem.Layouts;
using UnityEngine.InputSystem.LowLevel;
namespace UnityEngine.InputSystem.iOS
{
#if UNITY_DISABLE_DEFAULT_INPUT_PLUGIN_INITIALIZATION
public
#else
internal
#endif
static class iOSSupport
{
public static void Initialize()
{
InputSystem.RegisterLayout<iOSGameController>("iOSGameController",
matches: new InputDeviceMatcher()
.WithInterface("iOS")
.WithDeviceClass("iOSGameController"));
InputSystem.RegisterLayout<XboxOneGampadiOS>("XboxOneGampadiOS",
matches: new InputDeviceMatcher()
.WithInterface("iOS")
.WithDeviceClass("iOSGameController")
.WithProduct("Xbox Wireless Controller"));
InputSystem.RegisterLayout<DualShock4GampadiOS>("DualShock4GampadiOS",
matches: new InputDeviceMatcher()
.WithInterface("iOS")
.WithDeviceClass("iOSGameController")
.WithProduct("DUALSHOCK 4 Wireless Controller"));
InputSystem.RegisterLayout<DualSenseGampadiOS>("DualSenseGampadiOS",
matches: new InputDeviceMatcher()
.WithInterface("iOS")
.WithDeviceClass("iOSGameController")
.WithProduct("DualSense Wireless Controller"));
InputSystem.RegisterLayoutMatcher("GravitySensor",
new InputDeviceMatcher()
.WithInterface("iOS")
.WithDeviceClass("Gravity"));
InputSystem.RegisterLayoutMatcher("AttitudeSensor",
new InputDeviceMatcher()
.WithInterface("iOS")
.WithDeviceClass("Attitude"));
InputSystem.RegisterLayoutMatcher("LinearAccelerationSensor",
new InputDeviceMatcher()
.WithInterface("iOS")
.WithDeviceClass("LinearAcceleration"));
#if UNITY_EDITOR || UNITY_IOS
InputSystem.RegisterLayout<iOSStepCounter>();
// Don't add devices for InputTestRuntime
// TODO: Maybe there should be a better place for adding device from C#
if (InputSystem.s_Manager.m_Runtime is NativeInputRuntime)
{
if (iOSStepCounter.IsAvailable())
InputSystem.AddDevice<iOSStepCounter>();
}
#endif
}
}
}
#endif // UNITY_EDITOR || UNITY_IOS || UNITY_TVOS
|