30 lines
639 B
C#
30 lines
639 B
C#
using System;
|
|
using TMPro;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
namespace VRShopping.UI
|
|
{
|
|
public class DialogChoiceRow : MonoBehaviour
|
|
{
|
|
[SerializeField] private TMP_Text _text;
|
|
[SerializeField] private Button _button;
|
|
|
|
public event Action<int> OnClicked;
|
|
|
|
private int _index;
|
|
|
|
private void Awake()
|
|
{
|
|
if (_button != null)
|
|
_button.onClick.AddListener(() => OnClicked?.Invoke(_index));
|
|
}
|
|
|
|
public void Bind(int index, string text)
|
|
{
|
|
_index = index;
|
|
if (_text != null) _text.text = text;
|
|
}
|
|
}
|
|
}
|