using System.Collections;
using System.Collections.Generic;
using TMPro;
using Unity.VisualScripting;
using UnityEngine;
using static Unity.Burst.Intrinsics.X86.Avx;

public class testGridItem : MonoBehaviour
{
    // Start is called before the first frame update
    [SerializeField]
    private bool showFlg = true;
    public bool ShowFlg {
        get{return showFlg;}
        set { 
            showFlg = value;
            Debug.Log("ÉèÖÃÏÔÊ¾Òþ²Ø "+showFlg.ToSafeString());
            this.gameObject.transform.Find("flg").gameObject.SetActive(showFlg);
        }
    }
    [SerializeField]
    private string title = "";
    public string Title
    {
        get { return title; }
        set
        {
            title = value;
            var tmp = this.gameObject.transform.Find("title").gameObject;
            TextMeshProUGUI tmpug = (TextMeshProUGUI)tmp.GetComponent<TextMeshProUGUI>();
            tmpug.text = title;
        }
    }
    void Start()
    {
        UnityEngine.UI.Button button = this.transform.Find("btnArea").GetComponent<UnityEngine.UI.Button>();
        var btn = new UnityEngine.UI.Button.ButtonClickedEvent();
        btn.AddListener(() => {
            this.onClickItem();
        });
        button.onClick = btn;
    }

    // Update is called once per frame
    void Update()
    {        
    }
    void onClickItem()
    {
        Debug.Log("ffffffffff"+title);
    }
    public void setData(netLableImageItem data)
    {
        string url = "http://127.0.0.1:6921/tempImgs/" + data.id.ToSafeString() + ".png";
        utilsTools.httpDOWNIMG(this,url, "Resources/" + data.id.ToSafeString() + ".png", (string id,string url,bool isOk,System.Object imgdata) =>
        {
            Debug.Log("down img check path :" + data.id.ToSafeString() + ".png");
            return 0;
        });
    }
}
