安卓分享
This commit is contained in:
1 parent
6c0d9f5dec
commit
a9e4b1fd34
7 files changed
+184
-6
No files matched your search
@@ -220,6 +220,9 @@ namespace Assets.Scripts
|
||||
}
|
||||
loading.GetComponent<LoadingPf>().Show();
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static bool isUpdate(string currentVersion,string realVersion)
|
||||
{
|
||||
var a = currentVersion.Split('.');
|
||||
@@ -310,6 +313,13 @@ namespace Assets.Scripts
|
||||
/*删除父亲节点下的所有孩子*/
|
||||
|
||||
/*显示网络图片*/
|
||||
|
||||
public static void GetImageBytes(string url, Action<byte[]> p)
|
||||
{
|
||||
if (string.IsNullOrEmpty(url))
|
||||
return;
|
||||
UIManager.Instance.StartCoroutine(DownloadImageByte(url, p));
|
||||
}
|
||||
public static Dictionary<string, Texture> propTextureCache = new Dictionary<string, Texture>();
|
||||
public delegate Coroutine StartCoroutine(IEnumerator routine);
|
||||
public static void DisplayImage(RawImage img, string url, bool cache = false,Dictionary<string,Texture> caches = null)
|
||||
@@ -374,8 +384,24 @@ namespace Assets.Scripts
|
||||
startCoroutine(DownloadImageCallBack(img, url, action));
|
||||
}
|
||||
|
||||
|
||||
|
||||
static IEnumerator DownloadImageByte(string MediaUrl, Action<byte[]> action = null)
|
||||
{
|
||||
UnityWebRequest request = UnityWebRequest.Get(MediaUrl);
|
||||
yield return request.SendWebRequest();
|
||||
if (request.isNetworkError || request.isHttpError)
|
||||
{
|
||||
Debug.Log(request.error);
|
||||
action.Invoke(null);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (action != null)
|
||||
{
|
||||
action.Invoke(request.downloadHandler.data);
|
||||
}
|
||||
}
|
||||
}
|
||||
static IEnumerator DownloadImage(RawImage img,string MediaUrl, Action<Texture> action = null)
|
||||
{
|
||||
UnityWebRequest request = UnityWebRequest.Get(MediaUrl);
|
||||
|
||||
Reference in new issue
Block a user