Ejemplo n.º 1
0
    /// <summary>
    /// Get Devices
    /// </summary>
    /// <returns>List<Device></returns>
    public static void HandleAxisEvent(OuyaSDK.InputAxisEvent inputEvent)
    {
        switch (inputEvent.getAxisCode())
        {
        case OuyaSDK.AxisEnum.AXIS_LSTICK_X:
            OuyaInputManager.getPlayerKeyState(inputEvent.getPlayer()).m_axisLeftStickX = inputEvent.getAxis();
            break;

        case OuyaSDK.AxisEnum.AXIS_LSTICK_Y:
            OuyaInputManager.getPlayerKeyState(inputEvent.getPlayer()).m_axisLeftStickY = inputEvent.getAxis();
            break;

        case OuyaSDK.AxisEnum.AXIS_RSTICK_X:
            OuyaInputManager.getPlayerKeyState(inputEvent.getPlayer()).m_axisRightStickX = inputEvent.getAxis();
            break;

        case OuyaSDK.AxisEnum.AXIS_RSTICK_Y:
            OuyaInputManager.getPlayerKeyState(inputEvent.getPlayer()).m_axisRightStickY = inputEvent.getAxis();
            break;

        case OuyaSDK.AxisEnum.AXIS_LTRIGGER:
            OuyaInputManager.getPlayerKeyState(inputEvent.getPlayer()).m_axisLeftTrigger = inputEvent.getAxis();
            break;

        case OuyaSDK.AxisEnum.AXIS_RTRIGGER:
            OuyaInputManager.getPlayerKeyState(inputEvent.getPlayer()).m_axisRightTrigger = inputEvent.getAxis();
            break;
        }
    }
Ejemplo n.º 2
0
    private void InputListener(OuyaSDK.InputAction inputAction, string jsonData)
    {
        #region Error Handling
        if (string.IsNullOrEmpty(jsonData))
        {
            Debug.LogError("OuyaSDK.InputListener: received invalid jsondata");
            return;
        }
        OuyaGameObject.InputData = jsonData;

        if (string.IsNullOrEmpty(OuyaSDK.getDeveloperId()))
        {
            Debug.LogError("SDK is not initialized");
            return;
        }

        //Debug.Log(string.Format("OuyaSDK.InputListener: inputAction={0} jsonData={1}", inputAction, jsonData));

        if (null == OuyaSDK.getInputAxisListener())
        {
            Debug.LogError("OuyaSDK.InputListener: Input axis listener is not set");
            return;
        }

        if (null == OuyaSDK.getInputAxisListener().onSuccess)
        {
            Debug.LogError("OuyaSDK.InputListener: Input axis listener onSuccess is not set");
            return;
        }

        if (null == OuyaSDK.getInputButtonListener())
        {
            Debug.LogError("OuyaSDK.InputListener: Input button listener is not set");
            return;
        }

        if (null == OuyaSDK.getInputButtonListener().onSuccess)
        {
            Debug.LogError("OuyaSDK.InputListener: Input button listener onSuccess is not set");
            return;
        }
        #endregion

        InputContainer container = JsonMapper.ToObject<InputContainer>(jsonData);
        OuyaSDK.InputAxisEvent inputAxis;
        OuyaSDK.InputButtonEvent inputButton;

        if (null == container)
        {
            return;
        }

        Device device = devices.Find(delegate(Device d) { return (null == d || null == container) ? false : (d.id == container.DeviceId); });
        if (null == device)
        {
            return;
        }

        if (!debugOff)
        {
            Debug.Log("Device:" + device.id + " Player" + device.player);
        }

        /// @todo: ADD_CONTROLLER_NAME

        switch (container.DeviceName.ToUpper())
        {
            #region OUYA Game Controller
            case "BLUETOOTH JOYSTICK":
            case "OUYA GAME CONTROLLER":
                switch (inputAction)
                {
                    #region KeyDown
                    case OuyaSDK.InputAction.KeyDown:
                        if (container.KeyEvent.mRepeatCount == 0 || container.KeyEvent.mRepeatCount > 5)
                        {
                            switch (container.KeyEvent.mKeyCode)
                            {
                                case 97:
                                    inputButton = new OuyaSDK.InputButtonEvent(inputAction, OuyaSDK.KeyEnum.BUTTON_A, device.player);
                                    OuyaSDK.getInputButtonListener().onSuccess(inputButton);
                                    break;
                                case 96:
                                    inputButton = new OuyaSDK.InputButtonEvent(inputAction, OuyaSDK.KeyEnum.BUTTON_O, device.player);
                                    OuyaSDK.getInputButtonListener().onSuccess(inputButton);
                                    break;
                                case 99:
                                    inputButton = new OuyaSDK.InputButtonEvent(inputAction, OuyaSDK.KeyEnum.BUTTON_U, device.player);
                                    OuyaSDK.getInputButtonListener().onSuccess(inputButton);
                                    break;
                                case 100:
                                    inputButton = new OuyaSDK.InputButtonEvent(inputAction, OuyaSDK.KeyEnum.BUTTON_Y, device.player);
                                    OuyaSDK.getInputButtonListener().onSuccess(inputButton);
                                    break;

                                case 102:
                                    inputButton = new OuyaSDK.InputButtonEvent(inputAction, OuyaSDK.KeyEnum.BUTTON_LB, device.player);
                                    OuyaSDK.getInputButtonListener().onSuccess(inputButton);
                                    break;
                                case 104:
                                    inputButton = new OuyaSDK.InputButtonEvent(inputAction, OuyaSDK.KeyEnum.BUTTON_LT, device.player);
                                    OuyaSDK.getInputButtonListener().onSuccess(inputButton);
                                    break;
                                case 106:
                                    inputButton = new OuyaSDK.InputButtonEvent(inputAction, OuyaSDK.KeyEnum.BUTTON_L3, device.player);
                                    OuyaSDK.getInputButtonListener().onSuccess(inputButton);
                                    break;

                                case 103:
                                    inputButton = new OuyaSDK.InputButtonEvent(inputAction, OuyaSDK.KeyEnum.BUTTON_RB, device.player);
                                    OuyaSDK.getInputButtonListener().onSuccess(inputButton);
                                    break;
                                case 105:
                                    inputButton = new OuyaSDK.InputButtonEvent(inputAction, OuyaSDK.KeyEnum.BUTTON_RT, device.player);
                                    OuyaSDK.getInputButtonListener().onSuccess(inputButton);
                                    break;
                                case 107:
                                    inputButton = new OuyaSDK.InputButtonEvent(inputAction, OuyaSDK.KeyEnum.BUTTON_R3, device.player);
                                    OuyaSDK.getInputButtonListener().onSuccess(inputButton);
                                    break;
                                case 108:
                                    inputButton = new OuyaSDK.InputButtonEvent(inputAction, OuyaSDK.KeyEnum.BUTTON_SYSTEM, device.player);
                                    OuyaSDK.getInputButtonListener().onSuccess(inputButton);
                                    break;
                                case 19:
                                    inputButton = new OuyaSDK.InputButtonEvent(inputAction, OuyaSDK.KeyEnum.BUTTON_DPAD_UP, device.player);
                                    OuyaSDK.getInputButtonListener().onSuccess(inputButton);
                                    break;
                                case 20:
                                    inputButton = new OuyaSDK.InputButtonEvent(inputAction, OuyaSDK.KeyEnum.BUTTON_DPAD_DOWN, device.player);
                                    OuyaSDK.getInputButtonListener().onSuccess(inputButton);
                                    break;
                                case 21:
                                    inputButton = new OuyaSDK.InputButtonEvent(inputAction, OuyaSDK.KeyEnum.BUTTON_DPAD_LEFT, device.player);
                                    OuyaSDK.getInputButtonListener().onSuccess(inputButton);
                                    break;
                                case 22:
                                    inputButton = new OuyaSDK.InputButtonEvent(inputAction, OuyaSDK.KeyEnum.BUTTON_DPAD_RIGHT, device.player);
                                    OuyaSDK.getInputButtonListener().onSuccess(inputButton);
                                    break;

                                case 82:
                                    inputButton = new OuyaSDK.InputButtonEvent(inputAction, OuyaSDK.KeyEnum.BUTTON_SYSTEM, device.player);
                                    OuyaSDK.getInputButtonListener().onSuccess(inputButton);
                                    break;

                                default:
                                    Debug.Log("Unhandled " + inputAction + ": " + container.KeyEvent.mKeyCode);
                                    break;
                            }
                        }
                        break;
                    #endregion

                    #region KeyUp
                    case OuyaSDK.InputAction.KeyUp:
                        switch (container.KeyEvent.mKeyCode)
                        {
                            case 97:
                                inputButton = new OuyaSDK.InputButtonEvent(inputAction, OuyaSDK.KeyEnum.BUTTON_A, device.player);
                                OuyaSDK.getInputButtonListener().onSuccess(inputButton);
                                break;
                            case 96:
                                inputButton = new OuyaSDK.InputButtonEvent(inputAction, OuyaSDK.KeyEnum.BUTTON_O, device.player);
                                OuyaSDK.getInputButtonListener().onSuccess(inputButton);
                                break;
                            case 99:
                                inputButton = new OuyaSDK.InputButtonEvent(inputAction, OuyaSDK.KeyEnum.BUTTON_U, device.player);
                                OuyaSDK.getInputButtonListener().onSuccess(inputButton);
                                break;
                            case 100:
                                inputButton = new OuyaSDK.InputButtonEvent(inputAction, OuyaSDK.KeyEnum.BUTTON_Y, device.player);
                                OuyaSDK.getInputButtonListener().onSuccess(inputButton);
                                break;

                            case 102:
                                inputButton = new OuyaSDK.InputButtonEvent(inputAction, OuyaSDK.KeyEnum.BUTTON_LB, device.player);
                                OuyaSDK.getInputButtonListener().onSuccess(inputButton);
                                break;
                            case 104:
                                inputButton = new OuyaSDK.InputButtonEvent(inputAction, OuyaSDK.KeyEnum.BUTTON_LT, device.player);
                                OuyaSDK.getInputButtonListener().onSuccess(inputButton);
                                break;
                            case 106:
                                inputButton = new OuyaSDK.InputButtonEvent(inputAction, OuyaSDK.KeyEnum.BUTTON_L3, device.player);
                                OuyaSDK.getInputButtonListener().onSuccess(inputButton);
                                break;

                            case 103:
                                inputButton = new OuyaSDK.InputButtonEvent(inputAction, OuyaSDK.KeyEnum.BUTTON_RB, device.player);
                                OuyaSDK.getInputButtonListener().onSuccess(inputButton);
                                break;
                            case 105:
                                inputButton = new OuyaSDK.InputButtonEvent(inputAction, OuyaSDK.KeyEnum.BUTTON_RT, device.player);
                                OuyaSDK.getInputButtonListener().onSuccess(inputButton);
                                break;
                            case 107:
                                inputButton = new OuyaSDK.InputButtonEvent(inputAction, OuyaSDK.KeyEnum.BUTTON_R3, device.player);
                                OuyaSDK.getInputButtonListener().onSuccess(inputButton);
                                break;
                            case 108:
                                inputButton = new OuyaSDK.InputButtonEvent(inputAction, OuyaSDK.KeyEnum.BUTTON_SYSTEM, device.player);
                                OuyaSDK.getInputButtonListener().onSuccess(inputButton);
                                break;
                            case 19:
                                inputButton = new OuyaSDK.InputButtonEvent(inputAction, OuyaSDK.KeyEnum.BUTTON_DPAD_UP, device.player);
                                OuyaSDK.getInputButtonListener().onSuccess(inputButton);
                                break;
                            case 20:
                                inputButton = new OuyaSDK.InputButtonEvent(inputAction, OuyaSDK.KeyEnum.BUTTON_DPAD_DOWN, device.player);
                                OuyaSDK.getInputButtonListener().onSuccess(inputButton);
                                break;
                            case 21:
                                inputButton = new OuyaSDK.InputButtonEvent(inputAction, OuyaSDK.KeyEnum.BUTTON_DPAD_LEFT, device.player);
                                OuyaSDK.getInputButtonListener().onSuccess(inputButton);
                                break;
                            case 22:
                                inputButton = new OuyaSDK.InputButtonEvent(inputAction, OuyaSDK.KeyEnum.BUTTON_DPAD_RIGHT, device.player);
                                OuyaSDK.getInputButtonListener().onSuccess(inputButton);
                                break;

                            case 82:
                                inputButton = new OuyaSDK.InputButtonEvent(inputAction, OuyaSDK.KeyEnum.BUTTON_SYSTEM, device.player);
                                OuyaSDK.getInputButtonListener().onSuccess(inputButton);
                                break;

                            default:
                                Debug.Log("Unhandled " + inputAction + ": " + container.KeyEvent.mKeyCode);
                                break;
                        }
                        break;
                    #endregion

                    #region GenericMotionEvent
                    case OuyaSDK.InputAction.GenericMotionEvent:
                        inputAxis = new OuyaSDK.InputAxisEvent(inputAction, OuyaSDK.AxisEnum.AXIS_LSTICK_X, container.AxisX, device.player);
                        OuyaSDK.getInputAxisListener().onSuccess(inputAxis);

                        inputAxis = new OuyaSDK.InputAxisEvent(inputAction, OuyaSDK.AxisEnum.AXIS_LSTICK_Y, container.AxisY, device.player);
                        OuyaSDK.getInputAxisListener().onSuccess(inputAxis);

                        inputAxis = new OuyaSDK.InputAxisEvent(inputAction, OuyaSDK.AxisEnum.AXIS_RSTICK_X, container.AxisZ, device.player);
                        OuyaSDK.getInputAxisListener().onSuccess(inputAxis);

                        inputAxis = new OuyaSDK.InputAxisEvent(inputAction, OuyaSDK.AxisEnum.AXIS_RSTICK_Y, container.AxisRZ, device.player);
                        OuyaSDK.getInputAxisListener().onSuccess(inputAxis);

                        inputAxis = new OuyaSDK.InputAxisEvent(inputAction, OuyaSDK.AxisEnum.AXIS_LTRIGGER, container.AxisLTrigger, device.player);
                        OuyaSDK.getInputAxisListener().onSuccess(inputAxis);

                        inputAxis = new OuyaSDK.InputAxisEvent(inputAction, OuyaSDK.AxisEnum.AXIS_RTRIGGER, container.AxisRTrigger, device.player);
                        OuyaSDK.getInputAxisListener().onSuccess(inputAxis);

                        break;
                    #endregion
                }
                break;
            #endregion

            #region XBOX 360 WIRELESS RECEIVER & Microsoft X-Box 360 pad
            case "XBOX 360 WIRELESS RECEIVER":
            case "CONTROLLER (AFTERGLOW GAMEPAD FOR XBOX 360)":
            case "CONTROLLER (ROCK CANDY GAMEPAD FOR XBOX 360)":
            case "CONTROLLER (XBOX 360 WIRELESS RECEIVER FOR WINDOWS)":
            case "MICROSOFT X-BOX 360 PAD":
            case "CONTROLLER (XBOX 360 FOR WINDOWS)":
            case "CONTROLLER (XBOX360 GAMEPAD)":
            case "XBOX 360 FOR WINDOWS (CONTROLLER)":
                switch (inputAction)
                {
                    #region KeyDown
                    case OuyaSDK.InputAction.KeyDown:
                        if (container.KeyEvent.mRepeatCount == 0 || container.KeyEvent.mRepeatCount > 5)
                        {
                            if (container.KeyEvent.mKeyCode == 97)
                            {
                                inputButton = new OuyaSDK.InputButtonEvent(inputAction, OuyaSDK.KeyEnum.BUTTON_A, device.player);
                                OuyaSDK.getInputButtonListener().onSuccess(inputButton);
                            }
                            if (container.KeyEvent.mKeyCode == 96)
                            {
                                inputButton = new OuyaSDK.InputButtonEvent(inputAction, OuyaSDK.KeyEnum.BUTTON_O, device.player);
                                OuyaSDK.getInputButtonListener().onSuccess(inputButton);
                            }
                            if (container.KeyEvent.mKeyCode == 99)
                            {
                                inputButton = new OuyaSDK.InputButtonEvent(inputAction, OuyaSDK.KeyEnum.BUTTON_U, device.player);
                                OuyaSDK.getInputButtonListener().onSuccess(inputButton);
                            }
                            if (container.KeyEvent.mKeyCode == 100)
                            {
                                inputButton = new OuyaSDK.InputButtonEvent(inputAction, OuyaSDK.KeyEnum.BUTTON_Y, device.player);
                                OuyaSDK.getInputButtonListener().onSuccess(inputButton);
                            }
                            if (container.KeyEvent.mKeyCode == 102)
                            {
                                inputButton = new OuyaSDK.InputButtonEvent(inputAction, OuyaSDK.KeyEnum.BUTTON_LB, device.player);
                                OuyaSDK.getInputButtonListener().onSuccess(inputButton);
                            }
                            if (container.KeyEvent.mKeyCode == 103)
                            {
                                inputButton = new OuyaSDK.InputButtonEvent(inputAction, OuyaSDK.KeyEnum.BUTTON_RB, device.player);
                                OuyaSDK.getInputButtonListener().onSuccess(inputButton);
                            }
                            if (container.KeyEvent.mKeyCode == 106)
                            {
                                inputButton = new OuyaSDK.InputButtonEvent(inputAction, OuyaSDK.KeyEnum.BUTTON_L3, device.player);
                                OuyaSDK.getInputButtonListener().onSuccess(inputButton);
                            }
                            if (container.KeyEvent.mKeyCode == 107)
                            {
                                inputButton = new OuyaSDK.InputButtonEvent(inputAction, OuyaSDK.KeyEnum.BUTTON_R3, device.player);
                                OuyaSDK.getInputButtonListener().onSuccess(inputButton);
                            }
                        }
                        break;
                    #endregion

                    #region KeyUp
                    case OuyaSDK.InputAction.KeyUp:
                        if (container.KeyEvent.mKeyCode == 97)
                        {
                            inputButton = new OuyaSDK.InputButtonEvent(inputAction, OuyaSDK.KeyEnum.BUTTON_A, device.player);
                            OuyaSDK.getInputButtonListener().onSuccess(inputButton);
                        }
                        if (container.KeyEvent.mKeyCode == 96)
                        {
                            inputButton = new OuyaSDK.InputButtonEvent(inputAction, OuyaSDK.KeyEnum.BUTTON_O, device.player);
                            OuyaSDK.getInputButtonListener().onSuccess(inputButton);
                        }
                        if (container.KeyEvent.mKeyCode == 99)
                        {
                            inputButton = new OuyaSDK.InputButtonEvent(inputAction, OuyaSDK.KeyEnum.BUTTON_U, device.player);
                            OuyaSDK.getInputButtonListener().onSuccess(inputButton);
                        }
                        if (container.KeyEvent.mKeyCode == 100)
                        {
                            inputButton = new OuyaSDK.InputButtonEvent(inputAction, OuyaSDK.KeyEnum.BUTTON_Y, device.player);
                            OuyaSDK.getInputButtonListener().onSuccess(inputButton);
                        }
                        if (container.KeyEvent.mKeyCode == 102)
                        {
                            inputButton = new OuyaSDK.InputButtonEvent(inputAction, OuyaSDK.KeyEnum.BUTTON_LB, device.player);
                            OuyaSDK.getInputButtonListener().onSuccess(inputButton);
                        }
                        if (container.KeyEvent.mKeyCode == 103)
                        {
                            inputButton = new OuyaSDK.InputButtonEvent(inputAction, OuyaSDK.KeyEnum.BUTTON_RB, device.player);
                            OuyaSDK.getInputButtonListener().onSuccess(inputButton);
                        }
                        if (container.KeyEvent.mKeyCode == 106)
                        {
                            inputButton = new OuyaSDK.InputButtonEvent(inputAction, OuyaSDK.KeyEnum.BUTTON_L3, device.player);
                            OuyaSDK.getInputButtonListener().onSuccess(inputButton);
                        }
                        if (container.KeyEvent.mKeyCode == 107)
                        {
                            inputButton = new OuyaSDK.InputButtonEvent(inputAction, OuyaSDK.KeyEnum.BUTTON_R3, device.player);
                            OuyaSDK.getInputButtonListener().onSuccess(inputButton);
                        }
                        break;
                    #endregion

                    #region GenericMotionEvent
                    case OuyaSDK.InputAction.GenericMotionEvent:
                        if (container.AxisHatY == -1)
                        {
                            inputButton = new OuyaSDK.InputButtonEvent(inputAction, OuyaSDK.KeyEnum.BUTTON_DPAD_UP, device.player);
                            OuyaSDK.getInputButtonListener().onSuccess(inputButton);
                        }

                        if (container.AxisHatY == 1)
                        {
                            inputButton = new OuyaSDK.InputButtonEvent(inputAction, OuyaSDK.KeyEnum.BUTTON_DPAD_DOWN, device.player);
                            OuyaSDK.getInputButtonListener().onSuccess(inputButton);
                        }

                        if (container.AxisHatX == -1)
                        {
                            inputButton = new OuyaSDK.InputButtonEvent(inputAction, OuyaSDK.KeyEnum.BUTTON_DPAD_LEFT, device.player);
                            OuyaSDK.getInputButtonListener().onSuccess(inputButton);
                        }

                        if (container.AxisHatX == 1)
                        {
                            inputButton = new OuyaSDK.InputButtonEvent(inputAction, OuyaSDK.KeyEnum.BUTTON_DPAD_RIGHT, device.player);
                            OuyaSDK.getInputButtonListener().onSuccess(inputButton);
                        }

                        if (container.AxisHatX == 0 &&
                            container.AxisHatY == 0)
                        {
                            inputButton = new OuyaSDK.InputButtonEvent(inputAction, OuyaSDK.KeyEnum.BUTTON_DPAD_CENTER, device.player);
                            OuyaSDK.getInputButtonListener().onSuccess(inputButton);
                        }

                        inputAxis = new OuyaSDK.InputAxisEvent(inputAction, OuyaSDK.AxisEnum.AXIS_LSTICK_X, container.AxisX, device.player);
                        OuyaSDK.getInputAxisListener().onSuccess(inputAxis);

                        inputAxis = new OuyaSDK.InputAxisEvent(inputAction, OuyaSDK.AxisEnum.AXIS_LSTICK_Y, container.AxisY, device.player);
                        OuyaSDK.getInputAxisListener().onSuccess(inputAxis);

                        inputAxis = new OuyaSDK.InputAxisEvent(inputAction, OuyaSDK.AxisEnum.AXIS_RSTICK_X, container.AxisZ, device.player);
                        OuyaSDK.getInputAxisListener().onSuccess(inputAxis);

                        inputAxis = new OuyaSDK.InputAxisEvent(inputAction, OuyaSDK.AxisEnum.AXIS_RSTICK_Y, container.AxisRZ, device.player);
                        OuyaSDK.getInputAxisListener().onSuccess(inputAxis);

                        inputAxis = new OuyaSDK.InputAxisEvent(inputAction, OuyaSDK.AxisEnum.AXIS_LTRIGGER, container.AxisLTrigger, device.player);
                        OuyaSDK.getInputAxisListener().onSuccess(inputAxis);

                        inputAxis = new OuyaSDK.InputAxisEvent(inputAction, OuyaSDK.AxisEnum.AXIS_RTRIGGER, container.AxisRTrigger, device.player);
                        OuyaSDK.getInputAxisListener().onSuccess(inputAxis);

                        /*
                        if (container.AxisLTrigger > 0.1f)
                        {
                            inputButton = new OuyaSDK.InputButtonEvent(OuyaSDK.InputAction.KeyDown, OuyaSDK.KeyEnum.BUTTON_LT, device.player);
                            OuyaSDK.getInputButtonListener().onSuccess(inputButton);
                            m_detectLTriggerDown = true;
                        }
                        else if (m_detectLTriggerDown)
                        {
                            m_detectLTriggerDown = false;
                            inputButton = new OuyaSDK.InputButtonEvent(OuyaSDK.InputAction.KeyUp, OuyaSDK.KeyEnum.BUTTON_LT, device.player);
                            OuyaSDK.getInputButtonListener().onSuccess(inputButton);
                        }

                        if (container.AxisRTrigger > 0.1f)
                        {
                            inputButton = new OuyaSDK.InputButtonEvent(OuyaSDK.InputAction.KeyDown, OuyaSDK.KeyEnum.BUTTON_RT, device.player);
                            OuyaSDK.getInputButtonListener().onSuccess(inputButton);
                            m_detectRTriggerDown = true;
                        }
                        else if (m_detectRTriggerDown)
                        {
                            m_detectRTriggerDown = false;
                            inputButton = new OuyaSDK.InputButtonEvent(OuyaSDK.InputAction.KeyUp, OuyaSDK.KeyEnum.BUTTON_RT, device.player);
                            OuyaSDK.getInputButtonListener().onSuccess(inputButton);
                        }
                         */

                        break;
                    #endregion
                }
                break;
            #endregion

            #region idroid:con
            case "IDROID:CON":
                switch (inputAction)
                {
                    #region KeyDown
                    case OuyaSDK.InputAction.KeyDown:
                        if (container.KeyEvent.mRepeatCount == 0 || container.KeyEvent.mRepeatCount > 5)
                        {
                            if (container.KeyEvent.mKeyCode == 189)
                            {
                                inputButton = new OuyaSDK.InputButtonEvent(inputAction, OuyaSDK.KeyEnum.BUTTON_A, device.player);
                                OuyaSDK.getInputButtonListener().onSuccess(inputButton);
                            }
                            if (container.KeyEvent.mKeyCode == 188)
                            {
                                inputButton = new OuyaSDK.InputButtonEvent(inputAction, OuyaSDK.KeyEnum.BUTTON_O, device.player);
                                OuyaSDK.getInputButtonListener().onSuccess(inputButton);
                            }
                            if (container.KeyEvent.mKeyCode == 190)
                            {
                                inputButton = new OuyaSDK.InputButtonEvent(inputAction, OuyaSDK.KeyEnum.BUTTON_U, device.player);
                                OuyaSDK.getInputButtonListener().onSuccess(inputButton);
                            }
                            if (container.KeyEvent.mKeyCode == 191)
                            {
                                inputButton = new OuyaSDK.InputButtonEvent(inputAction, OuyaSDK.KeyEnum.BUTTON_Y, device.player);
                                OuyaSDK.getInputButtonListener().onSuccess(inputButton);
                            }
                            if (container.KeyEvent.mKeyCode == 192)
                            {
                                inputButton = new OuyaSDK.InputButtonEvent(inputAction, OuyaSDK.KeyEnum.BUTTON_LB, device.player);
                                OuyaSDK.getInputButtonListener().onSuccess(inputButton);
                            }
                            if (container.KeyEvent.mKeyCode == 193)
                            {
                                inputButton = new OuyaSDK.InputButtonEvent(inputAction, OuyaSDK.KeyEnum.BUTTON_RB, device.player);
                                OuyaSDK.getInputButtonListener().onSuccess(inputButton);
                            }
                        }
                        break;
                    #endregion

                    #region KeyUp
                    case OuyaSDK.InputAction.KeyUp:
                        if (container.KeyEvent.mKeyCode == 189)
                        {
                            inputButton = new OuyaSDK.InputButtonEvent(inputAction, OuyaSDK.KeyEnum.BUTTON_A, device.player);
                            OuyaSDK.getInputButtonListener().onSuccess(inputButton);
                        }
                        if (container.KeyEvent.mKeyCode == 188)
                        {
                            inputButton = new OuyaSDK.InputButtonEvent(inputAction, OuyaSDK.KeyEnum.BUTTON_O, device.player);
                            OuyaSDK.getInputButtonListener().onSuccess(inputButton);
                        }
                        if (container.KeyEvent.mKeyCode == 190)
                        {
                            inputButton = new OuyaSDK.InputButtonEvent(inputAction, OuyaSDK.KeyEnum.BUTTON_U, device.player);
                            OuyaSDK.getInputButtonListener().onSuccess(inputButton);
                        }
                        if (container.KeyEvent.mKeyCode == 191)
                        {
                            inputButton = new OuyaSDK.InputButtonEvent(inputAction, OuyaSDK.KeyEnum.BUTTON_Y, device.player);
                            OuyaSDK.getInputButtonListener().onSuccess(inputButton);
                        }
                        if (container.KeyEvent.mKeyCode == 192)
                        {
                            inputButton = new OuyaSDK.InputButtonEvent(inputAction, OuyaSDK.KeyEnum.BUTTON_LB, device.player);
                            OuyaSDK.getInputButtonListener().onSuccess(inputButton);
                        }
                        if (container.KeyEvent.mKeyCode == 193)
                        {
                            inputButton = new OuyaSDK.InputButtonEvent(inputAction, OuyaSDK.KeyEnum.BUTTON_RB, device.player);
                            OuyaSDK.getInputButtonListener().onSuccess(inputButton);
                        }
                        break;
                    #endregion

                    #region GenericMotionEvent
                    case OuyaSDK.InputAction.GenericMotionEvent:
                        if (container.AxisHatY == -1)
                        {
                            inputButton = new OuyaSDK.InputButtonEvent(inputAction, OuyaSDK.KeyEnum.BUTTON_DPAD_UP, device.player);
                            OuyaSDK.getInputButtonListener().onSuccess(inputButton);
                        }

                        if (container.AxisHatY == 1)
                        {
                            inputButton = new OuyaSDK.InputButtonEvent(inputAction, OuyaSDK.KeyEnum.BUTTON_DPAD_DOWN, device.player);
                            OuyaSDK.getInputButtonListener().onSuccess(inputButton);
                        }

                        if (container.AxisHatX == -1)
                        {
                            inputButton = new OuyaSDK.InputButtonEvent(inputAction, OuyaSDK.KeyEnum.BUTTON_DPAD_LEFT, device.player);
                            OuyaSDK.getInputButtonListener().onSuccess(inputButton);
                        }

                        if (container.AxisHatX == 1)
                        {
                            inputButton = new OuyaSDK.InputButtonEvent(inputAction, OuyaSDK.KeyEnum.BUTTON_DPAD_RIGHT, device.player);
                            OuyaSDK.getInputButtonListener().onSuccess(inputButton);
                        }

                        if (container.AxisHatX == 0 &&
                            container.AxisHatY == 0)
                        {
                            inputButton = new OuyaSDK.InputButtonEvent(inputAction, OuyaSDK.KeyEnum.BUTTON_DPAD_CENTER, device.player);
                            OuyaSDK.getInputButtonListener().onSuccess(inputButton);
                        }

                        inputAxis = new OuyaSDK.InputAxisEvent(inputAction, OuyaSDK.AxisEnum.AXIS_LSTICK_X, container.AxisX, device.player);
                        OuyaSDK.getInputAxisListener().onSuccess(inputAxis);

                        inputAxis = new OuyaSDK.InputAxisEvent(inputAction, OuyaSDK.AxisEnum.AXIS_LSTICK_Y, container.AxisY, device.player);
                        OuyaSDK.getInputAxisListener().onSuccess(inputAxis);

                        inputAxis = new OuyaSDK.InputAxisEvent(inputAction, OuyaSDK.AxisEnum.AXIS_RSTICK_X, container.AxisRX, device.player);
                        OuyaSDK.getInputAxisListener().onSuccess(inputAxis);

                        inputAxis = new OuyaSDK.InputAxisEvent(inputAction, OuyaSDK.AxisEnum.AXIS_RSTICK_Y, container.AxisRY, device.player);
                        OuyaSDK.getInputAxisListener().onSuccess(inputAxis);

                        inputAxis = new OuyaSDK.InputAxisEvent(inputAction, OuyaSDK.AxisEnum.AXIS_LTRIGGER, container.AxisZ, device.player);
                        OuyaSDK.getInputAxisListener().onSuccess(inputAxis);

                        inputAxis = new OuyaSDK.InputAxisEvent(inputAction, OuyaSDK.AxisEnum.AXIS_RTRIGGER, container.AxisZ, device.player);
                        OuyaSDK.getInputAxisListener().onSuccess(inputAxis);
                        /*
                        if (container.AxisZ > 0.1f)
                        {
                            inputButton = new OuyaSDK.InputButtonEvent(OuyaSDK.InputAction.KeyDown, OuyaSDK.KeyEnum.BUTTON_LT, device.player);
                            OuyaSDK.getInputButtonListener().onSuccess(inputButton);
                            m_detectLTriggerDown = true;
                        }
                        else if (m_detectLTriggerDown)
                        {
                            m_detectLTriggerDown = false;
                            inputButton = new OuyaSDK.InputButtonEvent(OuyaSDK.InputAction.KeyUp, OuyaSDK.KeyEnum.BUTTON_LT, device.player);
                            OuyaSDK.getInputButtonListener().onSuccess(inputButton);
                        }

                        if (container.AxisZ < -0.1f)
                        {
                            inputButton = new OuyaSDK.InputButtonEvent(OuyaSDK.InputAction.KeyDown, OuyaSDK.KeyEnum.BUTTON_RT, device.player);
                            OuyaSDK.getInputButtonListener().onSuccess(inputButton);
                            m_detectRTriggerDown = true;
                        }
                        else if (m_detectRTriggerDown)
                        {
                            m_detectRTriggerDown = false;
                            inputButton = new OuyaSDK.InputButtonEvent(OuyaSDK.InputAction.KeyUp, OuyaSDK.KeyEnum.BUTTON_RT, device.player);
                            OuyaSDK.getInputButtonListener().onSuccess(inputButton);
                        }
                         */

                        break;
                    #endregion
                }
                break;
            #endregion

            #region PS3 MotionInJoy Game Controller ( Driver required )
            case "MOTIONINJOY VIRTUAL GAME CONTROLLER":
                switch (inputAction)
                {
                    #region KeyDown
                    case OuyaSDK.InputAction.KeyDown:
                        if (container.KeyEvent.mRepeatCount == 0 || container.KeyEvent.mRepeatCount > 5)
                        {
                            switch (container.KeyEvent.mKeyCode)
                            {
                                case 97:
                                    inputButton = new OuyaSDK.InputButtonEvent(inputAction, OuyaSDK.KeyEnum.BUTTON_A, device.player);
                                    OuyaSDK.getInputButtonListener().onSuccess(inputButton);
                                    break;
                                case 96:
                                    inputButton = new OuyaSDK.InputButtonEvent(inputAction, OuyaSDK.KeyEnum.BUTTON_O, device.player);
                                    OuyaSDK.getInputButtonListener().onSuccess(inputButton);
                                    break;
                                case 99:
                                    inputButton = new OuyaSDK.InputButtonEvent(inputAction, OuyaSDK.KeyEnum.BUTTON_U, device.player);
                                    OuyaSDK.getInputButtonListener().onSuccess(inputButton);
                                    break;
                                case 100:
                                    inputButton = new OuyaSDK.InputButtonEvent(inputAction, OuyaSDK.KeyEnum.BUTTON_Y, device.player);
                                    OuyaSDK.getInputButtonListener().onSuccess(inputButton);
                                    break;

                                case 102:
                                    inputButton = new OuyaSDK.InputButtonEvent(inputAction, OuyaSDK.KeyEnum.BUTTON_LB, device.player);
                                    OuyaSDK.getInputButtonListener().onSuccess(inputButton);
                                    break;
                                case 104:
                                    inputButton = new OuyaSDK.InputButtonEvent(inputAction, OuyaSDK.KeyEnum.BUTTON_LT, device.player);
                                    OuyaSDK.getInputButtonListener().onSuccess(inputButton);
                                    break;
                                case 106:
                                    inputButton = new OuyaSDK.InputButtonEvent(inputAction, OuyaSDK.KeyEnum.BUTTON_L3, device.player);
                                    OuyaSDK.getInputButtonListener().onSuccess(inputButton);
                                    break;

                                case 103:
                                    inputButton = new OuyaSDK.InputButtonEvent(inputAction, OuyaSDK.KeyEnum.BUTTON_RB, device.player);
                                    OuyaSDK.getInputButtonListener().onSuccess(inputButton);
                                    break;
                                case 105:
                                    inputButton = new OuyaSDK.InputButtonEvent(inputAction, OuyaSDK.KeyEnum.BUTTON_RT, device.player);
                                    OuyaSDK.getInputButtonListener().onSuccess(inputButton);
                                    break;
                                case 107:
                                    inputButton = new OuyaSDK.InputButtonEvent(inputAction, OuyaSDK.KeyEnum.BUTTON_R3, device.player);
                                    OuyaSDK.getInputButtonListener().onSuccess(inputButton);
                                    break;

                                case 108:
                                    inputButton = new OuyaSDK.InputButtonEvent(inputAction, OuyaSDK.KeyEnum.BUTTON_SYSTEM, device.player);
                                    OuyaSDK.getInputButtonListener().onSuccess(inputButton);
                                    break;

                                case 19:
                                    inputButton = new OuyaSDK.InputButtonEvent(inputAction, OuyaSDK.KeyEnum.BUTTON_DPAD_UP, device.player);
                                    OuyaSDK.getInputButtonListener().onSuccess(inputButton);
                                    break;
                                case 20:
                                    inputButton = new OuyaSDK.InputButtonEvent(inputAction, OuyaSDK.KeyEnum.BUTTON_DPAD_DOWN, device.player);
                                    OuyaSDK.getInputButtonListener().onSuccess(inputButton);
                                    break;
                                case 21:
                                    inputButton = new OuyaSDK.InputButtonEvent(inputAction, OuyaSDK.KeyEnum.BUTTON_DPAD_LEFT, device.player);
                                    OuyaSDK.getInputButtonListener().onSuccess(inputButton);
                                    break;
                                case 22:
                                    inputButton = new OuyaSDK.InputButtonEvent(inputAction, OuyaSDK.KeyEnum.BUTTON_DPAD_RIGHT, device.player);
                                    OuyaSDK.getInputButtonListener().onSuccess(inputButton);
                                    break;

                                default:
                                    Debug.Log("Unhandled " + inputAction + ": " + container.KeyEvent.mKeyCode);
                                    break;
                            }
                        }
                        break;
                    #endregion

                    #region KeyUp
                    case OuyaSDK.InputAction.KeyUp:
                        switch (container.KeyEvent.mKeyCode)
                        {
                            case 97:
                                inputButton = new OuyaSDK.InputButtonEvent(inputAction, OuyaSDK.KeyEnum.BUTTON_A, device.player);
                                OuyaSDK.getInputButtonListener().onSuccess(inputButton);
                                break;
                            case 96:
                                inputButton = new OuyaSDK.InputButtonEvent(inputAction, OuyaSDK.KeyEnum.BUTTON_O, device.player);
                                OuyaSDK.getInputButtonListener().onSuccess(inputButton);
                                break;
                            case 99:
                                inputButton = new OuyaSDK.InputButtonEvent(inputAction, OuyaSDK.KeyEnum.BUTTON_U, device.player);
                                OuyaSDK.getInputButtonListener().onSuccess(inputButton);
                                break;
                            case 100:
                                inputButton = new OuyaSDK.InputButtonEvent(inputAction, OuyaSDK.KeyEnum.BUTTON_Y, device.player);
                                OuyaSDK.getInputButtonListener().onSuccess(inputButton);
                                break;

                            case 102:
                                inputButton = new OuyaSDK.InputButtonEvent(inputAction, OuyaSDK.KeyEnum.BUTTON_LB, device.player);
                                OuyaSDK.getInputButtonListener().onSuccess(inputButton);
                                break;
                            case 104:
                                inputButton = new OuyaSDK.InputButtonEvent(inputAction, OuyaSDK.KeyEnum.BUTTON_LT, device.player);
                                OuyaSDK.getInputButtonListener().onSuccess(inputButton);
                                break;
                            case 106:
                                inputButton = new OuyaSDK.InputButtonEvent(inputAction, OuyaSDK.KeyEnum.BUTTON_L3, device.player);
                                OuyaSDK.getInputButtonListener().onSuccess(inputButton);
                                break;

                            case 103:
                                inputButton = new OuyaSDK.InputButtonEvent(inputAction, OuyaSDK.KeyEnum.BUTTON_RB, device.player);
                                OuyaSDK.getInputButtonListener().onSuccess(inputButton);
                                break;
                            case 105:
                                inputButton = new OuyaSDK.InputButtonEvent(inputAction, OuyaSDK.KeyEnum.BUTTON_RT, device.player);
                                OuyaSDK.getInputButtonListener().onSuccess(inputButton);
                                break;
                            case 107:
                                inputButton = new OuyaSDK.InputButtonEvent(inputAction, OuyaSDK.KeyEnum.BUTTON_R3, device.player);
                                OuyaSDK.getInputButtonListener().onSuccess(inputButton);
                                break;

                            case 108:
                                inputButton = new OuyaSDK.InputButtonEvent(inputAction, OuyaSDK.KeyEnum.BUTTON_SYSTEM, device.player);
                                OuyaSDK.getInputButtonListener().onSuccess(inputButton);
                                break;

                            case 19:
                                inputButton = new OuyaSDK.InputButtonEvent(inputAction, OuyaSDK.KeyEnum.BUTTON_DPAD_UP, device.player);
                                OuyaSDK.getInputButtonListener().onSuccess(inputButton);
                                break;
                            case 20:
                                inputButton = new OuyaSDK.InputButtonEvent(inputAction, OuyaSDK.KeyEnum.BUTTON_DPAD_DOWN, device.player);
                                OuyaSDK.getInputButtonListener().onSuccess(inputButton);
                                break;
                            case 21:
                                inputButton = new OuyaSDK.InputButtonEvent(inputAction, OuyaSDK.KeyEnum.BUTTON_DPAD_LEFT, device.player);
                                OuyaSDK.getInputButtonListener().onSuccess(inputButton);
                                break;
                            case 22:
                                inputButton = new OuyaSDK.InputButtonEvent(inputAction, OuyaSDK.KeyEnum.BUTTON_DPAD_RIGHT, device.player);
                                OuyaSDK.getInputButtonListener().onSuccess(inputButton);
                                break;

                            default:
                                Debug.Log("Unhandled " + inputAction + ": " + container.KeyEvent.mKeyCode);
                                break;
                        }
                        break;
                    #endregion

                    #region GenericMotionEvent
                    case OuyaSDK.InputAction.GenericMotionEvent:

                        inputAxis = new OuyaSDK.InputAxisEvent(inputAction, OuyaSDK.AxisEnum.AXIS_LSTICK_X, container.AxisX, device.player);
                        OuyaSDK.getInputAxisListener().onSuccess(inputAxis);

                        inputAxis = new OuyaSDK.InputAxisEvent(inputAction, OuyaSDK.AxisEnum.AXIS_LSTICK_Y, container.AxisY, device.player);
                        OuyaSDK.getInputAxisListener().onSuccess(inputAxis);

                        inputAxis = new OuyaSDK.InputAxisEvent(inputAction, OuyaSDK.AxisEnum.AXIS_RSTICK_X, container.AxisZ, device.player);
                        OuyaSDK.getInputAxisListener().onSuccess(inputAxis);

                        inputAxis = new OuyaSDK.InputAxisEvent(inputAction, OuyaSDK.AxisEnum.AXIS_RSTICK_Y, container.AxisRZ, device.player);
                        OuyaSDK.getInputAxisListener().onSuccess(inputAxis);

                        //inputAxis = new OuyaSDK.InputAxisEvent(inputAction, OuyaSDK.AxisEnum.AXIS_LTRIGGER,container.AxisLTrigger, device.player);
                        //OuyaSDK.getInputAxisListener().onSuccess(inputAxis);

                        //inputAxis = new OuyaSDK.InputAxisEvent(inputAction, OuyaSDK.AxisEnum.AXIS_RTRIGGER,container.AxisRTrigger, device.player);
                        //OuyaSDK.getInputAxisListener().onSuccess(inputAxis);
                        /*
                        if (container.AxisLTrigger > 0.13f)
                        {
                            inputButton = new OuyaSDK.InputButtonEvent(OuyaSDK.InputAction.KeyDown, OuyaSDK.KeyEnum.BUTTON_LT, device.player);
                            OuyaSDK.getInputButtonListener().onSuccess(inputButton);
                            m_detectLTriggerDown = true;
                        }
                        else //if (m_detectLTriggerDown)
                        {
                            m_detectLTriggerDown = false;
                            inputButton = new OuyaSDK.InputButtonEvent(OuyaSDK.InputAction.KeyUp, OuyaSDK.KeyEnum.BUTTON_LT, device.player);
                            container.AxisLTrigger = 0; //override for deadzone
                            OuyaSDK.getInputButtonListener().onSuccess(inputButton);
                        }

                        if (container.AxisRTrigger > 0.13f)
                        {
                            inputButton = new OuyaSDK.InputButtonEvent(OuyaSDK.InputAction.KeyDown, OuyaSDK.KeyEnum.BUTTON_RT, device.player);
                            OuyaSDK.getInputButtonListener().onSuccess(inputButton);
                            m_detectRTriggerDown = true;
                        }
                        else //if (m_detectRTriggerDown)
                        {
                            m_detectRTriggerDown = false;
                            inputButton = new OuyaSDK.InputButtonEvent(OuyaSDK.InputAction.KeyUp, OuyaSDK.KeyEnum.BUTTON_RT, device.player);
                            container.AxisRTrigger = 0; //override for deadzone
                            OuyaSDK.getInputButtonListener().onSuccess(inputButton);
                        }*/

                        break;
                    #endregion
                }
                break;
            #endregion

            #region SONY PLAYSTATION(R)3 CONTROLLER

            case "SONY PLAYSTATION(R)3 CONTROLLER":

                switch (inputAction)
                {

                    #region KeyDown

                    case OuyaSDK.InputAction.KeyDown:

                        if (container.KeyEvent.mRepeatCount == 0 || container.KeyEvent.mRepeatCount > 5)
                        {

                            switch (container.KeyEvent.mKeyCode)
                            {

                                case 21:

                                    inputButton = new OuyaSDK.InputButtonEvent(inputAction, OuyaSDK.KeyEnum.BUTTON_A, device.player);

                                    OuyaSDK.getInputButtonListener().onSuccess(inputButton);

                                    break;

                                case 22:

                                    inputButton = new OuyaSDK.InputButtonEvent(inputAction, OuyaSDK.KeyEnum.BUTTON_O, device.player);

                                    OuyaSDK.getInputButtonListener().onSuccess(inputButton);

                                    break;

                                case 19:

                                    inputButton = new OuyaSDK.InputButtonEvent(inputAction, OuyaSDK.KeyEnum.BUTTON_U, device.player);

                                    OuyaSDK.getInputButtonListener().onSuccess(inputButton);

                                    break;

                                case 108:

                                    inputButton = new OuyaSDK.InputButtonEvent(inputAction, OuyaSDK.KeyEnum.BUTTON_Y, device.player);

                                    OuyaSDK.getInputButtonListener().onSuccess(inputButton);

                                    break;

                                case 107:

                                    inputButton = new OuyaSDK.InputButtonEvent(inputAction, OuyaSDK.KeyEnum.BUTTON_LB, device.player);

                                    OuyaSDK.getInputButtonListener().onSuccess(inputButton);

                                    break;

                                case -1:

                                    inputButton = new OuyaSDK.InputButtonEvent(inputAction, OuyaSDK.KeyEnum.BUTTON_LT, device.player);

                                    OuyaSDK.getInputButtonListener().onSuccess(inputButton);

                                    break;

                                case -2:

                                    inputButton = new OuyaSDK.InputButtonEvent(inputAction, OuyaSDK.KeyEnum.BUTTON_RB, device.player);

                                    OuyaSDK.getInputButtonListener().onSuccess(inputButton);

                                    break;

                                case 106:

                                    inputButton = new OuyaSDK.InputButtonEvent(inputAction, OuyaSDK.KeyEnum.BUTTON_RT, device.player);

                                    OuyaSDK.getInputButtonListener().onSuccess(inputButton);

                                    break;

                                case 20:

                                    inputButton = new OuyaSDK.InputButtonEvent(inputAction, OuyaSDK.KeyEnum.BUTTON_SYSTEM, device.player);

                                    OuyaSDK.getInputButtonListener().onSuccess(inputButton);

                                    break;

                                case 102:

                                    inputButton = new OuyaSDK.InputButtonEvent(inputAction, OuyaSDK.KeyEnum.BUTTON_DPAD_UP, device.player);

                                    OuyaSDK.getInputButtonListener().onSuccess(inputButton);

                                    break;

                                case 104:

                                    inputButton = new OuyaSDK.InputButtonEvent(inputAction, OuyaSDK.KeyEnum.BUTTON_DPAD_DOWN, device.player);

                                    OuyaSDK.getInputButtonListener().onSuccess(inputButton);

                                    break;

                                case 105:

                                    inputButton = new OuyaSDK.InputButtonEvent(inputAction, OuyaSDK.KeyEnum.BUTTON_DPAD_LEFT, device.player);

                                    OuyaSDK.getInputButtonListener().onSuccess(inputButton);

                                    break;

                                case 103:

                                    inputButton = new OuyaSDK.InputButtonEvent(inputAction, OuyaSDK.KeyEnum.BUTTON_DPAD_RIGHT, device.player);

                                    OuyaSDK.getInputButtonListener().onSuccess(inputButton);

                                    break;

                                default:

                                    Debug.Log("Unhandled " + inputAction + ": " + container.KeyEvent.mKeyCode);

                                    break;

                            }

                        }

                        break;

                    #endregion

                    #region KeyUp

                    case OuyaSDK.InputAction.KeyUp:

                        switch (container.KeyEvent.mKeyCode)
                        {

                            case 21:

                                inputButton = new OuyaSDK.InputButtonEvent(inputAction, OuyaSDK.KeyEnum.BUTTON_A, device.player);

                                OuyaSDK.getInputButtonListener().onSuccess(inputButton);

                                break;

                            case 22:

                                inputButton = new OuyaSDK.InputButtonEvent(inputAction, OuyaSDK.KeyEnum.BUTTON_O, device.player);

                                OuyaSDK.getInputButtonListener().onSuccess(inputButton);

                                break;

                            case 19:

                                inputButton = new OuyaSDK.InputButtonEvent(inputAction, OuyaSDK.KeyEnum.BUTTON_U, device.player);

                                OuyaSDK.getInputButtonListener().onSuccess(inputButton);

                                break;

                            case 108:

                                inputButton = new OuyaSDK.InputButtonEvent(inputAction, OuyaSDK.KeyEnum.BUTTON_Y, device.player);

                                OuyaSDK.getInputButtonListener().onSuccess(inputButton);

                                break;

                            case 107:

                                inputButton = new OuyaSDK.InputButtonEvent(inputAction, OuyaSDK.KeyEnum.BUTTON_LB, device.player);

                                OuyaSDK.getInputButtonListener().onSuccess(inputButton);

                                break;

                            case -1:

                                inputButton = new OuyaSDK.InputButtonEvent(inputAction, OuyaSDK.KeyEnum.BUTTON_LT, device.player);

                                OuyaSDK.getInputButtonListener().onSuccess(inputButton);

                                break;

                            case -2:

                                inputButton = new OuyaSDK.InputButtonEvent(inputAction, OuyaSDK.KeyEnum.BUTTON_RB, device.player);

                                OuyaSDK.getInputButtonListener().onSuccess(inputButton);

                                break;

                            case 106:

                                inputButton = new OuyaSDK.InputButtonEvent(inputAction, OuyaSDK.KeyEnum.BUTTON_RT, device.player);

                                OuyaSDK.getInputButtonListener().onSuccess(inputButton);

                                break;

                            case 20:

                                inputButton = new OuyaSDK.InputButtonEvent(inputAction, OuyaSDK.KeyEnum.BUTTON_SYSTEM, device.player);

                                OuyaSDK.getInputButtonListener().onSuccess(inputButton);

                                break;

                            case 102:

                                inputButton = new OuyaSDK.InputButtonEvent(inputAction, OuyaSDK.KeyEnum.BUTTON_DPAD_UP, device.player);

                                OuyaSDK.getInputButtonListener().onSuccess(inputButton);

                                break;

                            case 104:

                                inputButton = new OuyaSDK.InputButtonEvent(inputAction, OuyaSDK.KeyEnum.BUTTON_DPAD_DOWN, device.player);

                                OuyaSDK.getInputButtonListener().onSuccess(inputButton);

                                break;

                            case 105:

                                inputButton = new OuyaSDK.InputButtonEvent(inputAction, OuyaSDK.KeyEnum.BUTTON_DPAD_LEFT, device.player);

                                OuyaSDK.getInputButtonListener().onSuccess(inputButton);

                                break;

                            case 103:

                                inputButton = new OuyaSDK.InputButtonEvent(inputAction, OuyaSDK.KeyEnum.BUTTON_DPAD_RIGHT, device.player);

                                OuyaSDK.getInputButtonListener().onSuccess(inputButton);

                                break;

                            default:

                                Debug.Log("Unhandled " + inputAction + ": " + container.KeyEvent.mKeyCode);

                                break;

                        }

                        break;

                    #endregion

                    #region GenericMotionEvent

                    case OuyaSDK.InputAction.GenericMotionEvent:

                        inputAxis = new OuyaSDK.InputAxisEvent(inputAction, OuyaSDK.AxisEnum.AXIS_LSTICK_X, container.AxisX, device.player);

                        OuyaSDK.getInputAxisListener().onSuccess(inputAxis);

                        inputAxis = new OuyaSDK.InputAxisEvent(inputAction, OuyaSDK.AxisEnum.AXIS_LSTICK_Y, container.AxisY, device.player);

                        OuyaSDK.getInputAxisListener().onSuccess(inputAxis);

                        inputAxis = new OuyaSDK.InputAxisEvent(inputAction, OuyaSDK.AxisEnum.AXIS_RSTICK_X, container.AxisZ, device.player);

                        OuyaSDK.getInputAxisListener().onSuccess(inputAxis);

                        inputAxis = new OuyaSDK.InputAxisEvent(inputAction, OuyaSDK.AxisEnum.AXIS_RSTICK_Y, container.AxisRZ, device.player);

                        OuyaSDK.getInputAxisListener().onSuccess(inputAxis);

                        break;

                    #endregion

                }

                break;

            #endregion

            #region USB Controller
            case "USB CONTROLLER":
            default:
                switch (inputAction)
                {
                    #region KeyDown
                    case OuyaSDK.InputAction.KeyDown:
                        if (container.KeyEvent.mRepeatCount == 0 || container.KeyEvent.mRepeatCount > 5)
                        {
                            if (container.KeyEvent.mKeyCode == 97)
                            {
                                inputButton = new OuyaSDK.InputButtonEvent(inputAction, OuyaSDK.KeyEnum.BUTTON_A, device.player);
                                OuyaSDK.getInputButtonListener().onSuccess(inputButton);
                            }
                            if (container.KeyEvent.mKeyCode == 98)
                            {
                                inputButton = new OuyaSDK.InputButtonEvent(inputAction, OuyaSDK.KeyEnum.BUTTON_O, device.player);
                                OuyaSDK.getInputButtonListener().onSuccess(inputButton);
                            }
                            if (container.KeyEvent.mKeyCode == 99)
                            {
                                inputButton = new OuyaSDK.InputButtonEvent(inputAction, OuyaSDK.KeyEnum.BUTTON_U, device.player);
                                OuyaSDK.getInputButtonListener().onSuccess(inputButton);
                            }
                            if (container.KeyEvent.mKeyCode == 96)
                            {
                                inputButton = new OuyaSDK.InputButtonEvent(inputAction, OuyaSDK.KeyEnum.BUTTON_Y, device.player);
                                OuyaSDK.getInputButtonListener().onSuccess(inputButton);
                            }
                            if (container.KeyEvent.mKeyCode == 100)
                            {
                                inputButton = new OuyaSDK.InputButtonEvent(inputAction, OuyaSDK.KeyEnum.BUTTON_LB, device.player);
                                OuyaSDK.getInputButtonListener().onSuccess(inputButton);
                            }
                            if (container.KeyEvent.mKeyCode == 101)
                            {
                                inputButton = new OuyaSDK.InputButtonEvent(inputAction, OuyaSDK.KeyEnum.BUTTON_RB, device.player);
                                OuyaSDK.getInputButtonListener().onSuccess(inputButton);
                            }
                            if (container.KeyEvent.mKeyCode == 102)
                            {
                                inputButton = new OuyaSDK.InputButtonEvent(inputAction, OuyaSDK.KeyEnum.BUTTON_LT, device.player);
                                OuyaSDK.getInputButtonListener().onSuccess(inputButton);

                                switch (inputAction)
                                {
                                    case OuyaSDK.InputAction.KeyDown:
                                        inputAxis = new OuyaSDK.InputAxisEvent(inputAction, OuyaSDK.AxisEnum.AXIS_LTRIGGER, 1, device.player);
                                        OuyaSDK.getInputAxisListener().onSuccess(inputAxis);
                                        break;
                                    case OuyaSDK.InputAction.KeyUp:
                                        inputAxis = new OuyaSDK.InputAxisEvent(inputAction, OuyaSDK.AxisEnum.AXIS_LTRIGGER, 0, device.player);
                                        OuyaSDK.getInputAxisListener().onSuccess(inputAxis);
                                        break;
                                }
                            }
                            if (container.KeyEvent.mKeyCode == 103)
                            {
                                inputButton = new OuyaSDK.InputButtonEvent(inputAction, OuyaSDK.KeyEnum.BUTTON_RT, device.player);
                                OuyaSDK.getInputButtonListener().onSuccess(inputButton);

                                switch (inputAction)
                                {
                                    case OuyaSDK.InputAction.KeyDown:
                                        inputAxis = new OuyaSDK.InputAxisEvent(inputAction, OuyaSDK.AxisEnum.AXIS_RTRIGGER, -1, device.player);
                                        OuyaSDK.getInputAxisListener().onSuccess(inputAxis);
                                        break;
                                    case OuyaSDK.InputAction.KeyUp:
                                        inputAxis = new OuyaSDK.InputAxisEvent(inputAction, OuyaSDK.AxisEnum.AXIS_RTRIGGER, 0, device.player);
                                        OuyaSDK.getInputAxisListener().onSuccess(inputAxis);
                                        break;
                                }
                            }
                        }
                        break;
                    #endregion

                    #region KeyUp
                    case OuyaSDK.InputAction.KeyUp:
                        if (container.KeyEvent.mKeyCode == 97)
                        {
                            inputButton = new OuyaSDK.InputButtonEvent(inputAction, OuyaSDK.KeyEnum.BUTTON_A, device.player);
                            OuyaSDK.getInputButtonListener().onSuccess(inputButton);
                        }
                        if (container.KeyEvent.mKeyCode == 98)
                        {
                            inputButton = new OuyaSDK.InputButtonEvent(inputAction, OuyaSDK.KeyEnum.BUTTON_O, device.player);
                            OuyaSDK.getInputButtonListener().onSuccess(inputButton);
                        }
                        if (container.KeyEvent.mKeyCode == 99)
                        {
                            inputButton = new OuyaSDK.InputButtonEvent(inputAction, OuyaSDK.KeyEnum.BUTTON_U, device.player);
                            OuyaSDK.getInputButtonListener().onSuccess(inputButton);
                        }
                        if (container.KeyEvent.mKeyCode == 96)
                        {
                            inputButton = new OuyaSDK.InputButtonEvent(inputAction, OuyaSDK.KeyEnum.BUTTON_Y, device.player);
                            OuyaSDK.getInputButtonListener().onSuccess(inputButton);
                        }
                        if (container.KeyEvent.mKeyCode == 100)
                        {
                            inputButton = new OuyaSDK.InputButtonEvent(inputAction, OuyaSDK.KeyEnum.BUTTON_LB, device.player);
                            OuyaSDK.getInputButtonListener().onSuccess(inputButton);
                        }
                        if (container.KeyEvent.mKeyCode == 101)
                        {
                            inputButton = new OuyaSDK.InputButtonEvent(inputAction, OuyaSDK.KeyEnum.BUTTON_RB, device.player);
                            OuyaSDK.getInputButtonListener().onSuccess(inputButton);
                        }
                        if (container.KeyEvent.mKeyCode == 102)
                        {
                            inputButton = new OuyaSDK.InputButtonEvent(inputAction, OuyaSDK.KeyEnum.BUTTON_LT, device.player);
                            OuyaSDK.getInputButtonListener().onSuccess(inputButton);

                            switch (inputAction)
                            {
                                case OuyaSDK.InputAction.KeyDown:
                                    inputAxis = new OuyaSDK.InputAxisEvent(inputAction, OuyaSDK.AxisEnum.AXIS_LTRIGGER, 1, device.player);
                                    OuyaSDK.getInputAxisListener().onSuccess(inputAxis);
                                    break;
                                case OuyaSDK.InputAction.KeyUp:
                                    inputAxis = new OuyaSDK.InputAxisEvent(inputAction, OuyaSDK.AxisEnum.AXIS_LTRIGGER, 0, device.player);
                                    OuyaSDK.getInputAxisListener().onSuccess(inputAxis);
                                    break;
                            }
                        }
                        if (container.KeyEvent.mKeyCode == 103)
                        {
                            inputButton = new OuyaSDK.InputButtonEvent(inputAction, OuyaSDK.KeyEnum.BUTTON_RT, device.player);
                            OuyaSDK.getInputButtonListener().onSuccess(inputButton);

                            switch (inputAction)
                            {
                                case OuyaSDK.InputAction.KeyDown:
                                    inputAxis = new OuyaSDK.InputAxisEvent(inputAction, OuyaSDK.AxisEnum.AXIS_RTRIGGER, -1, device.player);
                                    OuyaSDK.getInputAxisListener().onSuccess(inputAxis);
                                    break;
                                case OuyaSDK.InputAction.KeyUp:
                                    inputAxis = new OuyaSDK.InputAxisEvent(inputAction, OuyaSDK.AxisEnum.AXIS_RTRIGGER, 0, device.player);
                                    OuyaSDK.getInputAxisListener().onSuccess(inputAxis);
                                    break;
                            }
                        }
                        break;
                    #endregion

                    #region GenericMotionEvent
                    case OuyaSDK.InputAction.GenericMotionEvent:
                        if (container.AxisHatY == -1)
                        {
                            inputButton = new OuyaSDK.InputButtonEvent(inputAction, OuyaSDK.KeyEnum.BUTTON_DPAD_UP, device.player);
                            OuyaSDK.getInputButtonListener().onSuccess(inputButton);
                        }

                        if (container.AxisHatY == 1)
                        {
                            inputButton = new OuyaSDK.InputButtonEvent(inputAction, OuyaSDK.KeyEnum.BUTTON_DPAD_DOWN, device.player);
                            OuyaSDK.getInputButtonListener().onSuccess(inputButton);
                        }

                        if (container.AxisHatX == -1)
                        {
                            inputButton = new OuyaSDK.InputButtonEvent(inputAction, OuyaSDK.KeyEnum.BUTTON_DPAD_LEFT, device.player);
                            OuyaSDK.getInputButtonListener().onSuccess(inputButton);
                        }

                        if (container.AxisHatX == 1)
                        {
                            inputButton = new OuyaSDK.InputButtonEvent(inputAction, OuyaSDK.KeyEnum.BUTTON_DPAD_RIGHT, device.player);
                            OuyaSDK.getInputButtonListener().onSuccess(inputButton);
                        }

                        if (container.AxisHatX == 0 &&
                            container.AxisHatY == 0)
                        {
                            inputButton = new OuyaSDK.InputButtonEvent(inputAction, OuyaSDK.KeyEnum.BUTTON_DPAD_CENTER, device.player);
                            OuyaSDK.getInputButtonListener().onSuccess(inputButton);
                        }

                        inputAxis = new OuyaSDK.InputAxisEvent(inputAction, OuyaSDK.AxisEnum.AXIS_LSTICK_X, container.AxisX, device.player);
                        OuyaSDK.getInputAxisListener().onSuccess(inputAxis);

                        inputAxis = new OuyaSDK.InputAxisEvent(inputAction, OuyaSDK.AxisEnum.AXIS_LSTICK_Y, container.AxisY, device.player);
                        OuyaSDK.getInputAxisListener().onSuccess(inputAxis);

                        inputAxis = new OuyaSDK.InputAxisEvent(inputAction, OuyaSDK.AxisEnum.AXIS_RSTICK_X, container.AxisZ, device.player);
                        OuyaSDK.getInputAxisListener().onSuccess(inputAxis);

                        inputAxis = new OuyaSDK.InputAxisEvent(inputAction, OuyaSDK.AxisEnum.AXIS_RSTICK_Y, container.AxisRZ, device.player);
                        OuyaSDK.getInputAxisListener().onSuccess(inputAxis);

                        inputAxis = new OuyaSDK.InputAxisEvent(inputAction, OuyaSDK.AxisEnum.AXIS_LTRIGGER, container.AxisZ, device.player);
                        OuyaSDK.getInputAxisListener().onSuccess(inputAxis);

                        inputAxis = new OuyaSDK.InputAxisEvent(inputAction, OuyaSDK.AxisEnum.AXIS_RTRIGGER, container.AxisZ, device.player);
                        OuyaSDK.getInputAxisListener().onSuccess(inputAxis);

                        break;
                    #endregion
                }
                break;
            #endregion

        }
    }