80 lines
1.7 KiB
C#
80 lines
1.7 KiB
C#
using Newtonsoft.Json.Linq;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using TMPro;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
using static InterfaceManager;
|
|
|
|
/// <summary>
|
|
/// 案例Item
|
|
/// </summary>
|
|
public class CaseItem : MonoBehaviour
|
|
{
|
|
//public SelectPanel selectPanel;
|
|
//public GameObject g1;
|
|
|
|
/// <summary>
|
|
/// 案例图片
|
|
/// </summary>
|
|
public Image image;
|
|
/// <summary>
|
|
/// 案例选择按钮
|
|
/// </summary>
|
|
public Button case_item_button;
|
|
/// <summary>
|
|
/// 案例名称
|
|
/// </summary>
|
|
public TextMeshProUGUI case_name_text;
|
|
|
|
|
|
//public class CaseItemData
|
|
//{
|
|
// public string case_id;
|
|
// public string case_name;
|
|
// public string image_url;
|
|
|
|
//}
|
|
|
|
/// <summary>
|
|
/// 案例数据
|
|
/// </summary>
|
|
public CaseData case_item_data { get; set; }
|
|
|
|
|
|
private void Start()
|
|
{
|
|
case_item_button.onClick.AddListener(() =>
|
|
{
|
|
//selectPanel.gameObject.SetActive(true);
|
|
//g1.SetActive(false);
|
|
//selectPanel.init();
|
|
//selectPanel.g1 = g1;
|
|
|
|
//加载案例信息
|
|
CaseCenterPanel.instance.detailPanel.Init(case_item_data);
|
|
});
|
|
}
|
|
|
|
/// <summary>
|
|
/// 初始化
|
|
/// </summary>
|
|
/// <param name="_case_item_data"></param>
|
|
public void Init(CaseData _case_item_data = null)
|
|
{
|
|
if (_case_item_data != null)
|
|
case_item_data = _case_item_data;
|
|
|
|
if (case_item_data != null)
|
|
{
|
|
//名字
|
|
case_name_text.text = case_item_data.taskName;
|
|
//图片
|
|
//StartCoroutine(GetSprite(case_item_data.url, (_sprite) =>
|
|
//{
|
|
// image.sprite = _sprite;
|
|
//}));
|
|
}
|
|
}
|
|
}
|