2021-04-09 15:57:50 +08:00
|
|
|
|
using Assets.Scripts;
|
2021-03-25 16:55:36 +08:00
|
|
|
|
using Assets.Scripts.Apis.Models;
|
|
|
|
|
|
using System.Collections;
|
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
using UnityEngine.SceneManagement;
|
|
|
|
|
|
using UnityEngine.UI;
|
|
|
|
|
|
|
2021-04-09 09:44:06 +08:00
|
|
|
|
public class MapItem : MonoBehaviour
|
2021-03-25 16:55:36 +08:00
|
|
|
|
{
|
|
|
|
|
|
// Start is called before the first frame update
|
2021-04-01 11:01:05 +08:00
|
|
|
|
//[SerializeField] Text text;
|
|
|
|
|
|
//[SerializeField] GameObject panel;
|
|
|
|
|
|
//[SerializeField] RawImage rawImage;
|
2021-03-25 16:55:36 +08:00
|
|
|
|
void Start()
|
|
|
|
|
|
{
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Update is called once per frame
|
|
|
|
|
|
void Update()
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
public void Initial(MapRoute myMap)
|
|
|
|
|
|
{
|
|
|
|
|
|
gameObject.GetComponent<Button>().onClick.AddListener(()=>
|
|
|
|
|
|
{
|
2021-04-01 11:01:05 +08:00
|
|
|
|
UIManager.ShowMapDetailPanel(myMap.Id);
|
2021-03-30 14:14:24 +08:00
|
|
|
|
//SceneManager.LoadScene("4-Demo", LoadSceneMode.Additive);
|
2021-03-25 16:55:36 +08:00
|
|
|
|
});
|
2021-04-01 11:01:05 +08:00
|
|
|
|
transform.Find("Name").GetComponent<Text>().text = myMap.Name;
|
|
|
|
|
|
Utils.DisplayImage(StartCoroutine, transform.Find("MapTitleImg").GetComponent<RawImage>(), myMap.CoverImage);
|
2021-04-09 15:57:50 +08:00
|
|
|
|
transform.Find("CollectImg").gameObject.SetActive(myMap.IsFavorite);
|
2021-04-15 15:58:37 +08:00
|
|
|
|
transform.Find("Hot").gameObject.SetActive(myMap.IsFire);
|
2021-04-09 15:57:50 +08:00
|
|
|
|
var props = transform.Find("Props");
|
2021-04-01 11:01:05 +08:00
|
|
|
|
props.Find("DistanceText").GetComponent<Text>().text = $"{myMap.Distance.ToString("#0.00")}KM";
|
|
|
|
|
|
props.Find("EleText").GetComponent<Text>().text = $"{(myMap.TotalClimb ?? 0.0).ToString("#0.00")}M";
|
|
|
|
|
|
props.Find("SlopeText").GetComponent<Text>().text = $"{myMap.AverageGrade.ToString("#0.00")}%";
|
2021-04-09 15:57:50 +08:00
|
|
|
|
props.Find("rideText").GetComponent<Text>().text = myMap.TheHeat.ToString();
|
|
|
|
|
|
var tabContainer = transform.Find("TabContainer");
|
|
|
|
|
|
var diff = tabContainer.Find("Diff");
|
|
|
|
|
|
diff.Find("Text").GetComponent<Text>().text = myMap.Hard;
|
|
|
|
|
|
tabContainer.Find("3d").gameObject.SetActive(myMap.Enable3D);
|
2021-04-15 15:58:37 +08:00
|
|
|
|
tabContainer.Find("Country").GetComponent<RawImage>().texture = UIManager.Instance.loginRegOptions.GetCountryImage(myMap.CountryCode);
|
2021-03-25 16:55:36 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|