using Assets.Scripts.Apis.Models; using System; using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.SceneManagement; using UnityEngine.UI; public class StartRideModal : PFUIPanel { private Dictionary caches; MapRoute map; // Start is called before the first frame update private void Awake() { caches = new Dictionary(); UIManager.AddEvent(transform.Find("Main/BtnClose").gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, b => { Close(); }); UIManager.AddEvent(transform.Find("Main/Right/BtnClose").gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, b => { Close(); }); UIManager.AddEvent(transform.Find("Main/Right/BtnRide").gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, b => { if (map != null) { App.RouteIdParam = map.Id; SceneManager.LoadScene("Ride"); } }); } protected override void OnDestroy() { caches = null; Resources.UnloadUnusedAssets(); GC.Collect(); Debug.Log("list empty"); } public void Initial(MapRoute map) { this.map = map; transform.Find("Main/MapItem-Mobile").GetComponent().Initial(map,caches); transform.Find("Main/Right/S2").GetComponent().text = App.GetLocalLanguage() == "zh" ? $"是否要加入{map.Name}骑行?" : $"Join {map.Name}?"; } }