using Assets.Cyp.Common;
using Assets.Scripts.Apis.Models;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.UI;

public class MyMap 
{
    public string name { get; set; }
    public int rank { get; set; }
    public string image { get; set; }
}
public class MapScript : MonoBehaviour
{
    // Start is called before the first frame update
    [SerializeField] Text text;
    [SerializeField] GameObject panel;
    [SerializeField] RawImage rawImage;
    void Start()
    {
    }

    // Update is called once per frame
    void Update()
    {
        
    }
    public void Initial(MapRoute myMap)
    {
        gameObject.GetComponent<Button>().onClick.AddListener(()=> 
        {
            SceneManager.LoadScene("4-Demo", LoadSceneMode.Additive);
        });
        text.text = myMap.Name;
        Utils.DisplayImage(StartCoroutine, rawImage, myMap.CoverImage);
        int i = 0;
        foreach (RectTransform transform in panel.transform) 
        {
            //if (i < myMap.rank && i < 5)
            if (i < 3 && i<5) 
            {
                transform.GetComponent<Image>().color = new Color(255, 255, 0);
                i++;
            }
        }
    }
}
