34 lines
816 B
C#
34 lines
816 B
C#
using UnityEngine;
|
|
using TMPro;
|
|
using UnityEngine.UI;
|
|
|
|
public class ClueDisplay : MonoBehaviour
|
|
{
|
|
public TMP_Text categoryText;
|
|
public TMP_Text nameText;
|
|
// public Image clueImageUI; // 如果需要显示图片的话
|
|
|
|
private Clue clueData;
|
|
|
|
// 负责初始化并显示线索
|
|
public void Setup(Clue clue)
|
|
{
|
|
clueData = clue;
|
|
UpdateDisplay();
|
|
}
|
|
|
|
// 更新 UI 显示
|
|
private void UpdateDisplay()
|
|
{
|
|
if (categoryText != null) categoryText.text = "分类:" + clueData.Category;
|
|
if (nameText != null) nameText.text = "名称:" + clueData.ClueName;
|
|
// if (clueImageUI != null) clueImageUI.sprite = ...; // 如果有图片
|
|
}
|
|
|
|
// 如果需要获取 Clue 数据
|
|
public Clue GetClueData()
|
|
{
|
|
return clueData;
|
|
}
|
|
}
|