DetachDevice() public static méthode

public static DetachDevice ( InputDevice inputDevice ) : void
inputDevice InputDevice
Résultat void
Exemple #1
0
        public override void Update(ulong updateTick, float deltaTime)
        {
            lock (devicesLock)
            {
                var attachedGamepadsCount = attachedGamepads.Count;
                for (var i = 0; i < attachedGamepadsCount; i++)
                {
                    var gamepad = attachedGamepads[i];
                    var device  = new UWPDevice(gamepad, ++deviceId);
                    InputManager.AttachDevice(device);
                    devices.Add(device);
                }
                attachedGamepads.Clear();

                var detachedGamepadsCount = detachedGamepads.Count;
                for (var i = 0; i < detachedGamepadsCount; i++)
                {
                    var gamepad = detachedGamepads[i];
                    var device  = FindDeviceWithGamepad(gamepad);
                    InputManager.DetachDevice(device);
                    devices.Remove(device);
                }
                detachedGamepads.Clear();
            }
        }
        public override void Update(float updateTime, float deltaTime)
        {
            for (int deviceIndex = 0; deviceIndex < 4; deviceIndex++)
            {
                var device = devices[deviceIndex] as XInputDevice;

                // Unconnected devices won't be updated otherwise, so poll here.
                if (!device.IsConnected)
                {
                    device.Update(updateTime, deltaTime);
                }

                if (device.IsConnected != deviceConnected[deviceIndex])
                {
                    if (device.IsConnected)
                    {
                        InputManager.AttachDevice(device);
                    }
                    else
                    {
                        InputManager.DetachDevice(device);
                    }

                    deviceConnected[deviceIndex] = device.IsConnected;
                }
            }
        }
Exemple #3
0
        void UpdateInternal(ulong updateTick, float deltaTime)
        {
            var deviceCount = devices.Count;

            for (var i = 0; i < deviceCount; i++)
            {
                var device = devices[i];

                var nintendoDevice = device as INintendoSwitchInputDevice;
                if (nintendoDevice != null)
                {
                    nintendoDevice.UpdateInternalState();

                    if (nintendoDevice.IsPresent != device.IsAttached)
                    {
                        if (nintendoDevice.IsPresent)
                        {
                            InputManager.AttachDevice(device);
                        }
                        else
                        {
                            InputManager.DetachDevice(device);
                        }
                    }
                }
            }
        }
Exemple #4
0
        void DetachDevices()
        {
            var deviceCount = devices.Count;

            for (int i = 0; i < deviceCount; i++)
            {
                InputManager.DetachDevice(devices[i]);
            }
            devices.Clear();
        }
Exemple #5
0
        void DetachDevice(UnityInput.InputDevice unityDevice)
        {
            NewUnityInputDevice inputDevice;

            if (internalDevices.TryGetValue(unityDevice.deviceId, out inputDevice))
            {
                internalDevices.Remove(unityDevice.deviceId);
                InputManager.DetachDevice(inputDevice);
            }
        }
Exemple #6
0
        private void DetachDevices()
        {
            int count = devices.Count;

            for (int i = 0; i < count; i++)
            {
                InputManager.DetachDevice(devices[i]);
            }
            devices.Clear();
        }
 private void UpdateInternal(ulong updateTick, float deltaTime)
 {
     for (int i = 0; i < 8; i++)
     {
         XboxOneInputDevice xboxOneInputDevice = devices[i] as XboxOneInputDevice;
         if (xboxOneInputDevice.IsConnected != deviceConnected[i])
         {
             if (xboxOneInputDevice.IsConnected)
             {
                 InputManager.AttachDevice(xboxOneInputDevice);
             }
             else
             {
                 InputManager.DetachDevice(xboxOneInputDevice);
             }
             deviceConnected[i] = xboxOneInputDevice.IsConnected;
         }
     }
 }
        void SetActive(bool value)
        {
            if (active != value)
            {
                active = value;

                ICadeNative.SetActive(active);

                if (active)
                {
                    StartWorker();
                    InputManager.AttachDevice(device);
                }
                else
                {
                    StopWorker();
                    InputManager.DetachDevice(device);
                }
            }
        }
        void UpdateInternal(ulong updateTick, float deltaTime)
        {
            for (var deviceIndex = 0; deviceIndex < maxDevices; deviceIndex++)
            {
                var device = devices[deviceIndex] as XboxOneInputDevice;

                if (device.IsConnected != deviceConnected[deviceIndex])
                {
                    if (device.IsConnected)
                    {
                        InputManager.AttachDevice(device);
                    }
                    else
                    {
                        InputManager.DetachDevice(device);
                    }

                    deviceConnected[deviceIndex] = device.IsConnected;
                }
            }
        }
        public override void Update(ulong updateTick, float deltaTime)
        {
            for (var deviceIndex = 0; deviceIndex < 4; deviceIndex++)
            {
                var device = devices[deviceIndex] as OuyaEverywhereDevice;

                if (device.IsConnected != deviceConnected[deviceIndex])
                {
                    if (device.IsConnected)
                    {
                        device.BeforeAttach();
                        InputManager.AttachDevice(device);
                    }
                    else
                    {
                        InputManager.DetachDevice(device);
                    }

                    deviceConnected[deviceIndex] = device.IsConnected;
                }
            }
        }
Exemple #11
0
        void DetectDetachedJoystickDevices()
        {
            var joystickNames = Input.GetJoystickNames();

            for (int i = devices.Count - 1; i >= 0; i--)
            {
                var inputDevice = devices[i] as UnityInputDevice;

                if (inputDevice.Profile.IsNotJoystick)
                {
                    continue;
                }

                if (joystickNames.Length < inputDevice.JoystickId || !inputDevice.Profile.HasJoystickOrRegexName(joystickNames[inputDevice.JoystickId - 1]))
                {
                    devices.Remove(inputDevice);
                    InputManager.DetachDevice(inputDevice);

                    Debug.Log("Detached device: " + inputDevice.Profile.Name);
                }
            }
        }
 public override void Update(ulong updateTick, float deltaTime)
 {
     for (int i = 0; i < 4; i++)
     {
         XInputDevice xInputDevice = devices[i] as XInputDevice;
         if (!xInputDevice.IsConnected)
         {
             xInputDevice.GetState();
         }
         if (xInputDevice.IsConnected != deviceConnected[i])
         {
             if (xInputDevice.IsConnected)
             {
                 InputManager.AttachDevice(xInputDevice);
             }
             else
             {
                 InputManager.DetachDevice(xInputDevice);
             }
             deviceConnected[i] = xInputDevice.IsConnected;
         }
     }
 }
 void DetachDevice(NativeInputDevice device)
 {
     attachedDevices.Remove(device);
     detachedDevices.Add(device);
     InputManager.DetachDevice(device);
 }