Exemplo n.º 1
0
        public static OuyaController getControllerByPlayer(int deviceId)
        {
            if (_jcOuyaController == IntPtr.Zero)
            {
                Debug.LogError("_jcOuyaController is not initialized");
                return(null);
            }
            if (_jmGetControllerByPlayer == IntPtr.Zero)
            {
                Debug.LogError("_jmGetControllerByPlayer is not initialized");
                return(null);
            }
            IntPtr result = AndroidJNI.CallStaticObjectMethod(_jcOuyaController, _jmGetControllerByPlayer, new jvalue[] { new jvalue()
                                                                                                                          {
                                                                                                                              i = deviceId
                                                                                                                          } });

            if (result == IntPtr.Zero)
            {
                //might not be connected
                //Debug.LogError("Failed to get OuyaController");
                return(null);
            }
            OuyaController retVal = new OuyaController(result);

            return(retVal);
        }
Exemplo n.º 2
0
        public static OuyaController getControllerByPlayer(int deviceId)
        {
            if (_jcOuyaController == IntPtr.Zero)
            {
                Debug.LogError("_jcOuyaController is not initialized");
                return null;
            }
            if (_jmGetControllerByPlayer == IntPtr.Zero)
            {
                Debug.LogError("_jmGetControllerByPlayer is not initialized");
                return null;
            }
            IntPtr result = AndroidJNI.CallStaticObjectMethod(_jcOuyaController, _jmGetControllerByPlayer, new jvalue[] { new jvalue() { i = deviceId } });

            if (result == IntPtr.Zero)
            {
                //might not be connected
                //Debug.LogError("Failed to get OuyaController");
                return null;
            }
            OuyaController retVal = new OuyaController(result);
            return retVal;
        }