Beispiel #1
0
        public void OnGamepadConnectedHandler(GamepadEventDTO eventDTO)
        {
            var gamepad = _gamepads.Find(g => g.Index == eventDTO.gamepad.index);

            if (gamepad == null)
            {
                var ev = new GamepadEvent(eventDTO);

                _gamepads.Add(ev.Gamepad);

                OnGamepadConnected?.Invoke(ev);
                OnUpdate?.Invoke();
            }
        }
Beispiel #2
0
        public void OnGamepadDisconnectedHandler(GamepadEventDTO eventDTO)
        {
            var gamepad = _gamepads.Find(g => g.Index == eventDTO.gamepad.index);

            if (gamepad != null)
            {
                var ev = new GamepadEvent(gamepad);

                gamepad.Connected = false;
                _gamepads.Remove(gamepad);

                OnGamepadDisconnected?.Invoke(ev);
                OnUpdate?.Invoke();
            }
        }
Beispiel #3
0
 internal GamepadEvent(GamepadEventDTO dto)
 {
     Gamepad = new Gamepad(dto.gamepad);
 }