更新拉取图片的缓存代码
This commit is contained in:
1 parent
696fd256a8
commit
6645310601
22 files changed
+149
-119
No files matched your search
@@ -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;
|
||||
|
||||
Reference in new issue
Block a user