Disable Android input handlers in non-Android systems.

This commit is contained in:
2023-06-06 11:45:01 +08:00
parent 02441eb328
commit 82060a6403

View File

@@ -62,20 +62,23 @@ namespace Cryville.Crtr {
GameDataPath = Settings.Default.GameDataPath;
unity::Input.simulateMouseWithTouches = false;
InputManager.HandlerRegistries.Add(typeof(AndroidAccelerometerHandler));
InputManager.HandlerRegistries.Add(typeof(AndroidAccelerometerUncalibratedHandler));
InputManager.HandlerRegistries.Add(typeof(AndroidGameRotationVectorHandler));
InputManager.HandlerRegistries.Add(typeof(AndroidGravityHandler));
InputManager.HandlerRegistries.Add(typeof(AndroidGyroscopeHandler));
InputManager.HandlerRegistries.Add(typeof(AndroidLinearAccelerationHandler));
InputManager.HandlerRegistries.Add(typeof(AndroidMagneticFieldHandler));
InputManager.HandlerRegistries.Add(typeof(AndroidMagneticFieldUncalibratedHandler));
InputManager.HandlerRegistries.Add(typeof(AndroidRotationVectorHandler));
InputManager.HandlerRegistries.Add(typeof(AndroidTouchHandler));
InputManager.HandlerRegistries.Add(typeof(UnityGuiInputHandler<UnityKeyReceiver>));
InputManager.HandlerRegistries.Add(typeof(UnityGuiInputHandler<UnityMouseReceiver>));
InputManager.HandlerRegistries.Add(typeof(UnityMouseHandler));
InputManager.HandlerRegistries.Add(typeof(UnityTouchHandler));
var emptyObjectArray = new object[0];
#if UNITY_ANDROID
InputManager.HandlerRegistries.Add(typeof(AndroidAccelerometerHandler), emptyObjectArray);
InputManager.HandlerRegistries.Add(typeof(AndroidAccelerometerUncalibratedHandler), emptyObjectArray);
InputManager.HandlerRegistries.Add(typeof(AndroidGameRotationVectorHandler), emptyObjectArray);
InputManager.HandlerRegistries.Add(typeof(AndroidGravityHandler), emptyObjectArray);
InputManager.HandlerRegistries.Add(typeof(AndroidGyroscopeHandler), emptyObjectArray);
InputManager.HandlerRegistries.Add(typeof(AndroidLinearAccelerationHandler), emptyObjectArray);
InputManager.HandlerRegistries.Add(typeof(AndroidMagneticFieldHandler), emptyObjectArray);
InputManager.HandlerRegistries.Add(typeof(AndroidMagneticFieldUncalibratedHandler), emptyObjectArray);
InputManager.HandlerRegistries.Add(typeof(AndroidRotationVectorHandler), emptyObjectArray);
InputManager.HandlerRegistries.Add(typeof(AndroidTouchHandler), emptyObjectArray);
#endif
InputManager.HandlerRegistries.Add(typeof(UnityGuiInputHandler<UnityKeyReceiver>), emptyObjectArray);
InputManager.HandlerRegistries.Add(typeof(UnityGuiInputHandler<UnityMouseReceiver>), emptyObjectArray);
InputManager.HandlerRegistries.Add(typeof(UnityMouseHandler), emptyObjectArray);
InputManager.HandlerRegistries.Add(typeof(UnityTouchHandler), emptyObjectArray);
InputManager = new InputManager();
#if UNITY_EDITOR_WIN