Exemplo n.º 1
0
        private void fireInputEnd(InputDeviceType inputType, GamePadState gpdState, KeyboardState keyState, MouseState mosState, Keys keyBtn, GamepadCode gpdBtn, MouseCode mosBtn)
        {
            InputObject input = new InputObject(inputType, gpdState, mosState, keyBtn, gpdBtn, mosBtn);

            //General
            for (int i = 0; i < generalListeners.Count; i++)
            {
                GeneralInputListener listener = generalListeners[i];
                listener.InputEnded(input);
                switch (inputType)
                {
                case (InputDeviceType.Gamepad):
                    listener.GamepadInputEnded(input);
                    break;

                case (InputDeviceType.Keyboard):
                    listener.KeyboardInputEnded(input);
                    break;

                case (InputDeviceType.Mouse):
                    listener.MouseInputEnded(input);
                    break;
                }
            }
            //Others
            switch (inputType)
            {
            case (InputDeviceType.Gamepad):
                for (int i = 0; i < gamepadListeners.Count; i++)
                {
                    GamepadListener listener = gamepadListeners[i];
                    listener.InputEnded(input);
                }
                break;

            case (InputDeviceType.Keyboard):
                for (int i = 0; i < keyboardListeners.Count; i++)
                {
                    KeyboardListener listener = keyboardListeners[i];
                    listener.InputEnded(input);
                }
                if (keyboardBinds.ContainsKey(keyBtn))
                {
                    keyboardBinds[keyBtn].Ended();
                }
                break;

            case (InputDeviceType.Mouse):
                for (int i = 0; i < mouseListeners.Count; i++)
                {
                    MouseListener listener = mouseListeners[i];
                    listener.InputEnded(input);
                }
                break;

            default:
                break;
            }
        }