更新拉取图片的缓存代码

This commit is contained in:
suntao committed 2021-05-08 14:38:23 +08:00
1 parent 696fd256a8
commit 6645310601
22 files changed
+149 -119

No files matched your search

+4 -24
View File
@@ -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);
}