Пример #1
0
            public void removeScreenshot(OuyaModScreenshot screenshot)
            {
#if VERBOSE_LOGGING
                Debug.Log(string.Format("Invoking {0}...", MethodBase.GetCurrentMethod().Name));
#endif
                JNIFind();

                if (_instance == IntPtr.Zero)
                {
                    Debug.LogError("_instance is not initialized");
                    return;
                }
                if (_jmRemoveScreenshot == IntPtr.Zero)
                {
                    Debug.LogError("_jmRemoveScreenshot is not initialized");
                    return;
                }
                if (null == screenshot)
                {
                    Debug.LogError("bitmap is not initialized");
                    return;
                }
                if (screenshot.GetInstance() == IntPtr.Zero)
                {
                    Debug.LogError("screenshot.Instance is not initialized");
                    return;
                }

                IntPtr arg1 = screenshot.GetInstance();
                AndroidJNI.CallVoidMethod(_instance, _jmRemoveScreenshot, new jvalue[] { new jvalue()
                                                                                         {
                                                                                             l = arg1
                                                                                         } });
            }
Пример #2
0
            public void removeScreenshot(OuyaModScreenshot screenshot)
            {
                #if VERBOSE_LOGGING
                Debug.Log(string.Format("Invoking {0}...", MethodBase.GetCurrentMethod().Name));
                #endif
                JNIFind();

                if (_instance == IntPtr.Zero)
                {
                    Debug.LogError("_instance is not initialized");
                    return;
                }
                if (_jmRemoveScreenshot == IntPtr.Zero)
                {
                    Debug.LogError("_jmRemoveScreenshot is not initialized");
                    return;
                }
                if (null == screenshot)
                {
                    Debug.LogError("bitmap is not initialized");
                    return;
                }
                if (screenshot.GetInstance() == IntPtr.Zero)
                {
                    Debug.LogError("screenshot.Instance is not initialized");
                    return;
                }

                IntPtr arg1 = screenshot.GetInstance();
                AndroidJNI.CallVoidMethod(_instance, _jmRemoveScreenshot, new jvalue[] { new jvalue() { l = arg1 } });
            }
        public static List<OuyaModScreenshot> getOuyaModScreenshotList(IntPtr list)
        {
#if VERBOSE_LOGGING
            Debug.Log(string.Format("Invoking {0}...", MethodBase.GetCurrentMethod().Name));
#endif
            JNIFind();

            if (_jcOuyaUnityPlugin == IntPtr.Zero)
            {
                Debug.LogError("_jcOuyaUnityPlugin is not initialized");
                return null;
            }
            if (_jmGetOuyaModScreenshotArray == IntPtr.Zero)
            {
                Debug.LogError("_jmGetOuyaModScreenshotArray is not initialized");
                return null;
            }

            IntPtr result = AndroidJNI.CallStaticObjectMethod(_jcOuyaUnityPlugin, _jmGetOuyaModScreenshotArray, new jvalue[] { new jvalue() { l = list } });
            if (result == IntPtr.Zero)
            {
                Debug.LogError("_jmGetOuyaModScreenshotArray returned null");
                return null;
            }

            List<OuyaModScreenshot> items = new List<OuyaModScreenshot>();

#if VERBOSE_LOGGING
            Debug.Log("Invoking AndroidJNI.FromObjectArray...");
#endif

            IntPtr[] resultArray = AndroidJNI.FromObjectArray(result);
            AndroidJNI.DeleteLocalRef(result);

#if VERBOSE_LOGGING
            Debug.Log("Invoked AndroidJNI.FromObjectArray.");
#endif

            foreach (IntPtr ptr in resultArray)
            {
#if VERBOSE_LOGGING
                Debug.Log("Found Bitmap making Global Ref...");
#endif
                IntPtr globalRef = AndroidJNI.NewGlobalRef(ptr);
                AndroidJNI.DeleteLocalRef(ptr);
#if VERBOSE_LOGGING
                Debug.Log("Made global ref for Bitmap.");
#endif
                OuyaModScreenshot item = new OuyaModScreenshot(globalRef);
#if VERBOSE_LOGGING
                Debug.Log("Deleting old local ref...");
#endif
                items.Add(item);
            }
#if VERBOSE_LOGGING
            Debug.Log("Deleting OuyaModScreenshot list reference...");
#endif
            return items;
        }