예제 #1
0
    /// <summary>
    /// IContentSaveListener
    /// </summary>
    public void ContentSaveOnSuccess(OuyaMod ouyaMod)
    {
        m_status = string.Format("Status: {0}", MethodBase.GetCurrentMethod().Name);
        Debug.Log(m_status);

        RunSearch();
    }
예제 #2
0
    /// <summary>
    /// IContentDownloadListener
    /// </summary>
    public void ContentDownloadOnComplete(OuyaMod ouyaMod)
    {
        m_status = string.Format("Status: {0}", MethodBase.GetCurrentMethod().Name);
        Debug.Log(m_status);

        RunSearch();
    }
예제 #3
0
        public static void saveOuyaMod(OuyaMod ouyaMod, OuyaMod.Editor editor)
        {
#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;
            }
            if (_jmSaveOuyaMod == IntPtr.Zero)
            {
                Debug.LogError("_jmSaveOuyaMod is not initialized");
                return;
            }

            IntPtr arg1 = ouyaMod.GetInstance();
            IntPtr arg2 = editor.GetInstance();
            AndroidJNI.CallStaticVoidMethod(_jcOuyaUnityPlugin, _jmSaveOuyaMod, new jvalue[] { new jvalue()
                                                                                               {
                                                                                                   l = arg1
                                                                                               }, new jvalue()
                                                                                               {
                                                                                                   l = arg2
                                                                                               } });
        }
예제 #4
0
    public void Edit(OuyaMod ouyaMod)
    {
        using (OuyaMod.Editor editor = ouyaMod.edit())
        {
            //Debug.Log("Access to Editor");

            // Required fields:
            editor.setTitle("edit title");
            editor.setCategory("edit category");
            editor.setDescription("edit description");

            // replace file
            editor.deleteFile("level.dat");

            using (OutputStream os = editor.newFile("level.dat"))
            {
                os.write(System.Text.UTF8Encoding.UTF8.GetBytes("edit file"));
                os.close();
            }

            // remove old screenshot
            List <OuyaModScreenshot> screenshots = ouyaMod.getScreenshots();
            for (int index = 0; index < screenshots.Count; ++index)
            {
                using (OuyaModScreenshot ouyaModScreenshot = screenshots[index])
                {
                    editor.removeScreenshot(ouyaModScreenshot);
                }
            }

            // add new screenshot
            if (m_bitmapScreenshots.Length > 1)
            {
                Debug.Log("Adding screenshot");
                editor.addScreenshot(m_bitmapScreenshots[1]);
            }
            else
            {
                Debug.LogError("Missing screenshot");
            }

            // remove old tags
            foreach (string tag in ouyaMod.getTags())
            {
                editor.removeTag(tag);
            }

            // Add optional tags:
            editor.addTag("edit tag");

            // Add optional metadata for your own display:
            editor.setMetadata("edit meta data");

            OuyaUnityPlugin.saveOuyaMod(ouyaMod, editor);
        }
    }
예제 #5
0
    public void Create()
    {
        using (OuyaContent ouyaContent = OuyaUnityPlugin.getOuyaContent())
        {
            if (null == ouyaContent)
            {
                Debug.LogError("OuyaContent is null");
                return;
            }
            if (ouyaContent.isInitialized())
            {
                //Debug.Log("OuyaContent is initialized");
                using (OuyaMod ouyaMod = ouyaContent.create())
                {
                    //Debug.Log("Created OuyaMod");
                    using (OuyaMod.Editor editor = ouyaMod.edit())
                    {
                        //Debug.Log("Access to Editor");

                        // Required fields:
                        editor.setTitle("Custom Level");
                        editor.setCategory("level");
                        editor.setDescription("This is my custom level");

                        using (OutputStream os = editor.newFile("level.dat"))
                        {
                            os.write(System.Text.UTF8Encoding.UTF8.GetBytes("Hello World"));
                            os.close();
                        }

                        if (m_bitmapScreenshots.Length > 0)
                        {
                            editor.addScreenshot(m_bitmapScreenshots[0]);
                        }

                        // Add optional tags:
                        editor.addTag("space");
                        editor.addTag("king of the hill");

                        // Add optional metadata for your own display:
                        editor.setMetadata("difficulty=4;theme=space;mode=koth");

                        OuyaUnityPlugin.saveOuyaMod(ouyaMod, editor);
                    }
                }
            }
            else
            {
                Debug.LogError("OuyaContent is not initialized");
            }
        }
    }
예제 #6
0
        public static List <OuyaMod> getOuyaContentPublishedResults()
        {
#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 (_jmGetOuyaContentPublishedResults == IntPtr.Zero)
            {
                Debug.LogError("_jmGetOuyaContentPublishedResults is not initialized");
                return(null);
            }

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

            List <OuyaMod> ouyaMods    = new List <OuyaMod>();
            IntPtr[]       resultArray = AndroidJNI.FromObjectArray(result);
            foreach (IntPtr ptr in resultArray)
            {
                IntPtr globalRef = AndroidJNI.NewGlobalRef(ptr);
                AndroidJNI.DeleteLocalRef(ptr);
                OuyaMod ouyaMod = new OuyaMod(globalRef);
                ouyaMods.Add(ouyaMod);
            }
            AndroidJNI.DeleteLocalRef(result);
            return(ouyaMods);
        }
예제 #7
0
 void Rate(OuyaMod ouyaMod)
 {
     ouyaMod.rate();
 }
예제 #8
0
 void Flag(OuyaMod ouyaMod)
 {
     ouyaMod.flag();
 }
예제 #9
0
 void Download(OuyaMod ouyaMod)
 {
     OuyaUnityPlugin.contentDownload(ouyaMod);
 }
예제 #10
0
 void Delete(OuyaMod ouyaMod)
 {
     OuyaUnityPlugin.contentDelete(ouyaMod);
 }
예제 #11
0
 void Unpublish(OuyaMod ouyaMod)
 {
     OuyaUnityPlugin.contentUnpublish(ouyaMod);
 }
예제 #12
0
 void Publish(OuyaMod ouyaMod)
 {
     OuyaUnityPlugin.contentPublish(ouyaMod);
 }
예제 #13
0
 public void ContentUnpublishOnError(OuyaMod ouyaMod, int code, string reason)
 {
     m_status = string.Format("Status: {0} code={1} reason={2}", MethodBase.GetCurrentMethod().Name, code, reason);
     Debug.Log(m_status);
 }
예제 #14
0
 public void ContentDownloadOnProgress(OuyaMod ouyaMod, int progress)
 {
     m_status = string.Format("Status: {0} progress={1}", MethodBase.GetCurrentMethod().Name, progress);
     Debug.Log(m_status);
 }
예제 #15
0
 public void ContentDownloadOnFailed(OuyaMod ouyaMod)
 {
     m_status = string.Format("Status: {0}", MethodBase.GetCurrentMethod().Name);
     Debug.Log(m_status);
 }