Esempio n. 1
0
    private void Awake()
    {
        OuyaSDK.registerContentInitializedListener(this);
        OuyaSDK.registerContentDeleteListener(this);
        OuyaSDK.registerContentDownloadListener(this);
        OuyaSDK.registerContentInstalledSearchListener(this);
        OuyaSDK.registerContentPublishedSearchListener(this);
        OuyaSDK.registerContentPublishListener(this);
        OuyaSDK.registerContentSaveListener(this);
        OuyaSDK.registerContentUnpublishListener(this);
        OuyaSDK.registerResumeListener(this);

        if (null != m_textureScreenshots)
        {
            m_bitmapScreenshots = new Bitmap[m_textureScreenshots.Length];
            for (int index = 0; index < m_textureScreenshots.Length; ++index)
            {
                Texture2D texture = m_textureScreenshots[index];

                Debug.Log("Encoding PNG from texture bytes");

                // make texture readable
                byte[] buffer = texture.EncodeToPNG();
                if (null == buffer ||
                    buffer.Length == 0)
                {
                    Debug.LogError("Failed to encode png");
                }
                else
                {
                    Debug.Log("Converting bytes to bitmap");
                    m_bitmapScreenshots[index] = BitmapFactory.decodeByteArray(buffer, 0, buffer.Length);
                }
            }
        }

        ResetFocus();
    }