public static float GetAxis(string ouyaMapping, OuyaSDK.OuyaPlayer player)
 {
     switch (ouyaMapping)
     {
         case "LB":
             return GetAxis(OuyaSDK.KeyEnum.BUTTON_LB, player);
         case "LT":
             return GetAxis(OuyaSDK.KeyEnum.BUTTON_LT, player);
         case "LX":
             return GetAxis(OuyaSDK.KeyEnum.AXIS_LSTICK_X, player);
         case "LY":
             return GetAxis(OuyaSDK.KeyEnum.AXIS_LSTICK_Y, player);
         case "RB":
             return GetAxis(OuyaSDK.KeyEnum.BUTTON_RB, player);
         case "RT":
             return GetAxis(OuyaSDK.KeyEnum.BUTTON_RT, player);
         case "RX":
             return GetAxis(OuyaSDK.KeyEnum.AXIS_RSTICK_X, player);
         case "RY":
             return GetAxis(OuyaSDK.KeyEnum.AXIS_RSTICK_Y, player);
         case "DL":
             return GetAxis(OuyaSDK.KeyEnum.BUTTON_DPAD_LEFT, player);
         case "DR":
             return GetAxis(OuyaSDK.KeyEnum.BUTTON_DPAD_RIGHT, player);
         case "DU":
             return GetAxis(OuyaSDK.KeyEnum.BUTTON_DPAD_UP, player);
         case "DD":
             return GetAxis(OuyaSDK.KeyEnum.BUTTON_DPAD_DOWN, player);
         default:
             return 0f;
     }
 }
    private void HandleButtonEvents(OuyaSDK.OuyaPlayer p, OuyaSDK.KeyEnum b, OuyaSDK.InputAction bs)
    {
        if (enabled && NGUITools.GetActive(gameObject))
        {
            // Ignoring P to allow any player to use the menu
            if (bs.Equals(OuyaSDK.InputAction.KeyDown))
            {
                switch (b)
                {
                    case OuyaSDK.KeyEnum.BUTTON_DPAD_UP:
                        OnKey(KeyCode.UpArrow);
                        break;
                    case OuyaSDK.KeyEnum.BUTTON_DPAD_DOWN:
                        OnKey(KeyCode.DownArrow);
                        break;
                    case OuyaSDK.KeyEnum.BUTTON_DPAD_LEFT:
                        OnKey(KeyCode.LeftArrow);
                        break;
                    case OuyaSDK.KeyEnum.BUTTON_DPAD_RIGHT:
                        OnKey(KeyCode.RightArrow);
                        break;
                }
            }

            if (b == activateButton && gameObject == UICamera.selectedObject)
            {
                SendMessage("OnPress", bs.Equals(OuyaSDK.InputAction.KeyDown), SendMessageOptions.DontRequireReceiver);
            }
        }
    }
 protected string CommonGetKeyString(int buttonNum, OuyaSDK.OuyaPlayer player)
 {
     switch (player)
     {
         case OuyaSDK.OuyaPlayer.none:
             return string.Format("JoystickButton{0}", buttonNum);
         default:
             return string.Format("Joystick{0}Button{1}", ((int)player), buttonNum);
     }
 }
 protected KeyCode CommonGetUnityKeyCode(int buttonNum, OuyaSDK.OuyaPlayer player)
 {
     string keyCode = CommonGetKeyString(buttonNum, player);
     if (string.IsNullOrEmpty(keyCode))
     {
         return (KeyCode)(-1);
     }
     OuyaKeyCode key = (OuyaKeyCode)Enum.Parse(typeof(OuyaKeyCode), keyCode);
     return (KeyCode)(int)key;
 }
 protected bool HasKeyCode(OuyaSDK.KeyEnum[] supportedCodes, OuyaSDK.KeyEnum keyCode)
 {
     foreach (OuyaSDK.KeyEnum item in supportedCodes)
     {
         if (item == keyCode)
         {
             return true;
         }
     }
     return false;
 }
 public static float GetAxisRaw(OuyaSDK.KeyEnum keyCode, OuyaSDK.OuyaPlayer player)
 {
     if (OuyaSDK.m_EnableUnityInput)
     {
         return GetAxisWithDelegate(keyCode, player, Input.GetAxisRaw);
     }
     else
     {
         return 0f;
     }
 }
    /// <summary>
    /// Wrap Unity's method
    /// </summary>
    /// <param name="inputName"></param>
    /// <returns></returns>
    public static float GetAxis(string inputName, OuyaSDK.OuyaPlayer player)
    {
        #if !UNITY_EDITOR && !UNITY_STANDALONE_OSX && !UNITY_STANDALONE_WIN && !UNITY_STANDALONE_LINUX
        switch (inputName)
        {
            case "LT":
                return OuyaInputManager.getPlayerKeyState(player).m_axisLeftTrigger;
            case "RT":
                return OuyaInputManager.getPlayerKeyState(player).m_axisRightTrigger;
            case "RX":
                return OuyaInputManager.getPlayerKeyState(player).m_axisRightStickX;
            case "RY":
                return OuyaInputManager.getPlayerKeyState(player).m_axisRightStickY;
            case "LX":
                return OuyaInputManager.getPlayerKeyState(player).m_axisLeftStickX;
            case "LY":
                return -OuyaInputManager.getPlayerKeyState(player).m_axisLeftStickY;
        }
        return 0f;
        #else
        string axisName = string.Empty;
        int invertFactor = GetInvertedFactor(GetControllerType(player), inputName);
        switch (inputName)
        {
            case "LT":
                axisName = OuyaInputManager.GetInput(player, AxisTypes.Horizontal, AnalogTypes.LTRT);
                break;
            case "RT":
                axisName = OuyaInputManager.GetInput(player, AxisTypes.Vertical, AnalogTypes.LTRT);
                break;
            case "RX":
                axisName = OuyaInputManager.GetInput(player, AxisTypes.Horizontal, AnalogTypes.Right);
                break;
            case "RY":
                axisName = OuyaInputManager.GetInput(player, AxisTypes.Vertical, AnalogTypes.Right);
                break;
            case "LX":
                axisName = OuyaInputManager.GetInput(player, AxisTypes.Horizontal, AnalogTypes.Left);
                break;
            case "LY":
                axisName = OuyaInputManager.GetInput(player, AxisTypes.Vertical, AnalogTypes.Left);
                break;
        }
        if (!string.IsNullOrEmpty(axisName))
        {
            return invertFactor * Input.GetAxis(axisName);
        }
        return 0f;

        #endif
    }
    public static float GetAxis(OuyaSDK.KeyEnum keyCode)
    {
        float axisValue = 0f;
        axisValue = GreaterValue(axisValue, SuperInputMapper.GetAxis(keyCode, OuyaSDK.OuyaPlayer.player1) );
        axisValue = GreaterValue(axisValue, SuperInputMapper.GetAxis(keyCode, OuyaSDK.OuyaPlayer.player2) );
        axisValue = GreaterValue(axisValue, SuperInputMapper.GetAxis(keyCode, OuyaSDK.OuyaPlayer.player3) );
        axisValue = GreaterValue(axisValue, SuperInputMapper.GetAxis(keyCode, OuyaSDK.OuyaPlayer.player4) );
        axisValue = GreaterValue(axisValue, SuperInputMapper.GetAxis(keyCode, OuyaSDK.OuyaPlayer.player5) );
        axisValue = GreaterValue(axisValue, SuperInputMapper.GetAxis(keyCode, OuyaSDK.OuyaPlayer.player6) );
        axisValue = GreaterValue(axisValue, SuperInputMapper.GetAxis(keyCode, OuyaSDK.OuyaPlayer.player7) );
        axisValue = GreaterValue(axisValue, SuperInputMapper.GetAxis(keyCode, OuyaSDK.OuyaPlayer.player8) );
        axisValue = GreaterValue(axisValue, SuperInputMapper.GetAxis(keyCode, OuyaSDK.OuyaPlayer.player9) );
        axisValue = GreaterValue(axisValue, SuperInputMapper.GetAxis(keyCode, OuyaSDK.OuyaPlayer.player10) );
        axisValue = GreaterValue(axisValue, SuperInputMapper.GetAxis(keyCode, OuyaSDK.OuyaPlayer.player11) );

        return axisValue;
    }
 public bool GetAxisInverted(OuyaSDK.KeyEnum keyCode)
 {
     #if !UNITY_EDITOR && UNITY_ANDROID
     switch (keyCode)
     {
         case OuyaSDK.KeyEnum.AXIS_LSTICK_X:
             return false;
         case OuyaSDK.KeyEnum.AXIS_LSTICK_Y:
             return false;
         case OuyaSDK.KeyEnum.AXIS_RSTICK_X:
             return false;
         case OuyaSDK.KeyEnum.AXIS_RSTICK_Y:
             return false;
         case OuyaSDK.KeyEnum.BUTTON_LT:
             return false;
         case OuyaSDK.KeyEnum.BUTTON_RT:
             return false;
         default:
             return false;
     }
     #else
     switch (keyCode)
     {
         case OuyaSDK.KeyEnum.AXIS_LSTICK_X:
             return false;
         case OuyaSDK.KeyEnum.AXIS_LSTICK_Y:
             return true;
         case OuyaSDK.KeyEnum.AXIS_RSTICK_X:
             return true;
         case OuyaSDK.KeyEnum.AXIS_RSTICK_Y:
             return false;
         case OuyaSDK.KeyEnum.BUTTON_LT:
             return false;
         case OuyaSDK.KeyEnum.BUTTON_RT:
             return false;
         default:
             return false;
     }
     #endif
 }
    /// <summary>
    /// Wrap Unity's method
    /// </summary>
    /// <param name="inputName"></param>
    /// <returns></returns>
    public static bool GetButton(string inputName, OuyaSDK.OuyaPlayer player)
    {
        switch (inputName)
        {
            case "SYS": //arbitrary name and mapping
                return OuyaInputManager.getPlayerKeyState(player).m_buttonSystem;
            case "DPC": //arbitrary name and mapping
                return OuyaInputManager.getPlayerKeyState(player).m_buttonDPadCenter;
            case "DPD": //arbitrary name and mapping
                return OuyaInputManager.getPlayerKeyState(player).m_buttonDPadDown;
            case "DPL": //arbitrary name and mapping
                return OuyaInputManager.getPlayerKeyState(player).m_buttonDPadLeft;
            case "DPR": //arbitrary name and mapping
                return OuyaInputManager.getPlayerKeyState(player).m_buttonDPadRight;
            case "DPU": //arbitrary name and mapping
                return OuyaInputManager.getPlayerKeyState(player).m_buttonDPadUp;
            case "O": //arbitrary name and mapping
                return OuyaInputManager.getPlayerKeyState(player).m_buttonO;
            case "U": //arbitrary name and mapping
                return OuyaInputManager.getPlayerKeyState(player).m_buttonU;
            case "Y": //arbitrary name and mapping
                return OuyaInputManager.getPlayerKeyState(player).m_buttonY;
            case "A": //arbitrary name and mapping
                return OuyaInputManager.getPlayerKeyState(player).m_buttonA;
            case "LT": //arbitrary name and mapping
                return OuyaInputManager.getPlayerKeyState(player).m_buttonLT;
            case "RT": //arbitrary name and mapping
                return OuyaInputManager.getPlayerKeyState(player).m_buttonRT;
            case "LB": //arbitrary name and mapping
                return OuyaInputManager.getPlayerKeyState(player).m_buttonLB;
            case "RB": //arbitrary name and mapping
                return OuyaInputManager.getPlayerKeyState(player).m_buttonRB;
            case "L3":
                return OuyaInputManager.getPlayerKeyState(player).m_buttonL3;
            case "R3":
                return OuyaInputManager.getPlayerKeyState(player).m_buttonR3;
        }

        return false;
    }
Exemple #11
0
 public void InvokeOuyaPurchaseOnSuccess(OuyaSDK.Product product)
 {
     foreach (OuyaSDK.IPurchaseListener listener in OuyaSDK.getPurchaseListeners())
     {
         if (null != listener)
         {
             listener.OuyaPurchaseOnSuccess(product);
         }
     }
 }
    /// <summary>
    /// This needs to be setup for each joystick type being supported.  I have not setup the USB controller or the I:Droid:CON  
    /// For the most part you won't need to modify this section.
    /// </summary>
    /// <param name="player"></param>
    /// <param name="axis"></param>
    /// <param name="joystick"></param>
    /// <param name="atype"></param>
    /// <returns></returns>
    private static string CheckInput(OuyaSDK.OuyaPlayer player, AxisTypes axis, JoystickType joystick, AnalogTypes atype)
    {
        //Debug.Log(string.Format("Player:{0} Axis:{1} Joystick:{2} AnalogType:{3}",player,axis,joystick,atype));
        //REF: player1, DPadH, PS3, Dpad

        //Note:  It is your responsibility to make sure that  Unity Inputs are setup correctly or you will get an error on your controller.

        int axisNumber=0;

        switch (joystick)
        {
            case JoystickType.ps3:
                //Get The Joystick name from  Project Settings --> Input for Controllers
                #region PS3 Controller
                if (atype.Equals(AnalogTypes.Left))
                {
                    ControllerType cType = OuyaControllerMapping.getController("ps3");
                    if (axis.Equals(AxisTypes.Horizontal)) { axisNumber = cType.leftAnalogH; } else { axisNumber = cType.leftAnalogV; }
                    return "Joy" + (int)player + " Axis " + axisNumber.ToString();
                }
                else if (atype.Equals(AnalogTypes.Right))
                {
                    ControllerType cType = OuyaControllerMapping.getController("ps3");
                    if (axis.Equals(AxisTypes.Horizontal)) { axisNumber = cType.rightAnalogH; } else { axisNumber = cType.rightAnalogV; }
                    return "Joy" + (int)player + " Axis " + axisNumber.ToString();
                }
                else if (atype.Equals(AnalogTypes.DPad))
                {
                    ControllerType cType = OuyaControllerMapping.getController("ps3");
                    if (axis.Equals(AxisTypes.DPadH)) { axisNumber = cType.dpadH; } else { axisNumber = cType.dpadV; }
                    return "Joy" + (int)player + " Axis " + axisNumber.ToString();
                }
                #endregion
                break;

            case JoystickType.xbox:
                #region xbox ( usually 360 / untested with normal xbox )
                if (atype.Equals(AnalogTypes.Left))
                {
                    ControllerType cType = OuyaControllerMapping.getController("xbox360");
                    if (axis.Equals(AxisTypes.Horizontal)) { axisNumber = cType.leftAnalogH; } else { axisNumber = cType.leftAnalogV; }
                    return "Joy" + (int)player + " Axis " + axisNumber.ToString();
                }
                else if (atype.Equals(AnalogTypes.Right))
                {
                    ControllerType cType = OuyaControllerMapping.getController("xbox360");
                    if (axis.Equals(AxisTypes.Horizontal)) { axisNumber = cType.rightAnalogH; } else { axisNumber = cType.rightAnalogV; }
                    return "Joy" + (int)player + " Axis " + axisNumber.ToString();
                }
                else if (atype.Equals(AnalogTypes.DPad))
                {
                    ControllerType cType = OuyaControllerMapping.getController("xbox360");
                    if (axis.Equals(AxisTypes.DPadH)) { axisNumber = cType.dpadH; } else { axisNumber = cType.dpadV; }
                    return "Joy" + (int)player + " Axis " + axisNumber.ToString();
                }
                else if (atype.Equals(AnalogTypes.LTRT))
                {
                    ControllerType cType = OuyaControllerMapping.getController("xbox360");
                    axisNumber = cType.triggers;
                    return "Joy" + (int)player + " Axis " + axisNumber.ToString();
                }
                #endregion
                break;

            case JoystickType.ouya:
                #region OUYA - Not Tested until I get a bluetooth dongle
                if (atype.Equals(AnalogTypes.Left))
                {
                    ControllerType cType = OuyaControllerMapping.getController("ouya");
                    if (axis.Equals(AxisTypes.Horizontal)) { axisNumber = cType.leftAnalogH; } else { axisNumber = cType.leftAnalogV; }
                    return "Joy" + (int)player + " Axis " + axisNumber.ToString();
                }
                else if (atype.Equals(AnalogTypes.Right))
                {
                    ControllerType cType = OuyaControllerMapping.getController("ouya");
                    if (axis.Equals(AxisTypes.Horizontal)) { axisNumber = cType.rightAnalogH; } else { axisNumber = cType.rightAnalogV; }
                    return "Joy" + (int)player + " Axis " + axisNumber.ToString();
                }
                else if (atype.Equals(AnalogTypes.DPad))
                {
                    ControllerType cType = OuyaControllerMapping.getController("ouya");
                    if (axis.Equals(AxisTypes.DPadH)) { axisNumber = cType.dpadH; } else { axisNumber = cType.dpadV; }
                    return "Joy" + (int)player + " Axis " + axisNumber.ToString();
                }
                #endregion
                break;
        }

        //most likely we will never reach here, but If we do Return basic Horizontal Axis
        return "Horizontal";
    }
 //Call this event ( trigger )
 public static void buttonPressEvent(OuyaSDK.OuyaPlayer player, OuyaSDK.KeyEnum button, OuyaSDK.InputAction buttonState)
 {
     if (ButtonsEvent != null)
     {
         ButtonsEvent(player, button, buttonState);
     }
 }
 public static bool GetButtonDown(OuyaSDK.KeyEnum keyCode, OuyaSDK.OuyaPlayer player)
 {
     return GetButtonWithDelegate(keyCode, player, Input.GetKeyDown);
 }
    public static void SetButton(string inputName, OuyaSDK.OuyaPlayer player, bool state)
    {
        switch (inputName)
        {
            case "SYS": //arbitrary name and mapping
                OuyaInputManager.getPlayerKeyState(player).m_buttonSystem = state;
                break;
            case "DPC": //arbitrary name and mapping
                OuyaInputManager.getPlayerKeyState(player).m_buttonDPadCenter = state;
                break;
            case "DPD": //arbitrary name and mapping
                OuyaInputManager.getPlayerKeyState(player).m_buttonDPadDown = state;
                break;
            case "DPL": //arbitrary name and mapping
                OuyaInputManager.getPlayerKeyState(player).m_buttonDPadLeft = state;
                break;
            case "DPR": //arbitrary name and mapping
                OuyaInputManager.getPlayerKeyState(player).m_buttonDPadRight = state;
                break;
            case "DPU": //arbitrary name and mapping
                OuyaInputManager.getPlayerKeyState(player).m_buttonDPadUp = state;
                break;
            case "O": //arbitrary name and mapping
                OuyaInputManager.getPlayerKeyState(player).m_buttonO = state;
                break;
            case "U": //arbitrary name and mapping
                OuyaInputManager.getPlayerKeyState(player).m_buttonU = state;
                break;
            case "Y": //arbitrary name and mapping
                OuyaInputManager.getPlayerKeyState(player).m_buttonY = state;
                break;
            case "A": //arbitrary name and mapping
                OuyaInputManager.getPlayerKeyState(player).m_buttonA = state;
                break;
            case "LT": //arbitrary name and mapping
                OuyaInputManager.getPlayerKeyState(player).m_buttonLT = state;
                break;
            case "RT": //arbitrary name and mapping
                OuyaInputManager.getPlayerKeyState(player).m_buttonRT = state;
                break;
            case "LB": //arbitrary name and mapping
                OuyaInputManager.getPlayerKeyState(player).m_buttonLB = state;
                break;
            case "RB": //arbitrary name and mapping
                OuyaInputManager.getPlayerKeyState(player).m_buttonRB = state;
                break;
            case "L3": //arbitrary name and mapping
                OuyaInputManager.getPlayerKeyState(player).m_buttonL3 = state;
                break;
            case "R3": //arbitrary name and mapping
                OuyaInputManager.getPlayerKeyState(player).m_buttonR3 = state;
                break;

        }
    }
 public static bool GetButton(int buttonNum, OuyaSDK.OuyaPlayer player)
 {
     string keyCode = GetKeyCode(buttonNum, player);
     if (string.IsNullOrEmpty(keyCode))
     {
         return false;
     }
     OuyaKeyCode key = (OuyaKeyCode)Enum.Parse(typeof(OuyaKeyCode), keyCode);
     return Input.GetKey((KeyCode)(int)key);
 }
    public static bool GetButton(OuyaSDK.KeyEnum keyCode, OuyaSDK.OuyaPlayer player)
    {
        if (null == OuyaExampleCommon.Joysticks)
        {
            return false;
        }
        int playerIndex = (int) player - 1;
        if (playerIndex >= OuyaExampleCommon.Joysticks.Length)
        {
            return false;
        }

        string joystickName = OuyaExampleCommon.Joysticks[playerIndex];
        if (null == joystickName)
        {
            return false;
        }

        switch (joystickName.ToUpper())
        {
            case "HARMONIX ROCK BAND DRUMKIT":
                switch (keyCode)
                {
                    case OuyaSDK.KeyEnum.HARMONIX_ROCK_BAND_DRUMKIT_GREEN:
                    case OuyaSDK.KeyEnum.HARMONIX_ROCK_BAND_DRUMKIT_A:
                    case OuyaSDK.KeyEnum.BUTTON_O:
                        return GetButton(0, player);
                    case OuyaSDK.KeyEnum.HARMONIX_ROCK_BAND_DRUMKIT_RED:
                    case OuyaSDK.KeyEnum.HARMONIX_ROCK_BAND_DRUMKIT_B:
                    case OuyaSDK.KeyEnum.BUTTON_A:
                        return GetButton(1, player);
                    case OuyaSDK.KeyEnum.HARMONIX_ROCK_BAND_DRUMKIT_YELLOW:
                    case OuyaSDK.KeyEnum.HARMONIX_ROCK_BAND_DRUMKIT_Y:
                    case OuyaSDK.KeyEnum.BUTTON_Y:
                        return GetButton(4, player);
                    case OuyaSDK.KeyEnum.HARMONIX_ROCK_BAND_DRUMKIT_BLUE:
                    case OuyaSDK.KeyEnum.HARMONIX_ROCK_BAND_DRUMKIT_X:
                    case OuyaSDK.KeyEnum.BUTTON_U:
                        return GetButton(3, player);
                    case OuyaSDK.KeyEnum.HARMONIX_ROCK_BAND_DRUMKIT_ORANGE:
                    case OuyaSDK.KeyEnum.BUTTON_L3:
                        return GetButton(6, player);
                    case OuyaSDK.KeyEnum.BUTTON_BACK:
                    case OuyaSDK.KeyEnum.BUTTON_R3:
                        return GetButton(10, player);
                    case OuyaSDK.KeyEnum.BUTTON_START:
                    case OuyaSDK.KeyEnum.BUTTON_LB:
                        return GetButton(11, player);
                    case OuyaSDK.KeyEnum.BUTTON_SYSTEM:
                    case OuyaSDK.KeyEnum.BUTTON_RB:
                        return GetButton(12, player);
                    default:
                        return false;
                }
            case "HARMONIX ROCK BAND GUITAR":
                switch (keyCode)
                {
                    case OuyaSDK.KeyEnum.HARMONIX_ROCK_BAND_GUITAR_GREEN:
                    case OuyaSDK.KeyEnum.BUTTON_O:
                        return GetButton(0, player);
                    case OuyaSDK.KeyEnum.HARMONIX_ROCK_BAND_GUITAR_RED:
                    case OuyaSDK.KeyEnum.BUTTON_A:
                        return GetButton(1, player);
                    case OuyaSDK.KeyEnum.HARMONIX_ROCK_BAND_GUITAR_YELLOW:
                    case OuyaSDK.KeyEnum.BUTTON_Y:
                        return GetButton(4, player);
                    case OuyaSDK.KeyEnum.HARMONIX_ROCK_BAND_GUITAR_BLUE:
                    case OuyaSDK.KeyEnum.BUTTON_U:
                        return GetButton(3, player);
                    case OuyaSDK.KeyEnum.HARMONIX_ROCK_BAND_GUITAR_ORANGE:
                    case OuyaSDK.KeyEnum.BUTTON_L3:
                        return GetButton(6, player);
                    case OuyaSDK.KeyEnum.HARMONIX_ROCK_BAND_GUITAR_LOWER:
                        return GetButton(13, player);
                    case OuyaSDK.KeyEnum.BUTTON_BACK:
                    case OuyaSDK.KeyEnum.BUTTON_R3:
                        return GetButton(10, player);
                    case OuyaSDK.KeyEnum.BUTTON_START:
                    case OuyaSDK.KeyEnum.BUTTON_LB:
                        return GetButton(11, player);
                    case OuyaSDK.KeyEnum.BUTTON_SYSTEM:
                    case OuyaSDK.KeyEnum.BUTTON_RB:
                        return GetButton(12, player);
                    case OuyaSDK.KeyEnum.HARMONIX_ROCK_BAND_GUITAR_PICKUP:
                    case OuyaSDK.KeyEnum.BUTTON_LT:
                        return false;
                    case OuyaSDK.KeyEnum.HARMONIX_ROCK_BAND_GUITAR_WHAMMI:
                    case OuyaSDK.KeyEnum.BUTTON_RT:
                        return false;
                    case OuyaSDK.KeyEnum.BUTTON_DPAD_UP:
                        return GetAxis(keyCode, player) > 0f;
                    case OuyaSDK.KeyEnum.BUTTON_DPAD_DOWN:
                        return GetAxis(keyCode, player) < 0f;
                    case OuyaSDK.KeyEnum.BUTTON_DPAD_LEFT:
                        return GetAxis(keyCode, player) > 0f;
                    case OuyaSDK.KeyEnum.BUTTON_DPAD_RIGHT:
                        return GetAxis(keyCode, player) < 0f;
                    default:
                        return false;
                }

            case "BROADCOM BLUETOOTH HID":
            case "MOGA PRO HID":
                switch (keyCode)
                {
                    case OuyaSDK.KeyEnum.BUTTON_LB:
                        return GetButton(6, player);
                    case OuyaSDK.KeyEnum.BUTTON_RB:
                        return GetButton(7, player);
                    case OuyaSDK.KeyEnum.BUTTON_O:
                        return GetButton(0, player);
                    case OuyaSDK.KeyEnum.BUTTON_U:
                        return GetButton(3, player);
                    case OuyaSDK.KeyEnum.BUTTON_Y:
                        return GetButton(4, player);
                    case OuyaSDK.KeyEnum.BUTTON_A:
                        return GetButton(1, player);
                    case OuyaSDK.KeyEnum.BUTTON_L3:
                        return GetButton(13, player);
                    case OuyaSDK.KeyEnum.BUTTON_R3:
                        return GetButton(14, player);
                    case OuyaSDK.KeyEnum.BUTTON_DPAD_UP:
                        return GetAxis(keyCode, player) > 0f;
                    case OuyaSDK.KeyEnum.BUTTON_DPAD_DOWN:
                        return GetAxis(keyCode, player) < 0f;
                    case OuyaSDK.KeyEnum.BUTTON_DPAD_LEFT:
                        return GetAxis(keyCode, player) < 0f;
                    case OuyaSDK.KeyEnum.BUTTON_DPAD_RIGHT:
                        return GetAxis(keyCode, player) > 0f;
                    case OuyaSDK.KeyEnum.BUTTON_LT:
                        return GetAxis(keyCode, player) > 0f;
                    case OuyaSDK.KeyEnum.BUTTON_RT:
                        return GetAxis(keyCode, player) > 0f;
                    default:
                        return false;
                }

            case "OUYA GAME CONTROLLER":

                switch (keyCode)
                {
                    case OuyaSDK.KeyEnum.BUTTON_LB:
                        return GetButton(4, player);
                    case OuyaSDK.KeyEnum.BUTTON_RB:
                        return GetButton(5, player);
                    case OuyaSDK.KeyEnum.BUTTON_O:
                        return GetButton(0, player);
                    case OuyaSDK.KeyEnum.BUTTON_U:
                        return GetButton(1, player);
                    case OuyaSDK.KeyEnum.BUTTON_Y:
                        return GetButton(2, player);
                    case OuyaSDK.KeyEnum.BUTTON_A:
                        return GetButton(3, player);
                    case OuyaSDK.KeyEnum.BUTTON_L3:
                        return GetButton(6, player);
                    case OuyaSDK.KeyEnum.BUTTON_R3:
                        return GetButton(7, player);
                    case OuyaSDK.KeyEnum.BUTTON_DPAD_UP:
                        return GetButton(8, player);
                    case OuyaSDK.KeyEnum.BUTTON_DPAD_DOWN:
                        return GetButton(9, player);
                    case OuyaSDK.KeyEnum.BUTTON_DPAD_LEFT:
                        return GetButton(10, player);
                    case OuyaSDK.KeyEnum.BUTTON_DPAD_RIGHT:
                        return GetButton(11, player);
                    case OuyaSDK.KeyEnum.BUTTON_LT:
                        return GetButton(12, player);
                    case OuyaSDK.KeyEnum.BUTTON_RT:
                        return GetButton(13, player);
                    default:
                        return false;
                }

            case "XBOX 360 WIRELESS RECEIVER":

        #if !UNITY_EDITOR && UNITY_ANDROID

                switch (keyCode)
                {
                    case OuyaSDK.KeyEnum.BUTTON_LB:
                        return GetButton(6, player);
                    case OuyaSDK.KeyEnum.BUTTON_RB:
                        return GetButton(7, player);
                    case OuyaSDK.KeyEnum.BUTTON_O:
                        return GetButton(0, player);
                    case OuyaSDK.KeyEnum.BUTTON_U:
                        return GetButton(3, player);
                    case OuyaSDK.KeyEnum.BUTTON_Y:
                        return GetButton(4, player);
                    case OuyaSDK.KeyEnum.BUTTON_A:
                        return GetButton(1, player);
                    case OuyaSDK.KeyEnum.BUTTON_L3:
                        return GetButton(13, player);
                    case OuyaSDK.KeyEnum.BUTTON_R3:
                        return GetButton(14, player);
                    case OuyaSDK.KeyEnum.BUTTON_DPAD_UP:
                        return GetButton(2, player);
                    case OuyaSDK.KeyEnum.BUTTON_DPAD_DOWN:
                        return GetButton(3, player);
                    case OuyaSDK.KeyEnum.BUTTON_DPAD_LEFT:
                        return GetButton(0, player);
                    case OuyaSDK.KeyEnum.BUTTON_DPAD_RIGHT:
                        return GetButton(1, player);
                    case OuyaSDK.KeyEnum.BUTTON_LT:
                        return GetAxis(keyCode, player) > 0f;
                    case OuyaSDK.KeyEnum.BUTTON_RT:
                        return GetAxis(keyCode, player) > 0f;
                    default:
                        return false;
                }
        #else
                if (Application.platform == RuntimePlatform.OSXEditor)
                {
                    switch (keyCode)
                    {
                        case OuyaSDK.KeyEnum.BUTTON_LB:
                            return GetButton(13, player);
                        case OuyaSDK.KeyEnum.BUTTON_RB:
                            return GetButton(14, player);
                        case OuyaSDK.KeyEnum.BUTTON_O:
                            return GetButton(16, player);
                        case OuyaSDK.KeyEnum.BUTTON_U:
                            return GetButton(18, player);
                        case OuyaSDK.KeyEnum.BUTTON_Y:
                            return GetButton(19, player);
                        case OuyaSDK.KeyEnum.BUTTON_A:
                            return GetButton(17, player);
                        case OuyaSDK.KeyEnum.BUTTON_L3:
                            return GetButton(11, player);
                        case OuyaSDK.KeyEnum.BUTTON_R3:
                            return GetButton(12, player);
                        case OuyaSDK.KeyEnum.BUTTON_DPAD_UP:
                            return GetButton(5, player);
                        case OuyaSDK.KeyEnum.BUTTON_DPAD_DOWN:
                            return GetButton(6, player);
                        case OuyaSDK.KeyEnum.BUTTON_DPAD_LEFT:
                            return GetButton(7, player);
                        case OuyaSDK.KeyEnum.BUTTON_DPAD_RIGHT:
                            return GetButton(8, player);
                        case OuyaSDK.KeyEnum.BUTTON_LT:
                            return GetAxis(keyCode, player) > -1f;
                        case OuyaSDK.KeyEnum.BUTTON_RT:
                            return GetAxis(keyCode, player) > -1f;
                        default:
                            return false;
                    }
                }
                else
                {
                    switch (keyCode)
                    {
                        case OuyaSDK.KeyEnum.BUTTON_LB:
                            return GetButton(4, player);
                        case OuyaSDK.KeyEnum.BUTTON_RB:
                            return GetButton(5, player);
                        case OuyaSDK.KeyEnum.BUTTON_O:
                            return GetButton(0, player);
                        case OuyaSDK.KeyEnum.BUTTON_U:
                            return GetButton(2, player);
                        case OuyaSDK.KeyEnum.BUTTON_Y:
                            return GetButton(3, player);
                        case OuyaSDK.KeyEnum.BUTTON_A:
                            return GetButton(1, player);
                        case OuyaSDK.KeyEnum.BUTTON_L3:
                            return GetButton(8, player);
                        case OuyaSDK.KeyEnum.BUTTON_R3:
                            return GetButton(9, player);
                        case OuyaSDK.KeyEnum.BUTTON_DPAD_UP:
                            return GetAxis(keyCode, player) > 0f;
                        case OuyaSDK.KeyEnum.BUTTON_DPAD_DOWN:
                            return GetAxis(keyCode, player) < 0f;
                        case OuyaSDK.KeyEnum.BUTTON_DPAD_LEFT:
                            return GetAxis(keyCode, player) < 0f;
                        case OuyaSDK.KeyEnum.BUTTON_DPAD_RIGHT:
                            return GetAxis(keyCode, player) > 0f;
                        case OuyaSDK.KeyEnum.BUTTON_LT:
                            return GetAxis(keyCode, player) > 0f;
                        case OuyaSDK.KeyEnum.BUTTON_RT:
                            return GetAxis(keyCode, player) > 0f;
                        default:
                            return false;
                    }
                }
        #endif

            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)":
            case "MICROSOFT WIRELESS 360 CONTROLLER":

        #if !UNITY_EDITOR && UNITY_ANDROID

                switch (keyCode)
                {
                    case OuyaSDK.KeyEnum.BUTTON_LB:
                        return GetButton(6, player);
                    case OuyaSDK.KeyEnum.BUTTON_RB:
                        return GetButton(7, player);
                    case OuyaSDK.KeyEnum.BUTTON_O:
                        return GetButton(0, player);
                    case OuyaSDK.KeyEnum.BUTTON_U:
                        return GetButton(3, player);
                    case OuyaSDK.KeyEnum.BUTTON_Y:
                        return GetButton(4, player);
                    case OuyaSDK.KeyEnum.BUTTON_A:
                        return GetButton(1, player);
                    case OuyaSDK.KeyEnum.BUTTON_L3:
                        return GetButton(13, player);
                    case OuyaSDK.KeyEnum.BUTTON_R3:
                        return GetButton(14, player);
                    case OuyaSDK.KeyEnum.BUTTON_DPAD_UP:
                        return GetAxis(keyCode, player) > 0f;
                    case OuyaSDK.KeyEnum.BUTTON_DPAD_DOWN:
                        return GetAxis(keyCode, player) < 0f;
                    case OuyaSDK.KeyEnum.BUTTON_DPAD_LEFT:
                        return GetAxis(keyCode, player) < 0f;
                    case OuyaSDK.KeyEnum.BUTTON_DPAD_RIGHT:
                        return GetAxis(keyCode, player) > 0f;
                    case OuyaSDK.KeyEnum.BUTTON_LT:
                        return GetAxis(keyCode, player) > 0f;
                    case OuyaSDK.KeyEnum.BUTTON_RT:
                        return GetAxis(keyCode, player) > 0f;
                    default:
                        return false;
                }
        #else
                if (Application.platform == RuntimePlatform.OSXEditor)
                {
                    switch (keyCode)
                    {
                        case OuyaSDK.KeyEnum.BUTTON_LB:
                            return GetButton(13, player);
                        case OuyaSDK.KeyEnum.BUTTON_RB:
                            return GetButton(14, player);
                        case OuyaSDK.KeyEnum.BUTTON_O:
                            return GetButton(16, player);
                        case OuyaSDK.KeyEnum.BUTTON_U:
                            return GetButton(18, player);
                        case OuyaSDK.KeyEnum.BUTTON_Y:
                            return GetButton(19, player);
                        case OuyaSDK.KeyEnum.BUTTON_A:
                            return GetButton(17, player);
                        case OuyaSDK.KeyEnum.BUTTON_L3:
                            return GetButton(11, player);
                        case OuyaSDK.KeyEnum.BUTTON_R3:
                            return GetButton(12, player);
                        case OuyaSDK.KeyEnum.BUTTON_DPAD_UP:
                            return GetButton(5, player);
                        case OuyaSDK.KeyEnum.BUTTON_DPAD_DOWN:
                            return GetButton(6, player);
                        case OuyaSDK.KeyEnum.BUTTON_DPAD_LEFT:
                            return GetButton(7, player);
                        case OuyaSDK.KeyEnum.BUTTON_DPAD_RIGHT:
                            return GetButton(8, player);
                        case OuyaSDK.KeyEnum.BUTTON_LT:
                            return GetAxis(keyCode, player) > -1f;
                        case OuyaSDK.KeyEnum.BUTTON_RT:
                            return GetAxis(keyCode, player) > -1f;
                        default:
                            return false;
                    }
                }
                else
                {
                    switch (keyCode)
                    {
                        case OuyaSDK.KeyEnum.BUTTON_LB:
                            return GetButton(4, player);
                        case OuyaSDK.KeyEnum.BUTTON_RB:
                            return GetButton(5, player);
                        case OuyaSDK.KeyEnum.BUTTON_O:
                            return GetButton(0, player);
                        case OuyaSDK.KeyEnum.BUTTON_U:
                            return GetButton(2, player);
                        case OuyaSDK.KeyEnum.BUTTON_Y:
                            return GetButton(3, player);
                        case OuyaSDK.KeyEnum.BUTTON_A:
                            return GetButton(1, player);
                        case OuyaSDK.KeyEnum.BUTTON_L3:
                            return GetButton(8, player);
                        case OuyaSDK.KeyEnum.BUTTON_R3:
                            return GetButton(9, player);
                        case OuyaSDK.KeyEnum.BUTTON_DPAD_UP:
                            return GetAxis(keyCode, player) > 0f;
                        case OuyaSDK.KeyEnum.BUTTON_DPAD_DOWN:
                            return GetAxis(keyCode, player) < 0f;
                        case OuyaSDK.KeyEnum.BUTTON_DPAD_LEFT:
                            return GetAxis(keyCode, player) < 0f;
                        case OuyaSDK.KeyEnum.BUTTON_DPAD_RIGHT:
                            return GetAxis(keyCode, player) > 0f;
                        case OuyaSDK.KeyEnum.BUTTON_LT:
                            return GetAxis(keyCode, player) > 0f;
                        case OuyaSDK.KeyEnum.BUTTON_RT:
                            return GetAxis(keyCode, player) > 0f;
                        default:
                            return false;
                    }
                }
        #endif

            case "": //the driver is reporting the controller as blank

        #if !UNITY_EDITOR && UNITY_ANDROID

                switch (keyCode)
                {
                    case OuyaSDK.KeyEnum.BUTTON_LB:
                        return GetButton(6, player);
                    case OuyaSDK.KeyEnum.BUTTON_RB:
                        return GetButton(7, player);
                    case OuyaSDK.KeyEnum.BUTTON_O:
                        return GetButton(0, player);
                    case OuyaSDK.KeyEnum.BUTTON_U:
                        return GetButton(3, player);
                    case OuyaSDK.KeyEnum.BUTTON_Y:
                        return GetButton(4, player);
                    case OuyaSDK.KeyEnum.BUTTON_A:
                        return GetButton(1, player);
                    case OuyaSDK.KeyEnum.BUTTON_L3:
                        return GetButton(13, player);
                    case OuyaSDK.KeyEnum.BUTTON_R3:
                        return GetButton(14, player);
                    case OuyaSDK.KeyEnum.BUTTON_DPAD_UP:
                        return GetAxis(keyCode, player) > 0f;
                    case OuyaSDK.KeyEnum.BUTTON_DPAD_DOWN:
                        return GetAxis(keyCode, player) < 0f;
                    case OuyaSDK.KeyEnum.BUTTON_DPAD_LEFT:
                        return GetAxis(keyCode, player) < 0f;
                    case OuyaSDK.KeyEnum.BUTTON_DPAD_RIGHT:
                        return GetAxis(keyCode, player) > 0f;
                    case OuyaSDK.KeyEnum.BUTTON_LT:
                        return GetAxis(keyCode, player) > 0f;
                    case OuyaSDK.KeyEnum.BUTTON_RT:
                        return GetAxis(keyCode, player) > 0f;
                    default:
                        return false;
                }
        #else
                switch (keyCode)
                {
                    case OuyaSDK.KeyEnum.BUTTON_LB:
                        return GetButton(13, player);
                    case OuyaSDK.KeyEnum.BUTTON_RB:
                        return GetButton(14, player);
                    case OuyaSDK.KeyEnum.BUTTON_O:
                        return GetButton(16, player);
                    case OuyaSDK.KeyEnum.BUTTON_U:
                        return GetButton(18, player);
                    case OuyaSDK.KeyEnum.BUTTON_Y:
                        return GetButton(19, player);
                    case OuyaSDK.KeyEnum.BUTTON_A:
                        return GetButton(17, player);
                    case OuyaSDK.KeyEnum.BUTTON_L3:
                        return GetButton(11, player);
                    case OuyaSDK.KeyEnum.BUTTON_R3:
                        return GetButton(12, player);
                    case OuyaSDK.KeyEnum.BUTTON_DPAD_UP:
                        return GetButton(5, player);
                    case OuyaSDK.KeyEnum.BUTTON_DPAD_DOWN:
                        return GetButton(6, player);
                    case OuyaSDK.KeyEnum.BUTTON_DPAD_LEFT:
                        return GetButton(7, player);
                    case OuyaSDK.KeyEnum.BUTTON_DPAD_RIGHT:
                        return GetButton(8, player);
                    case OuyaSDK.KeyEnum.BUTTON_LT:
                        return GetAxis(keyCode, player) > 0f;
                    case OuyaSDK.KeyEnum.BUTTON_RT:
                        return GetAxis(keyCode, player) > 0f;
                    case OuyaSDK.KeyEnum.BUTTON_SELECT:
                        return GetButton(10, player);
                    case OuyaSDK.KeyEnum.BUTTON_START:
                        return GetButton(9, player);
                    case OuyaSDK.KeyEnum.BUTTON_SYSTEM:
                        return GetButton(15, player);
                    default:
                        return false;
                }
        #endif
        }

        return false;
    }
    /// <summary>
    /// Builds a string to get the controller by player.
    /// </summary>
    /// <param name="player"></param>
    /// <param name="axis"></param>
    /// <param name="type"></param>
    /// <param name="atype"></param>
    /// <returns></returns>
    public static string GetInput(OuyaSDK.OuyaPlayer player, AxisTypes axis, AnalogTypes atype)
    {
        Vector2 point;
        JoystickType joystickType = GetControllerType(player);
        switch (joystickType)
        {
            case JoystickType.ps3:
                //Note We don't care if the axis is X or Y,  we just want to check for input from normalized.
                #region PS3 Controller
                point = new Vector2(Input.GetAxis(CheckInput(player, axis, JoystickType.ps3, AnalogTypes.Left)), Input.GetAxis(CheckInput(player, axis, JoystickType.ps3, AnalogTypes.Right)));
                if (point.x != 0f || point.y != 0f)
                {
                    return CheckInput(player, axis, JoystickType.ps3, atype);
                }
                if (atype.Equals(AnalogTypes.DPad)){
                    return CheckInput(player, axis, JoystickType.ps3, atype);
                }
                #endregion
                return string.Empty;

            case JoystickType.xbox:
                #region xbox360
                point = new Vector2(Input.GetAxis(CheckInput(player, axis, JoystickType.xbox, AnalogTypes.Left)), Input.GetAxis(CheckInput(player, axis, JoystickType.xbox, AnalogTypes.Right)));
                if (point.x != 0f || point.y != 0f)
                {
                    return CheckInput(player, axis, JoystickType.xbox, atype);
                }
                if (atype.Equals(AnalogTypes.DPad))
                {
                    return CheckInput(player, axis, JoystickType.xbox, atype);
                }
                if (atype.Equals(AnalogTypes.LTRT))
                {
                    return CheckInput(player, axis, JoystickType.xbox, atype);
                }
                #endregion
                return string.Empty;

            case JoystickType.ouya:
                point = new Vector2(Input.GetAxis(CheckInput(player, axis, JoystickType.ouya, AnalogTypes.Left)), Input.GetAxis(CheckInput(player, axis, JoystickType.ouya, AnalogTypes.Right)));
                if (point.x != 0f || point.y != 0f)
                {
                    return CheckInput(player, axis, JoystickType.ouya, atype);
                }
                if (atype.Equals(AnalogTypes.DPad))
                {
                    return CheckInput(player, axis, JoystickType.ouya, atype);
                }
                if (atype.Equals(AnalogTypes.LTRT))
                {
                    return CheckInput(player, axis, JoystickType.ouya, atype);
                }
                return string.Empty;

            default:
                return "Horizontal";
        }
    }
 public static string GetKeyCode(int buttonNum, OuyaSDK.OuyaPlayer player)
 {
     switch (player)
     {
         case OuyaSDK.OuyaPlayer.none:
             return string.Format("JoystickButton{0}", buttonNum);
         default:
             return string.Format("Joystick{0}Button{1}", ((int)player), buttonNum);
     }
 }
 /// <summary>
 /// Builds a string to get the controller by player.
 /// </summary>
 /// <param name="player"></param>
 /// <param name="axis"></param>
 /// <param name="type"></param>
 /// <param name="atype"></param>
 /// <returns></returns>
 public static string GetInput(OuyaSDK.OuyaPlayer player, AxisTypes axis)
 {
     return GetInput(player, axis, AnalogTypes.none);
 }
 public static JoystickType GetControllerType(OuyaSDK.OuyaPlayer player)
 {
     // check the player to see what joystick type they have
     OuyaGameObject.Device device = OuyaGameObject.devices.Find(delegate(OuyaGameObject.Device d) { return (null == d) ? false : (d.player == player); });
     if (null == device)
     {
         return JoystickType.none;
     }
     return GetControllerType(device.name);
 }
 /// <summary>
 /// Wrap Unity's method
 /// </summary>
 /// <param name="inputName"></param>
 /// <returns></returns>
 public static bool GetButtonUp(string inputName, OuyaSDK.OuyaPlayer player)
 {
     // these will map to the Unity game's existing button names
     // the text cases are placeholders
     return !OuyaInputManager.GetButton(inputName, player);
 }
    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

        }
    }
 public ButtonMap(JoystickType type, int buttonID, OuyaSDK.KeyEnum button)
 {
     this.type = type;
     this.ButtonID = buttonID;
     this.button = button;
 }
 public static OuyaInputManager.OuyaKeyState getPlayerKeyState(OuyaSDK.OuyaPlayer player)
 {
     OuyaInputManager.OuyaKeyState keyState = keyStates.Find(delegate(OuyaInputManager.OuyaKeyState key) { return key.player.Equals(player); });
     return keyState;
 }
 /// <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;
     }
 }
 public static bool GetButton(OuyaSDK.KeyEnum keyCode)
 {
     return (
                GetButton(keyCode, OuyaSDK.OuyaPlayer.player1) ||
                GetButton(keyCode, OuyaSDK.OuyaPlayer.player2) ||
                GetButton(keyCode, OuyaSDK.OuyaPlayer.player3) ||
                GetButton(keyCode, OuyaSDK.OuyaPlayer.player4) ||
                GetButton(keyCode, OuyaSDK.OuyaPlayer.player5) ||
                GetButton(keyCode, OuyaSDK.OuyaPlayer.player6) ||
                GetButton(keyCode, OuyaSDK.OuyaPlayer.player7) ||
                GetButton(keyCode, OuyaSDK.OuyaPlayer.player8));
 }
    public static void HandleButtonEvent(OuyaSDK.InputButtonEvent inputEvent)
    {
        OuyaInputManager.OuyaKeyState keyState = OuyaInputManager.getPlayerKeyState(inputEvent.getPlayer());
        if (null == keyState)
        {
            return;
        }

        switch (inputEvent.getKeyAction())
        {
            case OuyaSDK.InputAction.KeyDown:
            case OuyaSDK.InputAction.KeyUp:
                switch (inputEvent.getKeyCode())
                {
                    case OuyaSDK.KeyEnum.BUTTON_O:
                        keyState.m_buttonO = inputEvent.getKeyAction() == OuyaSDK.InputAction.KeyDown;
                        break;
                    case OuyaSDK.KeyEnum.BUTTON_U:
                        keyState.m_buttonU = inputEvent.getKeyAction() == OuyaSDK.InputAction.KeyDown;
                        break;
                    case OuyaSDK.KeyEnum.BUTTON_Y:
                        keyState.m_buttonY = inputEvent.getKeyAction() == OuyaSDK.InputAction.KeyDown;
                        break;
                    case OuyaSDK.KeyEnum.BUTTON_A:
                        keyState.m_buttonA = inputEvent.getKeyAction() == OuyaSDK.InputAction.KeyDown;
                        break;
                    case OuyaSDK.KeyEnum.BUTTON_LB:
                        keyState.m_buttonLB = inputEvent.getKeyAction() == OuyaSDK.InputAction.KeyDown;
                        break;
                    case OuyaSDK.KeyEnum.BUTTON_LT:
                        keyState.m_buttonLT = inputEvent.getKeyAction() == OuyaSDK.InputAction.KeyDown;
                        break;
                    case OuyaSDK.KeyEnum.BUTTON_L3:
                        keyState.m_buttonL3 = inputEvent.getKeyAction() == OuyaSDK.InputAction.KeyDown;
                        break;
                    case OuyaSDK.KeyEnum.BUTTON_RB:
                        keyState.m_buttonRB = inputEvent.getKeyAction() == OuyaSDK.InputAction.KeyDown;
                        break;
                    case OuyaSDK.KeyEnum.BUTTON_RT:
                        keyState.m_buttonRT = inputEvent.getKeyAction() == OuyaSDK.InputAction.KeyDown;
                        break;
                    case OuyaSDK.KeyEnum.BUTTON_R3:
                        keyState.m_buttonR3 = inputEvent.getKeyAction() == OuyaSDK.InputAction.KeyDown;
                        break;
                    case OuyaSDK.KeyEnum.BUTTON_SYSTEM:
                        keyState.m_buttonSystem = inputEvent.getKeyAction() == OuyaSDK.InputAction.KeyDown;
                        break;
                    case OuyaSDK.KeyEnum.BUTTON_DPAD_DOWN:
                        keyState.m_buttonDPadDown = inputEvent.getKeyAction() == OuyaSDK.InputAction.KeyDown;
                        break;
                    case OuyaSDK.KeyEnum.BUTTON_DPAD_LEFT:
                        keyState.m_buttonDPadLeft = inputEvent.getKeyAction() == OuyaSDK.InputAction.KeyDown;
                        break;
                    case OuyaSDK.KeyEnum.BUTTON_DPAD_RIGHT:
                        keyState.m_buttonDPadRight = inputEvent.getKeyAction() == OuyaSDK.InputAction.KeyDown;
                        break;
                    case OuyaSDK.KeyEnum.BUTTON_DPAD_UP:
                        keyState.m_buttonDPadUp = inputEvent.getKeyAction() == OuyaSDK.InputAction.KeyDown;
                        break;
                    default:
                        return;
                }
                OuyaButtonEvent.buttonPressEvent(inputEvent.getPlayer(), inputEvent.getKeyCode(), inputEvent.getKeyAction());
                break;
        }
    }
    public static float GetAxis(OuyaSDK.KeyEnum keyCode, OuyaSDK.OuyaPlayer player)
    {
        if (null == OuyaExampleCommon.Joysticks)
        {
            return 0f;
        }
        int playerIndex = (int)player - 1;
        if (playerIndex >= OuyaExampleCommon.Joysticks.Length)
        {
            return 0f;
        }

        string joystickName = OuyaExampleCommon.Joysticks[playerIndex];
        if (null == joystickName)
        {
            return 0f;
        }

        bool invert = false;
        string axisName = string.Empty;

        switch (joystickName.ToUpper())
        {
            case "HARMONIX ROCK BAND DRUMKIT":
                return 0f;
            case "HARMONIX ROCK BAND GUITAR":
                switch (keyCode)
                {
                    case OuyaSDK.KeyEnum.HARMONIX_ROCK_BAND_GUITAR_PICKUP:
                    case OuyaSDK.KeyEnum.BUTTON_LT:
                        axisName = string.Format("Joy{0} Axis 3", (int)player);
                        break;
                    case OuyaSDK.KeyEnum.HARMONIX_ROCK_BAND_GUITAR_WHAMMI:
                    case OuyaSDK.KeyEnum.BUTTON_RT:
                        axisName = string.Format("Joy{0} Axis 4", (int)player);
                        break;
                    case OuyaSDK.KeyEnum.BUTTON_DPAD_LEFT:
                    case OuyaSDK.KeyEnum.BUTTON_DPAD_RIGHT:
                        axisName = string.Format("Joy{0} Axis 7", (int)player);
                        break;
                    case OuyaSDK.KeyEnum.HARMONIX_ROCK_BAND_GUITAR_STRUM:
                    case OuyaSDK.KeyEnum.AXIS_LSTICK_Y:
                    case OuyaSDK.KeyEnum.BUTTON_DPAD_UP:
                    case OuyaSDK.KeyEnum.BUTTON_DPAD_DOWN:
                        axisName = string.Format("Joy{0} Axis 8", (int)player);
                        break;
                    default:
                        return 0f;
                }
                break;

            case "BROADCOM BLUETOOTH HID":
            case "MOGA PRO HID":
        #if !UNITY_EDITOR && UNITY_ANDROID
            switch (keyCode)
            {
                case OuyaSDK.KeyEnum.AXIS_LSTICK_X:
                    axisName = string.Format("Joy{0} Axis 1", (int)player);
                    break;
                case OuyaSDK.KeyEnum.AXIS_LSTICK_Y:
                    axisName = string.Format("Joy{0} Axis 2", (int)player);
                    invert = true;
                    break;
                case OuyaSDK.KeyEnum.AXIS_RSTICK_X:
                    axisName = string.Format("Joy{0} Axis 3", (int)player);
                    break;
                case OuyaSDK.KeyEnum.AXIS_RSTICK_Y:
                    axisName = string.Format("Joy{0} Axis 4", (int)player);
                    break;
                case OuyaSDK.KeyEnum.BUTTON_LT:
                    axisName = string.Format("Joy{0} Axis 8", (int)player);
                    break;
                case OuyaSDK.KeyEnum.BUTTON_RT:
                    axisName = string.Format("Joy{0} Axis 7", (int)player);
                    break;
                case OuyaSDK.KeyEnum.BUTTON_DPAD_LEFT:
                    axisName = string.Format("Joy{0} Axis 5", (int)player);
                    break;
                case OuyaSDK.KeyEnum.BUTTON_DPAD_RIGHT:
                    axisName = string.Format("Joy{0} Axis 5", (int)player);
                    break;
                case OuyaSDK.KeyEnum.BUTTON_DPAD_UP:
                    axisName = string.Format("Joy{0} Axis 6", (int)player);
                    break;
                case OuyaSDK.KeyEnum.BUTTON_DPAD_DOWN:
                    axisName = string.Format("Joy{0} Axis 6", (int)player);
                    break;
                default:
                    return 0f;
            }
        #endif
                break;
            case "OUYA GAME CONTROLLER":

        #if !UNITY_EDITOR && UNITY_ANDROID
            switch (keyCode)
            {
                case OuyaSDK.KeyEnum.AXIS_LSTICK_X:
                    axisName = string.Format("Joy{0} Axis 1", (int)player);
                    break;
                case OuyaSDK.KeyEnum.AXIS_LSTICK_Y:
                    axisName = string.Format("Joy{0} Axis 2", (int)player);
                    break;
                case OuyaSDK.KeyEnum.AXIS_RSTICK_X:
                    axisName = string.Format("Joy{0} Axis 3", (int)player);
                    break;
                case OuyaSDK.KeyEnum.AXIS_RSTICK_Y:
                    axisName = string.Format("Joy{0} Axis 4", (int)player);
                    break;
                case OuyaSDK.KeyEnum.BUTTON_LT:
                    axisName = string.Format("Joy{0} Axis 5", (int)player);
                    break;
                case OuyaSDK.KeyEnum.BUTTON_RT:
                    axisName = string.Format("Joy{0} Axis 6", (int)player);
                    break;
                default:
                    return 0f;
            }
        #else
                switch (keyCode)
                {
                    case OuyaSDK.KeyEnum.AXIS_LSTICK_X:
                        axisName = string.Format("Joy{0} Axis 1", (int)player);
                        break;
                    case OuyaSDK.KeyEnum.AXIS_LSTICK_Y:
                        axisName = string.Format("Joy{0} Axis 2", (int)player);
                        invert = true;
                        break;
                    case OuyaSDK.KeyEnum.AXIS_RSTICK_X:
                        axisName = string.Format("Joy{0} Axis 4", (int)player);
                        invert = true;
                        break;
                    case OuyaSDK.KeyEnum.AXIS_RSTICK_Y:
                        axisName = string.Format("Joy{0} Axis 5", (int)player);
                        break;
                    case OuyaSDK.KeyEnum.BUTTON_LT:
                        axisName = string.Format("Joy{0} Axis 9", (int)player);
                        break;
                    case OuyaSDK.KeyEnum.BUTTON_RT:
                        axisName = string.Format("Joy{0} Axis 10", (int)player);
                        break;
                    default:
                        return 0f;
                }
        #endif
                break;

            case "XBOX 360 WIRELESS RECEIVER":

        #if !UNITY_EDITOR && UNITY_ANDROID

                switch (keyCode)
                {
                    case OuyaSDK.KeyEnum.AXIS_LSTICK_X:
                        axisName = string.Format("Joy{0} Axis 1", (int)player);
                        break;
                    case OuyaSDK.KeyEnum.AXIS_LSTICK_Y:
                        axisName = string.Format("Joy{0} Axis 2", (int)player);
                        break;
                    case OuyaSDK.KeyEnum.AXIS_RSTICK_X:
                        axisName = string.Format("Joy{0} Axis 3", (int)player);
                        break;
                    case OuyaSDK.KeyEnum.AXIS_RSTICK_Y:
                        axisName = string.Format("Joy{0} Axis 4", (int)player);
                        break;
                    case OuyaSDK.KeyEnum.BUTTON_LT:
                        axisName = string.Format("Joy{0} Axis 5", (int)player);
                        break;
                    case OuyaSDK.KeyEnum.BUTTON_RT:
                        axisName = string.Format("Joy{0} Axis 6", (int)player);
                        break;
                    default:
                        return 0f;
                }

        #else
                if (Application.platform == RuntimePlatform.OSXEditor)
                {
                    switch (keyCode)
                    {
                        case OuyaSDK.KeyEnum.AXIS_LSTICK_X:
                            axisName = string.Format("Joy{0} Axis 1", (int)player);
                            break;
                        case OuyaSDK.KeyEnum.AXIS_LSTICK_Y:
                            axisName = string.Format("Joy{0} Axis 2", (int)player);
                            break;
                        case OuyaSDK.KeyEnum.AXIS_RSTICK_X:
                            axisName = string.Format("Joy{0} Axis 3", (int)player);
                            break;
                        case OuyaSDK.KeyEnum.AXIS_RSTICK_Y:
                            axisName = string.Format("Joy{0} Axis 4", (int)player);
                            break;
                        case OuyaSDK.KeyEnum.BUTTON_LT:
                            axisName = string.Format("Joy{0} Axis 5", (int)player);
                            break;
                        case OuyaSDK.KeyEnum.BUTTON_RT:
                            axisName = string.Format("Joy{0} Axis 6", (int)player);
                            break;
                        default:
                            return 0f;
                    }
                }
                else
                {
                    switch (keyCode)
                    {
                        case OuyaSDK.KeyEnum.AXIS_LSTICK_X:
                            axisName = string.Format("Joy{0} Axis 1", (int)player);
                            break;
                        case OuyaSDK.KeyEnum.AXIS_LSTICK_Y:
                            axisName = string.Format("Joy{0} Axis 2", (int)player);
                            break;
                        case OuyaSDK.KeyEnum.AXIS_RSTICK_X:
                            axisName = string.Format("Joy{0} Axis 4", (int)player);
                            break;
                        case OuyaSDK.KeyEnum.AXIS_RSTICK_Y:
                            axisName = string.Format("Joy{0} Axis 5", (int)player);
                            break;
                        case OuyaSDK.KeyEnum.BUTTON_LT:
                            axisName = string.Format("Joy{0} Axis 9", (int)player);
                            break;
                        case OuyaSDK.KeyEnum.BUTTON_RT:
                            axisName = string.Format("Joy{0} Axis 10", (int)player);
                            break;
                        case OuyaSDK.KeyEnum.BUTTON_DPAD_LEFT:
                            axisName = string.Format("Joy{0} Axis 6", (int)player);
                            break;
                        case OuyaSDK.KeyEnum.BUTTON_DPAD_RIGHT:
                            axisName = string.Format("Joy{0} Axis 6", (int)player);
                            break;
                        case OuyaSDK.KeyEnum.BUTTON_DPAD_UP:
                            axisName = string.Format("Joy{0} Axis 7", (int)player);
                            break;
                        case OuyaSDK.KeyEnum.BUTTON_DPAD_DOWN:
                            axisName = string.Format("Joy{0} Axis 7", (int)player);
                            break;
                        default:
                            return 0f;
                    }
                }
        #endif

                break;

            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)":
            case "MICROSOFT WIRELESS 360 CONTROLLER":

        #if !UNITY_EDITOR && UNITY_ANDROID

                switch (keyCode)
                {
                    case OuyaSDK.KeyEnum.AXIS_LSTICK_X:
                        axisName = string.Format("Joy{0} Axis 1", (int)player);
                        break;
                    case OuyaSDK.KeyEnum.AXIS_LSTICK_Y:
                        axisName = string.Format("Joy{0} Axis 2", (int)player);
                        break;
                    case OuyaSDK.KeyEnum.AXIS_RSTICK_X:
                        axisName = string.Format("Joy{0} Axis 3", (int)player);
                        break;
                    case OuyaSDK.KeyEnum.AXIS_RSTICK_Y:
                        axisName = string.Format("Joy{0} Axis 4", (int)player);
                        break;
                    case OuyaSDK.KeyEnum.BUTTON_LT:
                        axisName = string.Format("Joy{0} Axis 7", (int)player);
                        break;
                    case OuyaSDK.KeyEnum.BUTTON_RT:
                        axisName = string.Format("Joy{0} Axis 8", (int)player);
                        break;
                    case OuyaSDK.KeyEnum.BUTTON_DPAD_LEFT:
                        axisName = string.Format("Joy{0} Axis 5", (int)player);
                        break;
                    case OuyaSDK.KeyEnum.BUTTON_DPAD_RIGHT:
                        axisName = string.Format("Joy{0} Axis 5", (int)player);
                        break;
                    case OuyaSDK.KeyEnum.BUTTON_DPAD_UP:
                        axisName = string.Format("Joy{0} Axis 6", (int)player);
                        break;
                    case OuyaSDK.KeyEnum.BUTTON_DPAD_DOWN:
                        axisName = string.Format("Joy{0} Axis 6", (int)player);
                        break;
                    default:
                        return 0f;
                }

        #else
                if (Application.platform == RuntimePlatform.OSXEditor)
                {
                    switch (keyCode)
                    {
                        case OuyaSDK.KeyEnum.AXIS_LSTICK_X:
                            axisName = string.Format("Joy{0} Axis 1", (int)player);
                            break;
                        case OuyaSDK.KeyEnum.AXIS_LSTICK_Y:
                            axisName = string.Format("Joy{0} Axis 2", (int)player);
                            break;
                        case OuyaSDK.KeyEnum.AXIS_RSTICK_X:
                            axisName = string.Format("Joy{0} Axis 3", (int)player);
                            break;
                        case OuyaSDK.KeyEnum.AXIS_RSTICK_Y:
                            axisName = string.Format("Joy{0} Axis 4", (int)player);
                            break;
                        case OuyaSDK.KeyEnum.BUTTON_LT:
                            axisName = string.Format("Joy{0} Axis 5", (int)player);
                            break;
                        case OuyaSDK.KeyEnum.BUTTON_RT:
                            axisName = string.Format("Joy{0} Axis 6", (int)player);
                            break;
                        default:
                            return 0f;
                    }
                }
                else
                {
                    switch (keyCode)
                    {
                        case OuyaSDK.KeyEnum.AXIS_LSTICK_X:
                            axisName = string.Format("Joy{0} Axis 1", (int) player);
                            break;
                        case OuyaSDK.KeyEnum.AXIS_LSTICK_Y:
                            axisName = string.Format("Joy{0} Axis 2", (int) player);
                            break;
                        case OuyaSDK.KeyEnum.AXIS_RSTICK_X:
                            axisName = string.Format("Joy{0} Axis 4", (int) player);
                            break;
                        case OuyaSDK.KeyEnum.AXIS_RSTICK_Y:
                            axisName = string.Format("Joy{0} Axis 5", (int) player);
                            break;
                        case OuyaSDK.KeyEnum.BUTTON_LT:
                            axisName = string.Format("Joy{0} Axis 9", (int) player);
                            break;
                        case OuyaSDK.KeyEnum.BUTTON_RT:
                            axisName = string.Format("Joy{0} Axis 10", (int) player);
                            break;
                        case OuyaSDK.KeyEnum.BUTTON_DPAD_LEFT:
                            axisName = string.Format("Joy{0} Axis 6", (int) player);
                            break;
                        case OuyaSDK.KeyEnum.BUTTON_DPAD_RIGHT:
                            axisName = string.Format("Joy{0} Axis 6", (int) player);
                            break;
                        case OuyaSDK.KeyEnum.BUTTON_DPAD_UP:
                            axisName = string.Format("Joy{0} Axis 7", (int) player);
                            break;
                        case OuyaSDK.KeyEnum.BUTTON_DPAD_DOWN:
                            axisName = string.Format("Joy{0} Axis 7", (int) player);
                            break;
                        default:
                            return 0f;
                    }
                }
        #endif

                break;

            case "": //the driver is reporting the controller as blank

        #if !UNITY_EDITOR && UNITY_ANDROID

                switch (keyCode)
                {
                    case OuyaSDK.KeyEnum.AXIS_LSTICK_X:
                        axisName = string.Format("Joy{0} Axis 1", (int)player);
                        break;
                    case OuyaSDK.KeyEnum.AXIS_LSTICK_Y:
                        axisName = string.Format("Joy{0} Axis 2", (int)player);
                        invert = true;
                        break;
                    case OuyaSDK.KeyEnum.AXIS_RSTICK_X:
                        axisName = string.Format("Joy{0} Axis 3", (int)player);
                        break;
                    case OuyaSDK.KeyEnum.AXIS_RSTICK_Y:
                        axisName = string.Format("Joy{0} Axis 4", (int)player);
                        invert = true;
                        break;
                    case OuyaSDK.KeyEnum.BUTTON_LT:
                        axisName = string.Format("Joy{0} Axis 7", (int)player);
                        break;
                    case OuyaSDK.KeyEnum.BUTTON_RT:
                        axisName = string.Format("Joy{0} Axis 8", (int)player);
                        break;
                    case OuyaSDK.KeyEnum.BUTTON_DPAD_LEFT:
                        axisName = string.Format("Joy{0} Axis 5", (int)player);
                        break;
                    case OuyaSDK.KeyEnum.BUTTON_DPAD_RIGHT:
                        axisName = string.Format("Joy{0} Axis 5", (int)player);
                        break;
                    case OuyaSDK.KeyEnum.BUTTON_DPAD_UP:
                        axisName = string.Format("Joy{0} Axis 6", (int)player);
                        break;
                    case OuyaSDK.KeyEnum.BUTTON_DPAD_DOWN:
                        axisName = string.Format("Joy{0} Axis 6", (int)player);
                        break;
                    default:
                        return 0f;
                }

        #else

                switch (keyCode)
                {
                    case OuyaSDK.KeyEnum.AXIS_LSTICK_X:
                        axisName = string.Format("Joy{0} Axis 1", (int)player);
                        break;
                    case OuyaSDK.KeyEnum.AXIS_LSTICK_Y:
                        axisName = string.Format("Joy{0} Axis 2", (int)player);
                        break;
                    case OuyaSDK.KeyEnum.AXIS_RSTICK_X:
                        axisName = string.Format("Joy{0} Axis 3", (int)player);
                        break;
                    case OuyaSDK.KeyEnum.AXIS_RSTICK_Y:
                        axisName = string.Format("Joy{0} Axis 4", (int)player);
                        break;
                    case OuyaSDK.KeyEnum.BUTTON_LT:
                        axisName = string.Format("Joy{0} Axis 5", (int)player);
                        break;
                    case OuyaSDK.KeyEnum.BUTTON_RT:
                        axisName = string.Format("Joy{0} Axis 6", (int)player);
                        break;
                    case OuyaSDK.KeyEnum.BUTTON_DPAD_LEFT:
                        if (GetButton(7, player))
                        {
                            return -1;
                        }
                        else
                        {
                            return 0;
                        }
                    case OuyaSDK.KeyEnum.BUTTON_DPAD_RIGHT:
                        if (GetButton(8, player))
                        {
                            return 1;
                        }
                        else
                        {
                            return 0;
                        }
                    case OuyaSDK.KeyEnum.BUTTON_DPAD_UP:
                        if (GetButton(5, player))
                        {
                            return 1;
                        }
                        else
                        {
                            return 0;
                        }
                    case OuyaSDK.KeyEnum.BUTTON_DPAD_DOWN:
                        if (GetButton(6, player))
                        {
                            return -1;
                        }
                        else
                        {
                            return 0;
                        }
                    default:
                        return 0f;
                }
        #endif

                break;
        }
        if (string.IsNullOrEmpty(axisName))
        {
            return 0f;
        }
        if (invert)
        {
            return -Input.GetAxisRaw(axisName);
        }
        else
        {
            return Input.GetAxisRaw(axisName);
        }
    }
 public static bool GetButton(int buttonNum, OuyaSDK.OuyaPlayer player)
 {
     return GetButton(buttonNum, player, Input.GetKey);
 }