internal void IcarosControllerFound(string name) { IcarosController con = new IcarosController(); con.deviceName = name; registerDevice(con); }
internal void IcarosControllerStatusChange(JavaBridgeStatus newStatus, string newStatusInfo) { if (newStatus.Equals(JavaBridgeStatus.PERIPHERAL_DISCONNECTED)) { IcarosController con = null; foreach (IInputDevice device in registeredInputDevices) { if (device.GetType() == typeof(IcarosController) && device.IsInUse()) { con = device as IcarosController; } } if (con != null) { con.used = false; registeredInputDevices.Remove(con); DeviceLost(con); } } if (newStatus.Equals(JavaBridgeStatus.PERIPHERAL_CONNECTED)) { DeviceUsed(deviceWaitingForJBM); } }
public void UseDevice(IInputDevice device) { if (device.GetType() == typeof(IcarosController)) { IcarosController con = device as IcarosController; #if UNITY_ANDROID && !UNITY_EDITOR JavaBridgeManager.Instance.OnNewBytes += con.HandleNewBytes; JavaBridgeManager.Instance.ConnectToController(con.GetDeviceName()); deviceWaitingForJBM = device; #endif #if UNITY_STANDALONE_WIN BluetoothManager.Instance.ConnectToController(con.GetDeviceName()); DeviceUsed(device); #endif con.used = true; } if (device.GetType() == typeof(Keyboard)) { Keyboard key = device as Keyboard; key.used = true; DeviceUsed(device); } if (device.GetType() == typeof(GenericJoystick)) { GenericJoystick joy = device as GenericJoystick; joy.used = true; DeviceUsed(device); } }