更新拉取图片的缓存代码

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

+1 -1
View File
@@ -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
{
+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);
}
@@ -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}";