/// <summary> /// Return the supported buttons /// </summary> /// <param name="player"></param> /// <returns></returns> public static OuyaSDK.KeyEnum[] GetSupportedButtons(OuyaSDK.OuyaPlayer player) { IOuyaController controller = GetSupportedController(player); if (null == controller) { return(null); } return(controller.GetSupportedButtons()); }
/// <summary> /// Get the KeyCode to be used with the Unity API /// </summary> /// <param name="keyCode"></param> /// <param name="player"></param> /// <returns></returns> public static KeyCode GetUnityKeyCode(OuyaSDK.KeyEnum keyCode, OuyaSDK.OuyaPlayer player) { IOuyaController controller = GetSupportedController(player); if (null == controller) { return((KeyCode)(-1)); } return(controller.GetUnityKeyCode(keyCode, player)); }
/// <summary> /// Get the AxisName to be used with the Unity API /// </summary> /// <param name="keyCode"></param> /// <param name="player"></param> /// <returns></returns> public static string GetUnityAxisName(OuyaSDK.KeyEnum keyCode, OuyaSDK.OuyaPlayer player) { IOuyaController controller = GetSupportedController(player); if (null == controller) { return(string.Empty); } return(controller.GetUnityAxisName(keyCode, player)); }
/// <summary> /// Check if the axis should be inverted after accessing the Unity API /// </summary> /// <param name="keyCode"></param> /// <param name="player"></param> /// <returns></returns> public static bool GetAxisInverted(OuyaSDK.KeyEnum keyCode, OuyaSDK.OuyaPlayer player) { IOuyaController controller = GetSupportedController(player); if (null == controller) { return(false); } return(controller.GetAxisInverted(keyCode)); }
/// <summary> /// Check if the controller button is available /// </summary> /// <param name="keyCode"></param> /// <param name="player"></param> /// <returns></returns> public static bool HasButton(OuyaSDK.KeyEnum keyCode, OuyaSDK.OuyaPlayer player) { IOuyaController controller = GetSupportedController(player); if (null == controller) { return(false); } return(controller.HasButton(keyCode)); }
/// <summary> /// Register a supported controllers /// </summary> static OuyaSDK() { // Log the ouya-unity-plugin version: Debug.Log(string.Format("ouya-unity-plugin version: {0}", VERSION)); #if !UNITY_WINRT try { //Debug.Log("Accessing Assembly for IOuyaController"); Assembly assembly = Assembly.GetAssembly(typeof(IOuyaController)); //Debug.Log("Getting types"); foreach (Type type in assembly.GetTypes()) { //Debug.Log(string.Format("Type={0}", type.Name)); if (type == typeof(IOuyaController)) { //Debug.Log(" skip..."); } else if (typeof(IOuyaController).IsAssignableFrom(type)) { //Debug.Log(" Creating..."); IOuyaController controller = (IOuyaController)Activator.CreateInstance(type); if (null != controller) { m_supportedControllers.Add(controller); /* * Debug.Log(string.Format("Registered Controller: {0}", controller.GetType())); * foreach (string joystick in controller.GetSupportedJoysicks()) * { * Debug.Log(string.Format(" Supports: {0}", joystick)); * } */ } } } } catch (Exception) { } #endif }