修改细节

This commit is contained in:
Caiyanpeng committed 2021-12-29 17:05:58 +08:00
1 parent be731c471b
commit 8dde7520ad
10 files changed
+193 -13

No files matched your search

+8 -3
View File
@@ -10,6 +10,7 @@ using System.Net.NetworkInformation;
using System.Net.Sockets;
using System.Runtime.InteropServices;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.Networking;
using UnityEngine.UI;
@@ -386,7 +387,7 @@ namespace Assets.Scripts
/// <param name="img"></param>
/// <param name="url"></param>
/// <param name="caches"></param>
public static void DisplayImageTempDict(MaskableGraphic img, string url, Dictionary<string, Texture> caches = null)
public static void DisplayImageTempDict(MaskableGraphic img, string url, Dictionary<string, Texture> caches = null,UnityAction<byte[]> callback = null)
{
if (string.IsNullOrEmpty(url))
return;
@@ -411,7 +412,7 @@ namespace Assets.Scripts
{
caches.Add(url, texture);
}
}));
},callback));
}
@@ -438,7 +439,7 @@ namespace Assets.Scripts
}
}
}
static IEnumerator DownloadImage(MaskableGraphic img,string MediaUrl, Action<Texture> action = null)
static IEnumerator DownloadImage(MaskableGraphic img,string MediaUrl, Action<Texture> action = null,UnityAction<byte[]> callback = null)
{
UnityWebRequest request = UnityWebRequest.Get(MediaUrl);
yield return request.SendWebRequest();
@@ -461,6 +462,10 @@ namespace Assets.Scripts
{
action.Invoke(texture);
}
if (callback != null)
{
callback.Invoke(data);
}
}
}
public static Texture GetDownloadTexture(string MediaUrl, byte[] data)