更新拉取图片的缓存代码
This commit is contained in:
parent
696fd256a8
commit
6645310601
26
Assets/Editor/ExportAssets.cs
Normal file
26
Assets/Editor/ExportAssets.cs
Normal file
@ -0,0 +1,26 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
|
||||
public class ExportAssets : MonoBehaviour
|
||||
{
|
||||
[@MenuItem("Juze/Build Asset Bundles")]
|
||||
static void BuildAssetBundles()
|
||||
{
|
||||
|
||||
BuildPipeline.BuildAssetBundles(Application.streamingAssetsPath, BuildAssetBundleOptions.UncompressedAssetBundle, BuildTarget.StandaloneWindows);
|
||||
}
|
||||
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
11
Assets/Editor/ExportAssets.cs.meta
Normal file
11
Assets/Editor/ExportAssets.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9696ca9d085337943844a940a23e41f3
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -70,7 +70,7 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
//展示当前路书图片
|
||||
public void SetMapRouteImage(string url)
|
||||
{
|
||||
Utils.DisplayImage(StartCoroutine, mapRouteImage, url);
|
||||
Utils.DisplayImage(mapRouteImage, url);
|
||||
}
|
||||
public void DrawMapRoute(MapDataModel mapData)
|
||||
{
|
||||
@ -214,12 +214,12 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
{
|
||||
uploadByUserName.text = userList[0].Name;
|
||||
var countryUrl = App.Host + $"User/GetCountryImg?userid={userList[0].Id}";
|
||||
Utils.DisplayImage(StartCoroutine, head, userList[0].HeadImage);//头像
|
||||
Utils.DisplayImage(head, userList[0].HeadImage);//头像
|
||||
|
||||
country.texture = cyclingController.GetCountryImageByCode(route.CountryCode);//上传者国家
|
||||
mapCountry.texture = cyclingController.GetCountryImageByName(userList[0].Country);//路书国家
|
||||
|
||||
Utils.DisplayImage(StartCoroutine, altitudeGraph, route.AltitudeGraph);//海拔图
|
||||
Utils.DisplayImage(altitudeGraph, route.AltitudeGraph);//海拔图
|
||||
loadingPanel.SetActive(false);
|
||||
}
|
||||
#endregion
|
||||
|
||||
@ -52,14 +52,14 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
{
|
||||
if (!_headUrl.Equals(url))
|
||||
{
|
||||
if (App.TextureCache.ContainsKey(url))
|
||||
{
|
||||
Head.texture = App.TextureCache[url];
|
||||
}
|
||||
else
|
||||
{
|
||||
Utils.DisplayImageAysnc(StartCoroutine, Head, url, ImageCallBack);
|
||||
}
|
||||
//if (App.TextureCache.ContainsKey(url))
|
||||
//{
|
||||
// Head.texture = App.TextureCache[url];
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
Utils.DisplayImage(Head, url, true);
|
||||
//}
|
||||
|
||||
//Utils.DisplayImage(StartCoroutine, Head, url);
|
||||
//StartCoroutine(DownloadImage(Head, url));
|
||||
@ -69,30 +69,30 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
Head.material = material;
|
||||
}
|
||||
}
|
||||
private void ImageCallBack(string url)
|
||||
{
|
||||
if (!App.TextureCache.ContainsKey(url))
|
||||
App.TextureCache.Add(url, Head.texture);
|
||||
}
|
||||
//private void ImageCallBack(string url)
|
||||
//{
|
||||
// if (!App.TextureCache.ContainsKey(url))
|
||||
// App.TextureCache.Add(url, Head.texture);
|
||||
//}
|
||||
|
||||
IEnumerator DownloadImage(RawImage img, string MediaUrl)
|
||||
{
|
||||
if (!App.TextureCache.ContainsKey(MediaUrl))
|
||||
{
|
||||
UnityWebRequest request = UnityWebRequestTexture.GetTexture(MediaUrl);
|
||||
yield return request.SendWebRequest();
|
||||
if (request.isNetworkError || request.isHttpError)
|
||||
Debug.Log(request.error);
|
||||
else
|
||||
img.texture = ((DownloadHandlerTexture)request.downloadHandler).texture;
|
||||
//IEnumerator DownloadImage(RawImage img, string MediaUrl)
|
||||
//{
|
||||
// if (!App.TextureCache.ContainsKey(MediaUrl))
|
||||
// {
|
||||
// UnityWebRequest request = UnityWebRequestTexture.GetTexture(MediaUrl);
|
||||
// yield return request.SendWebRequest();
|
||||
// if (request.isNetworkError || request.isHttpError)
|
||||
// Debug.Log(request.error);
|
||||
// else
|
||||
// img.texture = ((DownloadHandlerTexture)request.downloadHandler).texture;
|
||||
|
||||
App.TextureCache.Add(MediaUrl, img.texture);
|
||||
}
|
||||
else
|
||||
{
|
||||
img.texture = App.TextureCache["MediaUrl"];
|
||||
}
|
||||
}
|
||||
// App.TextureCache.Add(MediaUrl, img.texture);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// img.texture = App.TextureCache["MediaUrl"];
|
||||
// }
|
||||
//}
|
||||
|
||||
public void setCountry(Texture texture)
|
||||
{
|
||||
|
||||
@ -41,7 +41,7 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
}
|
||||
public void SetHead(string url)
|
||||
{
|
||||
Utils.DisplayImage(StartCoroutine, head, url);
|
||||
Utils.DisplayImage(head, url);
|
||||
}
|
||||
public void SetCountry(Texture texture)
|
||||
{
|
||||
|
||||
@ -111,7 +111,7 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
mapName.text = route.Name;
|
||||
distance.text = route.Distance.ToString("f1")+"KM";
|
||||
country.texture = cyclingController.GetCountryImageByCode(route.CountryCode);
|
||||
Utils.DisplayImage(StartCoroutine, altudeGraph, route.AltitudeGraph);
|
||||
Utils.DisplayImage(altudeGraph, route.AltitudeGraph);
|
||||
//绑定骑行记录结果
|
||||
rideTime.text = Helper.FormatTicks(record.RiderDatas.Count);
|
||||
rideDistance.text = record.RiderDatas.Last()._Distance.ToString("f1")+"KM";
|
||||
|
||||
@ -38,25 +38,25 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
|
||||
public void SetHead(string url)
|
||||
{
|
||||
if (App.TextureCache.ContainsKey(url))
|
||||
{
|
||||
Head.texture = App.TextureCache[url];
|
||||
}
|
||||
else
|
||||
{
|
||||
Utils.DisplayImageAysnc(StartCoroutine, Head, url, ImageCallBack);
|
||||
}
|
||||
Utils.DisplayImage(StartCoroutine,Head,url);
|
||||
//if (App.TextureCache.ContainsKey(url))
|
||||
//{
|
||||
// Head.texture = App.TextureCache[url];
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// Utils.DisplayImage(Head, url, true);
|
||||
//}
|
||||
Utils.DisplayImage(Head,url, true);
|
||||
var rect = ((RectTransform)Head.transform).rect;
|
||||
Material material = Instantiate(Resources.Load<Material>("UI/Material/RoundedCornersTextureMaterial"));
|
||||
material.SetVector(Shader.PropertyToID("_WidthHeightRadius"), new Vector4(rect.width, rect.height, rect.height, 0));
|
||||
Head.material = material;
|
||||
}
|
||||
private void ImageCallBack(string url)
|
||||
{
|
||||
if (!App.TextureCache.ContainsKey(url))
|
||||
App.TextureCache.Add(url, Head.texture);
|
||||
}
|
||||
//private void ImageCallBack(string url)
|
||||
//{
|
||||
// if (!App.TextureCache.ContainsKey(url))
|
||||
// App.TextureCache.Add(url, Head.texture);
|
||||
//}
|
||||
public void SetDistance(double distance)
|
||||
{
|
||||
_distance = distance;
|
||||
|
||||
@ -65,14 +65,14 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
public void SetHeadImage(string url)
|
||||
{
|
||||
Head = transform.Find("Head").GetComponent<RawImage>();
|
||||
if (App.TextureCache.ContainsKey(url))
|
||||
{
|
||||
Head.texture = App.TextureCache[url];
|
||||
}
|
||||
else
|
||||
{
|
||||
Utils.DisplayImageAysnc(StartCoroutine, Head, url, ImageCallBack);
|
||||
}
|
||||
//if (App.TextureCache.ContainsKey(url))
|
||||
//{
|
||||
// Head.texture = App.TextureCache[url];
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
Utils.DisplayImage(Head, url, true);
|
||||
//}
|
||||
|
||||
var rect = ((RectTransform)Head.transform).rect;
|
||||
Material material = Instantiate(Resources.Load<Material>("UI/Material/RoundedCornersTextureMaterial"));
|
||||
|
||||
@ -271,7 +271,7 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
cameraZ = float.Parse(cameraArr[2]);
|
||||
}
|
||||
totalDistance.text = Math.Round(mainController.GetMapData().TotalDistance, 1).ToString() + "KM";//总里程
|
||||
Utils.DisplayImage(StartCoroutine, altitudeGraph, route.RouteInstance.AltitudeGraph);//渲染海拔图
|
||||
Utils.DisplayImage(altitudeGraph, route.RouteInstance.AltitudeGraph);//渲染海拔图
|
||||
|
||||
if (mainController.mapRouteRankingList == null || mainController.mapRouteRankingList.Count == 0)
|
||||
{
|
||||
@ -589,7 +589,7 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
|
||||
if (App.CurrentUser != null)
|
||||
{
|
||||
Utils.DisplayImage(StartCoroutine, head, App.CurrentUser.WxHeadImg);
|
||||
Utils.DisplayImage(head, App.CurrentUser.WxHeadImg);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -44,7 +44,7 @@ public static class App
|
||||
|
||||
public static IPEndPoint UdpAddress { get; private set; } = new IPEndPoint(IPAddress.Parse("192.168.0.97"), 11000);
|
||||
public static IPEndPoint TcpAddress { get; private set; } = new IPEndPoint(IPAddress.Parse("192.168.0.97"), 21001);
|
||||
public static Dictionary<string, Dictionary<dynamic, Texture>> propTextureCache;
|
||||
|
||||
static App()
|
||||
{
|
||||
#if !UNITY_EDITOR
|
||||
@ -52,11 +52,6 @@ public static class App
|
||||
UdpAddress = new IPEndPoint(IPAddress.Parse("47.97.84.8"), 21000);
|
||||
TcpAddress = new IPEndPoint(IPAddress.Parse("47.97.84.8"), 21001);
|
||||
#endif
|
||||
propTextureCache = new Dictionary<string, Dictionary<dynamic, Texture>>()
|
||||
{
|
||||
{"mapImgCache",new Dictionary<dynamic, Texture>() },
|
||||
{"mapHBCache",new Dictionary<dynamic, Texture>() },
|
||||
{"recordCache",new Dictionary<dynamic, Texture>() },
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -434,7 +434,7 @@ public class LoginController : MonoBehaviour
|
||||
var r = await ConfigHelper.userApi.GetHeadImg(s);
|
||||
if (!string.IsNullOrEmpty(r))
|
||||
{
|
||||
Utils.DisplayImage(StartCoroutine, loginContainer.Find("Avatar").GetComponent<RawImage>(), r);
|
||||
Utils.DisplayImage(loginContainer.Find("Avatar").GetComponent<RawImage>(), r);
|
||||
avatarName = s;
|
||||
}
|
||||
else
|
||||
@ -568,13 +568,11 @@ public class LoginController : MonoBehaviour
|
||||
if (data.Value<string>("success") != null && data.Value<string>("success") == "False")
|
||||
{
|
||||
wxLogin2.gameObject.SetActive(true);
|
||||
Utils.DisplayImage(StartCoroutine,
|
||||
wxLogin2.Find("Avatar").GetComponent<RawImage>(),
|
||||
Utils.DisplayImage(wxLogin2.Find("Avatar").GetComponent<RawImage>(),
|
||||
wxInfoJson.Value<string>("headimgurl"));
|
||||
wxLogin2.Find("NickName").GetComponent<Text>().text = wxInfoJson.Value<string>("nickname");
|
||||
wxLogin3.gameObject.SetActive(true);
|
||||
Utils.DisplayImage(StartCoroutine,
|
||||
wxLogin3.Find("Avatar").GetComponent<RawImage>(),
|
||||
Utils.DisplayImage(wxLogin3.Find("Avatar").GetComponent<RawImage>(),
|
||||
wxInfoJson.Value<string>("headimgurl"));
|
||||
wxLogin3.Find("NickName").GetComponent<Text>().text = wxInfoJson.Value<string>("nickname");
|
||||
pageNums = 5;
|
||||
@ -790,8 +788,7 @@ public class LoginController : MonoBehaviour
|
||||
}
|
||||
else
|
||||
{
|
||||
Utils.DisplayImage(StartCoroutine,
|
||||
wxLogin3.Find("Avatar").GetComponent<RawImage>(),
|
||||
Utils.DisplayImage(wxLogin3.Find("Avatar").GetComponent<RawImage>(),
|
||||
data.WxHeadImg);
|
||||
}
|
||||
wxLogin3.Find("Wx").gameObject.SetActive(type == 1);
|
||||
|
||||
@ -117,7 +117,7 @@ public class Tips : MonoBehaviour
|
||||
|
||||
//altitudeGraph
|
||||
|
||||
Utils.DisplayImage(StartCoroutine, altitudeGraph, _model.AltitudeGraph);
|
||||
Utils.DisplayImage(altitudeGraph, _model.AltitudeGraph);
|
||||
//Utils.DisplayImage(StartCoroutine, altitudeGraph, "http://192.168.0.97:5082/Map/AltitudeGraph?id=1215");
|
||||
}
|
||||
|
||||
|
||||
@ -31,7 +31,7 @@ public class QuickLoginUser : MonoBehaviour
|
||||
this.user = user;
|
||||
if (!string.IsNullOrEmpty(user.Avatar))
|
||||
{
|
||||
Utils.DisplayImage(StartCoroutine, transform.Find("Avatar").GetComponent<RawImage>(), user.Avatar);
|
||||
Utils.DisplayImage(transform.Find("Avatar").GetComponent<RawImage>(), user.Avatar);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -115,30 +115,10 @@ public class MapItem : MonoBehaviour, IPointerExitHandler, IPointerEnterHandler,
|
||||
UIManager.Instance.collectDict[myMap.IsFavorite];
|
||||
transform.Find("BtnInfo").GetComponent<Button>().onClick.AddListener(Info);
|
||||
transform.Find("BtnRide").GetComponent<Button>().onClick.AddListener(Ride);
|
||||
if (App.propTextureCache["mapImgCache"].ContainsKey(myMap.Id))
|
||||
{
|
||||
transform.Find("MapTitleImg").GetComponent<RawImage>().texture =
|
||||
App.propTextureCache["mapImgCache"][myMap.Id];
|
||||
}
|
||||
else
|
||||
{
|
||||
Utils.DisplayImage(StartCoroutine, transform.Find("MapTitleImg").GetComponent<RawImage>(), myMap.CoverImage, (t) =>
|
||||
{
|
||||
App.propTextureCache["mapImgCache"].Add(myMap.Id, t);
|
||||
});
|
||||
}
|
||||
if (App.propTextureCache["mapHBCache"].ContainsKey(myMap.Id))
|
||||
{
|
||||
transform.Find("MapHBImg").GetComponent<RawImage>().texture =
|
||||
App.propTextureCache["mapHBCache"][myMap.Id];
|
||||
}
|
||||
else
|
||||
{
|
||||
Utils.DisplayImage(StartCoroutine, transform.Find("MapHBImg").GetComponent<RawImage>(), myMap.AltitudeGraph,(t)=>
|
||||
{
|
||||
App.propTextureCache["mapHBCache"].Add(myMap.Id, t);
|
||||
});
|
||||
}
|
||||
|
||||
Utils.DisplayImage(transform.Find("MapTitleImg").GetComponent<RawImage>(), myMap.CoverImage, true);
|
||||
Utils.DisplayImage(transform.Find("MapHBImg").GetComponent<RawImage>(), myMap.AltitudeGraph, true);
|
||||
|
||||
SetActive4Button(false);
|
||||
}
|
||||
|
||||
|
||||
@ -137,7 +137,7 @@ public class BigMapController : PFUIPanel
|
||||
//headImage.material = material;
|
||||
SetRounded(headImage.transform, rect.height);
|
||||
|
||||
Utils.DisplayImage(StartCoroutine, headImage, App.CurrentUser.WxHeadImg);
|
||||
Utils.DisplayImage(headImage, App.CurrentUser.WxHeadImg);
|
||||
|
||||
UIManager.AddEvent(headImage.gameObject, EventTriggerType.PointerClick, (e) =>
|
||||
{
|
||||
|
||||
@ -187,7 +187,7 @@ public class EditUserController : PFUIPanel
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(currentUser.WxHeadImg))
|
||||
{
|
||||
Utils.DisplayImage(StartCoroutine, mHeadImage, currentUser.WxHeadImg);
|
||||
Utils.DisplayImage(mHeadImage, currentUser.WxHeadImg);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -355,7 +355,7 @@ public class EditUserController : PFUIPanel
|
||||
if (r.result)
|
||||
{
|
||||
var img = JObject.FromObject(r.data).Value<string>("WxHeadImg");
|
||||
Utils.DisplayImage(StartCoroutine, mHeadImage, img);
|
||||
Utils.DisplayImage(mHeadImage, img);
|
||||
var userinfos = UIManager.Instance.userInfos;
|
||||
var i = userinfos.FindIndex(x => x.Id == App.CurrentUser.Id);
|
||||
if (i != -1)
|
||||
|
||||
@ -151,7 +151,7 @@ public class HomeController : PFUIPanel
|
||||
}
|
||||
if (!string.IsNullOrEmpty(App.CurrentUser.WxHeadImg))
|
||||
{
|
||||
Utils.DisplayImage(StartCoroutine, userInfo.Find("Avatar").GetComponent<RawImage>(), App.CurrentUser.WxHeadImg);
|
||||
Utils.DisplayImage(userInfo.Find("Avatar").GetComponent<RawImage>(), App.CurrentUser.WxHeadImg);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -223,7 +223,7 @@ public class MapListController : PFUIPanel
|
||||
headImage.material = material;
|
||||
//if (App.FromLogin)
|
||||
//{
|
||||
Utils.DisplayImage(StartCoroutine, headImage, App.CurrentUser.WxHeadImg);
|
||||
Utils.DisplayImage(headImage, App.CurrentUser.WxHeadImg);
|
||||
//}
|
||||
|
||||
|
||||
|
||||
@ -80,7 +80,7 @@ public class UserInfoController : PFUIPanel
|
||||
var user = App.CurrentUser;
|
||||
if (!string.IsNullOrEmpty(user.WxHeadImg))
|
||||
{
|
||||
Utils.DisplayImage(StartCoroutine, infoPanel.Find("Avatar").GetComponent<RawImage>(), user.WxHeadImg);
|
||||
Utils.DisplayImage(infoPanel.Find("Avatar").GetComponent<RawImage>(), user.WxHeadImg);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -34,17 +34,9 @@ public class RouteItem : MonoBehaviour, IPointerExitHandler, IPointerEnterHandle
|
||||
left = transform.Find("Left");
|
||||
row1 = left.Find("Main").Find("Row1");
|
||||
row2 = left.Find("Main").Find("Row2");
|
||||
if (App.propTextureCache["recordCache"].ContainsKey(result.Id))
|
||||
{
|
||||
transform.Find("CoverImage").GetComponent<RawImage>().texture = App.propTextureCache["recordCache"][result.Id];
|
||||
}
|
||||
else
|
||||
{
|
||||
Utils.DisplayImage(StartCoroutine, transform.Find("CoverImage").GetComponent<RawImage>(), result.RouteImage,(t)=>
|
||||
{
|
||||
App.propTextureCache["recordCache"].Add(result.Id, t);
|
||||
});
|
||||
}
|
||||
|
||||
Utils.DisplayImage(transform.Find("CoverImage").GetComponent<RawImage>(), result.RouteImage, true);
|
||||
|
||||
left.Find("Main").Find("Name").GetComponent<Text>().text = result.RouteName;
|
||||
left.Find("Main").Find("Time").GetComponent<Text>().text = result.CreateTime.ToString("yyyy-MM-dd HH:mm:ss");
|
||||
row1.Find("Time").GetComponent<Text>().text = $"<color={titleColor}>Riding time:</color>{result.TrainingTime}";
|
||||
|
||||
@ -16,6 +16,7 @@ using System;
|
||||
|
||||
public class UIManager : MonoBehaviour
|
||||
{
|
||||
[SerializeField]
|
||||
private PFUIPanel mMainPanel;
|
||||
|
||||
public PFUIPanel MainPanel
|
||||
@ -404,7 +405,7 @@ public class UIManager : MonoBehaviour
|
||||
public static void ShowMapListPanel()
|
||||
{
|
||||
Debug.Log("清空");
|
||||
App.propTextureCache["recordCache"].Clear();
|
||||
//App.propTextureCache["recordCache"].Clear();
|
||||
UIManager.Show(UIManager.Instance.MapListPanel, UIManager.Instance.MainPanel);
|
||||
}
|
||||
public static void ShowMapDetailPanel(int id)
|
||||
|
||||
@ -205,16 +205,44 @@ namespace Assets.Scripts
|
||||
/*删除父亲节点下的所有孩子*/
|
||||
|
||||
/*显示网络图片*/
|
||||
private static Dictionary<string, Texture> propTextureCache = new Dictionary<string, Texture>();
|
||||
public delegate Coroutine StartCoroutine(IEnumerator routine);
|
||||
public static void DisplayImage(StartCoroutine startCoroutine,RawImage img, string url, Action<Texture> action=null)
|
||||
public static void DisplayImage(RawImage img, string url, bool cache = false)
|
||||
{
|
||||
startCoroutine(DownloadImage(img, url,action));
|
||||
//可以考虑缓存到硬盘里
|
||||
//Texture2D tex = null;
|
||||
//byte[] fileData;
|
||||
//
|
||||
//if (File.Exists(filePath))
|
||||
//{
|
||||
// fileData = File.ReadAllBytes(filePath);
|
||||
// tex = new Texture2D(2, 2);
|
||||
// tex.LoadImage(fileData); //..this will auto-resize the texture dimensions.
|
||||
//}
|
||||
if (cache)
|
||||
{
|
||||
if (propTextureCache.ContainsKey(url))
|
||||
{
|
||||
img.texture = propTextureCache[url];
|
||||
return;
|
||||
}
|
||||
}
|
||||
UIManager.Instance.StartCoroutine(DownloadImage(img, url,(texture)=> {
|
||||
if (cache)
|
||||
{
|
||||
propTextureCache.Add(url, texture);
|
||||
}
|
||||
}));
|
||||
|
||||
}
|
||||
|
||||
public static void DisplayImageAysnc(StartCoroutine startCoroutine, RawImage img, string url,Action<string> action)
|
||||
{
|
||||
startCoroutine(DownloadImageCallBack(img, url, action));
|
||||
}
|
||||
|
||||
|
||||
|
||||
static IEnumerator DownloadImage(RawImage img,string MediaUrl, Action<Texture> action = null)
|
||||
{
|
||||
UnityWebRequest request = UnityWebRequestTexture.GetTexture(MediaUrl);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user