59 lines
1.4 KiB
C#
59 lines
1.4 KiB
C#
using Assets.Scripts;
|
|
using Assets.Scripts.Apis.Models;
|
|
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.SceneManagement;
|
|
using UnityEngine.UI;
|
|
|
|
public class MapDetailController : PFUIPanel
|
|
{
|
|
// Start is called before the first frame update
|
|
[HideInInspector] public int id = 0;
|
|
[HideInInspector] public MapRoute map;
|
|
void Start()
|
|
{
|
|
if (id != 0)
|
|
{
|
|
var r = ConfigHelper.mapApi.GetById(id);
|
|
if (r.result)
|
|
{
|
|
map = r.data;
|
|
}
|
|
else
|
|
{
|
|
Utils.showToast(gameObject, r.errMsg);
|
|
}
|
|
}
|
|
if (transform.Find("BtnGoRide") != null)
|
|
{
|
|
transform.Find("BtnGoRide").GetComponent<Button>().onClick.AddListener(GoRide);
|
|
}
|
|
if (transform.Find("Name") != null)
|
|
{
|
|
transform.Find("Name").GetComponent<Text>().text = map.Name;
|
|
}
|
|
if (transform.Find("BtnReturn") != null)
|
|
{
|
|
transform.Find("BtnReturn").GetComponent<Button>().onClick.AddListener(() =>
|
|
{
|
|
UIManager.ShowPrePanel();
|
|
});
|
|
}
|
|
}
|
|
|
|
private void GoRide()
|
|
{
|
|
//Utils.showToast(gameObject, "去骑行", 1);
|
|
App.RouteIdParam = id;
|
|
SceneManager.LoadScene("Ride");
|
|
}
|
|
|
|
// Update is called once per frame
|
|
void Update()
|
|
{
|
|
|
|
}
|
|
}
|