图片模糊功能bug修改

This commit is contained in:
CaiYanPeng 2021-12-29 17:17:15 +08:00
parent 95d845ac0f
commit 0e16fec75a
2 changed files with 16 additions and 0 deletions

View File

@ -13,6 +13,7 @@ public class NewRouteDetailController : PFUIPanel
{
// Start is called before the first frame update
Dictionary<string, Texture> caches;
Dictionary<string, byte[]> cacheByte;
GameObject map;
ScrollRect scroll;
Dictionary<bool, Sprite> FavDict;
@ -26,6 +27,7 @@ public class NewRouteDetailController : PFUIPanel
{true,Resources.Load<Sprite>("Images/NewDesign/icon_heji_like") },
};
caches = new Dictionary<string, Texture>();
cacheByte = new Dictionary<string, byte[]>();
scroll = transform.Find("Container/Right/Scroll View").GetComponent<ScrollRect>();
UIManager.AddEvent(scroll.gameObject, UnityEngine.EventSystems.EventTriggerType.EndDrag, OnEndDrag);
#if UNITY_ANDROID || UNITY_IOS
@ -38,6 +40,7 @@ public class NewRouteDetailController : PFUIPanel
protected override void OnDestroy()
{
caches = null;
cacheByte = null;
Resources.UnloadUnusedAssets();
GC.Collect();
Debug.Log("list empty");
@ -150,6 +153,15 @@ public class NewRouteDetailController : PFUIPanel
Utils.DisplayImageTempDict(left.Find("Icon").GetComponent<RawImage>(), area.CoverImage, caches
, b =>
{
if (b != null)
{
cacheByte.Add(area.CoverImage, b);
}
else if(cacheByte.ContainsKey(area.CoverImage))
{
b = cacheByte[area.CoverImage];
}
#if UNITY_EDITOR
var _t = new Texture2D(4, 4, TextureFormat.DXT5, false);
#else

View File

@ -404,6 +404,10 @@ namespace Assets.Scripts
{
img.GetComponent<Image>().ShowImageWithTexture(texture);
}
if (callback != null)
{
callback.Invoke(null);
}
return;
}
}