Ejemplo n.º 1
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");
            }
        }
    }
Ejemplo n.º 2
0
    /// <summary>
    /// IContentInitializedListener
    /// </summary>
    public void ContentInitializedOnInitialized()
    {
        m_status = string.Format("Status: {0}", MethodBase.GetCurrentMethod().Name);
        Debug.Log(m_status);

        using (OuyaContent ouyaContent = OuyaUnityPlugin.getOuyaContent())
        {
            if (null == ouyaContent)
            {
                Debug.LogError("OuyaContent is null");
                return;
            }
            m_isAvailable = ouyaContent.isAvailable();
        }

        RunSearch();
    }
Ejemplo n.º 3
0
    void RunSearch()
    {
        m_status = "Refreshing list...";

        CleanWidgets();
        ResetFocus();

        using (OuyaContent ouyaContent = OuyaUnityPlugin.getOuyaContent())
        {
            if (null == ouyaContent)
            {
                Debug.LogError("OuyaContent is null");
                return;
            }
            if (ouyaContent.isInitialized())
            {
                OuyaUnityPlugin.getOuyaContentInstalled();
                OuyaUnityPlugin.getOuyaContentPublished(m_sortMethod);
            }
        }
    }