Пример #1
0
    void callback_PickImage_With_Base64(string base64)
    {
        Texture2D tex = IOSAlbumCamera.Base64StringToTexture2D(base64);

        rawImage.texture = tex;
        ri.TestHttpSend(base64);
    }
Пример #2
0
    /// <summary>
    /// 打开相册相机后的从ios回调到unity的方法
    /// </summary>
    /// <param name="base64">Base64.</param>
    void PickImageCallBack_Base64(string base64)
    {
//		if(CallBack_PickImage_With_Base64!=null)
//		{
//			CallBack_PickImage_With_Base64(base64);
//		}
        Texture2D tex = IOSAlbumCamera.Base64StringToTexture2D(base64);

//		string warningStr = "当前相册截图是否存在~~~" + (tex != null).ToString () + "纹理输出:" + tex.ToString ();
//		Client.MessageHint.Show (warningStr);
        //Console.Error.WriteLine ("当前相册截图的纹理集合:"+(tex==null).ToString()+"纹理输出:"+tex.ToString());

        if (null != tex)
        {
            //HttpRequestManager.GetInstance ().UpLoadImage (tex);

            if (null != img_selecthead)
            {
                Sprite m_sprite = Sprite.Create(tex, new Rect(0, 0, tex.width, tex.height), new Vector2(0, 0));
                img_selecthead.sprite = m_sprite;
            }
        }
        else
        {
            Client.MessageHint.Show("获取纹理集失败");
        }


//		img_selecthead.texture = tex;
    }
Пример #3
0
    //void onclick_saveToAlbum()
    //{
    //	string path = Application.persistentDataPath + "/lzhscreenshot.png";
    //	Debug.Log (path);

    //	byte[] bytes = (rawImage.texture as Texture2D).EncodeToPNG ();
    //	System.IO.File.WriteAllBytes (path, bytes);

    //	IOSAlbumCamera.iosSaveImageToPhotosAlbum (path);

    //}

    void callback_PickImage_With_Base64(string base64)
    {
        Texture2D tex = IOSAlbumCamera.Base64StringToTexture2D(base64);

        androidPhoto.SendPictureByTypeId(tex);
        // LoadImage.GetLoadIamge.SendImage(tex);
    }
Пример #4
0
        /// <summary>
        /// 从相册_时刻/照片中获取图片成功回调
        /// </summary>
        /// <param name="imgDataStr"></param>
        void GetImgDataFromAlbum(string imgDataStr)
        {
            Debug.Log("Unity 调用相册 完成回调");

            Texture2D tex = IOSAlbumCamera.Base64StringToTexture2D(imgDataStr);

            img.sprite = Sprite.Create(tex, new Rect(0, 0, tex.width, tex.height), new Vector2(0.5f, 0.5f));
            Debug.Log("tackor tex.w= " + tex.width + "; tex.h= " + tex.height + "; sprite= " + img.sprite);
        }