From 0e16fec75a028c8f1d0211dca41a2b3d71aaf6a4 Mon Sep 17 00:00:00 2001 From: CaiYanPeng Date: Wed, 29 Dec 2021 17:17:15 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9B=BE=E7=89=87=E6=A8=A1=E7=B3=8A=E5=8A=9F?= =?UTF-8?q?=E8=83=BDbug=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../UI/Prefab/Panel/NewRouteDetailController.cs | 12 ++++++++++++ Assets/Scripts/Utils/Utils.cs | 4 ++++ 2 files changed, 16 insertions(+) diff --git a/Assets/Scripts/UI/Prefab/Panel/NewRouteDetailController.cs b/Assets/Scripts/UI/Prefab/Panel/NewRouteDetailController.cs index 25e33874..0c08a6c5 100644 --- a/Assets/Scripts/UI/Prefab/Panel/NewRouteDetailController.cs +++ b/Assets/Scripts/UI/Prefab/Panel/NewRouteDetailController.cs @@ -13,6 +13,7 @@ public class NewRouteDetailController : PFUIPanel { // Start is called before the first frame update Dictionary caches; + Dictionary cacheByte; GameObject map; ScrollRect scroll; Dictionary FavDict; @@ -26,6 +27,7 @@ public class NewRouteDetailController : PFUIPanel {true,Resources.Load("Images/NewDesign/icon_heji_like") }, }; caches = new Dictionary(); + cacheByte = new Dictionary(); scroll = transform.Find("Container/Right/Scroll View").GetComponent(); 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(), 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 diff --git a/Assets/Scripts/Utils/Utils.cs b/Assets/Scripts/Utils/Utils.cs index ef372826..ae36ea94 100644 --- a/Assets/Scripts/Utils/Utils.cs +++ b/Assets/Scripts/Utils/Utils.cs @@ -404,6 +404,10 @@ namespace Assets.Scripts { img.GetComponent().ShowImageWithTexture(texture); } + if (callback != null) + { + callback.Invoke(null); + } return; } }