|
|
@ -4,7 +4,7 @@ using System.Runtime.InteropServices; |
|
|
|
using System; |
|
|
|
using System.Collections.Generic; |
|
|
|
using UnityEngine.UI; |
|
|
|
|
|
|
|
using UnityEditor; |
|
|
|
|
|
|
|
public class TrackballInputManager : MonoBehaviour |
|
|
|
{ |
|
|
@ -32,7 +32,11 @@ public class TrackballInputManager : MonoBehaviour |
|
|
|
|
|
|
|
public static void Calibrate(int playerNumber, int DeviceId) |
|
|
|
{ |
|
|
|
Debug.Log("calibration player " + playerNumber + " to deviceID: " + DeviceId); |
|
|
|
Calibration[playerNumber] = DeviceId; |
|
|
|
|
|
|
|
PlayerPrefs.SetInt("Player" + playerNumber + "Device", DeviceId); |
|
|
|
PlayerPrefs.Save(); |
|
|
|
} |
|
|
|
|
|
|
|
public struct RawInputEvent |
|
|
@ -55,9 +59,19 @@ public class TrackballInputManager : MonoBehaviour |
|
|
|
//public static TrackballInputManager instance;
|
|
|
|
|
|
|
|
[SerializeField] List<Player> _players; |
|
|
|
// Start is called before the first frame update
|
|
|
|
|
|
|
|
|
|
|
|
void LoadCalibration() |
|
|
|
{ |
|
|
|
for (int i=0; i<4; ++i) |
|
|
|
{ |
|
|
|
Calibration[i] = PlayerPrefs.GetInt("Player" + i + "Device", 0); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
void Start() |
|
|
|
{ |
|
|
|
LoadCalibration(); |
|
|
|
Debug.Log("starting trackballs"); |
|
|
|
//instance = this;
|
|
|
|
if (isInit == false) |
|
|
@ -87,6 +101,9 @@ public class TrackballInputManager : MonoBehaviour |
|
|
|
_ignoredDevices.Add(381291525); |
|
|
|
_ignoredDevices.Add(254348147); |
|
|
|
_ignoredDevices.Add(254282139); |
|
|
|
_ignoredDevices.Add(65595); |
|
|
|
_ignoredDevices.Add(65599); |
|
|
|
_ignoredDevices.Add(1250497353); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -222,7 +239,7 @@ public class TrackballInputManager : MonoBehaviour |
|
|
|
for (int i = 0; i < _players.Count; i++) { |
|
|
|
if (Calibration[i] == deviceId) |
|
|
|
{ |
|
|
|
return 0; |
|
|
|
return i; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|