44 lines
1.1 KiB
C#
44 lines
1.1 KiB
C#
using TMPro;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
namespace AibisDream
|
|
{
|
|
public class BubbleOption : MonoBehaviour
|
|
{
|
|
public int optionIdx;
|
|
private TMP_Text _text;
|
|
private DialogOption _option;
|
|
private Button _button;
|
|
|
|
public void Awake()
|
|
{
|
|
_text = GetComponentInChildren<TMP_Text>();
|
|
_button = GetComponent<Button>();
|
|
}
|
|
|
|
public void LoadData(BubbleOptionSlotData data)
|
|
{
|
|
transform.position = data.slotPosition;
|
|
}
|
|
|
|
public void ShowOption(DialogOption dialogOption)
|
|
{
|
|
gameObject.SetActive(true);
|
|
_button.onClick.RemoveAllListeners();
|
|
_text.text = "";
|
|
// 清理旧数据
|
|
gameObject.SetActive(true);
|
|
_text.text = dialogOption.Line;
|
|
_button.onClick.AddListener(() =>
|
|
{
|
|
dialogOption.Select();
|
|
});
|
|
}
|
|
|
|
public void Hide()
|
|
{
|
|
gameObject.SetActive(false);
|
|
}
|
|
}
|
|
} |