2021-12-14 18:10:58 +08:00
|
|
|
|
using Assets.Scripts;
|
|
|
|
|
|
using Assets.Scripts.Apis.Models;
|
|
|
|
|
|
using System;
|
|
|
|
|
|
using System.Collections;
|
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
using UnityEngine.UI;
|
|
|
|
|
|
|
|
|
|
|
|
public class NewRouteItemController : MonoBehaviour
|
|
|
|
|
|
{
|
|
|
|
|
|
// Start is called before the first frame update
|
|
|
|
|
|
void Start()
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Update is called once per frame
|
|
|
|
|
|
void Update()
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
}
|
2021-12-28 11:25:09 +08:00
|
|
|
|
public MapRouteAreaItem Area { get; private set; }
|
2021-12-14 18:10:58 +08:00
|
|
|
|
public void Initial(MapRouteAreaItem area, Dictionary<string, Texture> caches = null)
|
|
|
|
|
|
{
|
2021-12-28 11:25:09 +08:00
|
|
|
|
this.Area = area;
|
2021-12-14 18:10:58 +08:00
|
|
|
|
transform.Find("Panel/Text").GetComponent<Text>().text = area.Name;
|
2021-12-15 11:08:18 +08:00
|
|
|
|
GetComponent<Button>().onClick.RemoveAllListeners();
|
|
|
|
|
|
GetComponent<Button>().onClick.AddListener(() =>
|
2021-12-14 18:10:58 +08:00
|
|
|
|
{
|
2022-05-25 18:40:47 +08:00
|
|
|
|
UIManager.ShowNewRouteDetailPanel(area.Id,area.CoverImage);
|
2021-12-14 18:10:58 +08:00
|
|
|
|
});
|
2022-05-25 18:40:47 +08:00
|
|
|
|
Utils.DisplayImage(GetComponent<RawImage>(), area.CoverImage);
|
|
|
|
|
|
//StartCoroutine(displayImage(area, caches));
|
2021-12-17 11:10:17 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
IEnumerator displayImage(MapRouteAreaItem area, Dictionary<string, Texture> caches = null)
|
|
|
|
|
|
{
|
|
|
|
|
|
yield return null;
|
|
|
|
|
|
if (area.CoverImage != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
Utils.DisplayImageTempDict(GetComponent<RawImage>(), area.CoverImage, caches);
|
|
|
|
|
|
}
|
2021-12-14 18:10:58 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|