45 lines
1.3 KiB
C#
45 lines
1.3 KiB
C#
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()
|
|
{
|
|
|
|
}
|
|
public MapRouteAreaItem Area { get; private set; }
|
|
public void Initial(MapRouteAreaItem area, Dictionary<string, Texture> caches = null)
|
|
{
|
|
this.Area = area;
|
|
transform.Find("Panel/Text").GetComponent<Text>().text = area.Name;
|
|
GetComponent<Button>().onClick.RemoveAllListeners();
|
|
GetComponent<Button>().onClick.AddListener(() =>
|
|
{
|
|
UIManager.ShowNewRouteDetailPanel(area.Id,area.CoverImage);
|
|
});
|
|
Utils.DisplayImage(GetComponent<RawImage>(), area.CoverImage);
|
|
//StartCoroutine(displayImage(area, caches));
|
|
}
|
|
|
|
IEnumerator displayImage(MapRouteAreaItem area, Dictionary<string, Texture> caches = null)
|
|
{
|
|
yield return null;
|
|
if (area.CoverImage != null)
|
|
{
|
|
Utils.DisplayImageTempDict(GetComponent<RawImage>(), area.CoverImage, caches);
|
|
}
|
|
}
|
|
}
|