Пример #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();
            }
        }
Пример #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();
            }
        }
Пример #3
0
 internal GamepadEvent(GamepadEventDTO dto)
 {
     Gamepad = new Gamepad(dto.gamepad);
 }