两个列表进骑行释放内存

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

@@ -40,6 +40,10 @@ public class RaceItemScript : MonoBehaviour, IPointerExitHandler, IPointerEnterH
}
public void Initial(MapCompetition mapCompetition,Transform parent,string from = "list")
{
if (parent != null)
{
this.parent = parent;
}
transform.GetComponent<Button>().onClick.RemoveAllListeners();
#if !(UNITY_ANDROID || UNITY_IOS)
transform.GetComponent<Button>().onClick.AddListener(() =>
@@ -48,7 +52,7 @@ public class RaceItemScript : MonoBehaviour, IPointerExitHandler, IPointerEnterH
App.CompetionId = mapCompetition.Id;
SceneManager.LoadScene("Ride");
});
Utils.DisplayImage(transform.GetComponent<RawImage>(), mapCompetition.RouteCover, true);
Utils.DisplayImageTempDict(transform.GetComponent<RawImage>(), mapCompetition.RouteCover, this.parent.GetComponent<RaceScript>().caches);
#else
if (string.IsNullOrEmpty(_from))
{
@@ -56,14 +60,14 @@ public class RaceItemScript : MonoBehaviour, IPointerExitHandler, IPointerEnterH
}
if (_from == "list")
{
Utils.DisplayImage(transform.GetComponent<RawImage>(), mapCompetition.RouteCover, true);
Utils.DisplayImageTempDict(transform.GetComponent<RawImage>(), mapCompetition.RouteCover, this.parent.GetComponent<RaceScript>().caches);
transform.GetComponent<Button>().onClick.AddListener(() =>
{
UIManager.ShowRaceDetailModal(transform,mapCompetition);
});
}
#endif
Utils.DisplayImage(transform.Find("AltitudeCurve").GetComponent<RawImage>(), mapCompetition.AltitudeGraph, true);
Utils.DisplayImageTempDict(transform.Find("AltitudeCurve").GetComponent<RawImage>(), mapCompetition.AltitudeGraph, this.parent.GetComponent<RaceScript>().caches);
transform.Find("InfoContainer/Text").GetComponent<Text>().SetTextWithEllipsis(mapCompetition.Title);
transform.Find("GetReadyContainer").gameObject.SetActive(mapCompetition.Status != 4);
transform.Find("GetReadyContainer-2").gameObject.SetActive(mapCompetition.Status == 1);
@@ -91,10 +95,7 @@ public class RaceItemScript : MonoBehaviour, IPointerExitHandler, IPointerEnterH
SetButtonGroup(mapCompetition);
}
#endif
if (parent != null)
{
this.parent = parent;
}
this.mapCompetition = mapCompetition;
}