两个列表进骑行释放内存

This commit is contained in:
Caiyanpeng committed 2021-11-16 18:41:18 +08:00
1 parent 3295314b7e
commit 6a4390f1b9
7 files changed
+88 -32

No files matched your search

+14 -9
View File
@@ -43,8 +43,13 @@ public class MapItem : MonoBehaviour, IPointerExitHandler, IPointerEnterHandler,
}
float? localY = null;
MapRoute map;
public void Initial(MapRoute myMap)
Dictionary<string, Texture> caches;
public void Initial(MapRoute myMap, Dictionary<string, Texture> caches)
{
if (caches != null)
{
this.caches = caches;
}
map = myMap;
//localY = transform.GetComponent<RectTransform>().rect.height;
//Debug.Log(localY);
@@ -122,8 +127,8 @@ public class MapItem : MonoBehaviour, IPointerExitHandler, IPointerEnterHandler,
transform.Find("BtnInfo").GetComponent<Button>().onClick.AddListener(Info);
transform.Find("BtnRide").GetComponent<Button>().onClick.AddListener(Ride);
Utils.DisplayImage(transform.Find("MapTitleImg").GetComponent<RawImage>(), myMap.CoverImage, true);
Utils.DisplayImage(transform.Find("MapHBImg").GetComponent<RawImage>(), myMap.AltitudeGraph, true);
Utils.DisplayImageTempDict(transform.Find("MapTitleImg").GetComponent<RawImage>(), myMap.CoverImage, this.caches);
Utils.DisplayImageTempDict(transform.Find("MapHBImg").GetComponent<RawImage>(), myMap.AltitudeGraph, this.caches);
SetActive4Button(false);
}
@@ -140,11 +145,11 @@ public class MapItem : MonoBehaviour, IPointerExitHandler, IPointerEnterHandler,
App.MainSceneParam["Name"] = "MapListPanel";
}
SceneManager.LoadScene("Ride");
foreach (var item in Utils.propTextureCache)
{
DestroyImmediate(item.Value);
}
Utils.propTextureCache.Clear();
//foreach (var item in Utils.propTextureCache)
//{
// DestroyImmediate(item.Value);
//}
//Utils.propTextureCache.Clear();
}
private void Info()
@@ -262,7 +267,7 @@ public class MapItem : MonoBehaviour, IPointerExitHandler, IPointerEnterHandler,
AltitudeGraph = model.AltitudeGraph,
Distance = model.Distance,
IsFavorite = model.IsFavorite,
});
},null);
}
public void Move(Vector3 position)