34 lines
820 B
C#
34 lines
820 B
C#
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
namespace Ichni.UI
|
|
{
|
|
public class TextButton : SettingsUIElementBase
|
|
{
|
|
public Button button;
|
|
private bool _isClickListenerRegistered;
|
|
|
|
/// <summary>
|
|
/// 初始化按钮逻辑。标题、说明及按钮文字均由 Prefab 上的 LocalizedTMPText 配置,
|
|
/// 不再把字符串当作 I2 的 Term 传入。
|
|
/// </summary>
|
|
public void SetUp()
|
|
{
|
|
base.SetUp();
|
|
|
|
if (_isClickListenerRegistered)
|
|
{
|
|
return;
|
|
}
|
|
|
|
button.onClick.AddListener(InvokeUpdateValueAction);
|
|
_isClickListenerRegistered = true;
|
|
}
|
|
|
|
private void InvokeUpdateValueAction()
|
|
{
|
|
updateValueAction?.Invoke();
|
|
}
|
|
}
|
|
}
|