加入合集后的跳转问题

This commit is contained in:
Caiyanpeng committed 2021-12-15 11:08:25 +08:00
1 parent ec4a28cd2a
commit 6ed3895fcd
13 files changed
+292 -534

No files matched your search

+15 -18
View File
@@ -44,12 +44,14 @@ public class MapItem : MonoBehaviour, IPointerExitHandler, IPointerEnterHandler,
float? localY = null;
MapRoute map;
Dictionary<string, Texture> caches;
public void Initial(MapRoute myMap, Dictionary<string, Texture> caches)
private MapRouteAreaItem area = null;
public void Initial(MapRoute myMap, Dictionary<string, Texture> caches, MapRouteAreaItem area = null)
{
if (caches != null)
{
this.caches = caches;
}
this.area = area;
map = myMap;
//localY = transform.GetComponent<RectTransform>().rect.height;
//Debug.Log(localY);
@@ -87,20 +89,7 @@ public class MapItem : MonoBehaviour, IPointerExitHandler, IPointerEnterHandler,
// SceneManager.LoadScene("Ride");
//});
transform.GetComponent<Button>().onClick.RemoveAllListeners();
transform.GetComponent<Button>().onClick.AddListener(() =>
{
//UIManager.ShowMapDetailPanel(myMap.Id);
App.RouteIdParam = myMap.Id;
if (!App.MainSceneParam.ContainsKey("Name"))
{
App.MainSceneParam.Add("Name", "MapListPanel");
}
else
{
App.MainSceneParam["Name"] = "MapListPanel";
}
SceneManager.LoadScene("Ride");
});
transform.GetComponent<Button>().onClick.AddListener(Ride);
transform.Find("Name").GetComponent<Text>().text = myMap.Name;
transform.Find("IdContainer/Text").GetComponent<Text>().text = $"#{myMap.Id}";
@@ -136,13 +125,21 @@ public class MapItem : MonoBehaviour, IPointerExitHandler, IPointerEnterHandler,
private void Ride()
{
App.RouteIdParam = map.Id;
if (!App.MainSceneParam.ContainsKey("Name"))
App.currentArea = area;
if (area != null)
{
App.MainSceneParam.Add("Name", "MapListPanel");
App.MainSceneParam["Name"] = "NewRouteDetail";
}
else
{
App.MainSceneParam["Name"] = "MapListPanel";
if (!App.MainSceneParam.ContainsKey("Name"))
{
App.MainSceneParam.Add("Name", "MapListPanel");
}
else
{
App.MainSceneParam["Name"] = "MapListPanel";
}
}
SceneManager.LoadScene("Ride");
//foreach (var item in Utils.propTextureCache)