Пример #1
0
 private void FireDisconnected(XBoxController xbc)
 {
     if (ControllerDisconnected != null)
     {
         ControllerDisconnected(xbc);
     }
 }
Пример #2
0
        private void DetectStates()
        {
            var cCons = XBoxController.GetAllControllers();

            foreach (var xbc in cCons)
            {
                if (!_connectionStates.ContainsKey(xbc.PlayerIndex))
                {
                    _connectionStates[xbc.PlayerIndex] = xbc.IsConnected;
                    if (xbc.IsConnected)
                    {
                        FireConnected(xbc);
                    }
                }

                if (_connectionStates[xbc.PlayerIndex] == false && xbc.IsConnected)
                {
                    _connectionStates[xbc.PlayerIndex] = true;
                    FireConnected(xbc);
                }

                if (_connectionStates[xbc.PlayerIndex] == true && xbc.IsConnected == false)
                {
                    _connectionStates[xbc.PlayerIndex] = false;
                    FireDisconnected(xbc);
                }
            }
        }
Пример #3
0
        private static void InitControllers()
        {
            if (_controllers == null)
            {
                _controllers = new Dictionary <int, XBoxController>();

                _controllers[0] = new XBoxController(new SharpDX.XInput.Controller(SharpDX.XInput.UserIndex.One));
                _controllers[1] = new XBoxController(new SharpDX.XInput.Controller(SharpDX.XInput.UserIndex.Two));
                _controllers[2] = new XBoxController(new SharpDX.XInput.Controller(SharpDX.XInput.UserIndex.Three));
                _controllers[3] = new XBoxController(new SharpDX.XInput.Controller(SharpDX.XInput.UserIndex.Four));
            }
        }
 private void FireDisconnected(XBoxController xbc)
 {
     if (ControllerDisconnected != null)
     {
         ControllerDisconnected(xbc);
     }
 }
        private static void InitControllers()
        {
            if (_controllers == null)
            {
                _controllers = new Dictionary<int, XBoxController>();

                _controllers[0] = new XBoxController(new SharpDX.XInput.Controller(SharpDX.XInput.UserIndex.One));
                _controllers[1] = new XBoxController(new SharpDX.XInput.Controller(SharpDX.XInput.UserIndex.Two));
                _controllers[2] = new XBoxController(new SharpDX.XInput.Controller(SharpDX.XInput.UserIndex.Three));
                _controllers[3] = new XBoxController(new SharpDX.XInput.Controller(SharpDX.XInput.UserIndex.Four));
            }
        }