37 lines
1.1 KiB
C#
37 lines
1.1 KiB
C#
using TMPro;
|
|
using UnityEngine;
|
|
using UnityEngine.Events;
|
|
using UnityEngine.UI;
|
|
|
|
namespace Ichni.UI
|
|
{
|
|
public abstract class SettingsUIElementBase : MonoBehaviour
|
|
{
|
|
public Image titleBackground;
|
|
public TMP_Text titleText;
|
|
public TMP_Text subTitleText;
|
|
|
|
public UnityAction updateValueAction;
|
|
|
|
/// <summary>
|
|
/// 初始化设置控件的标题区域。
|
|
/// <para>
|
|
/// 标题与说明不再由此基础类写入 I2 Key。请在对应 <see cref="TMP_Text"/> 上配置
|
|
/// <c>LocalizedTMPText</c>,使静态文案与控件逻辑完全解耦。
|
|
/// </para>
|
|
/// <paramref name="preservePrefabTitle"/> 为 true 时保留 Prefab 的标题区域;这是设置页面的默认行为。
|
|
/// </summary>
|
|
public virtual void SetUp(bool preservePrefabTitle = true)
|
|
{
|
|
if (preservePrefabTitle)
|
|
{
|
|
return;
|
|
}
|
|
|
|
titleBackground.gameObject.SetActive(false);
|
|
titleText.gameObject.SetActive(false);
|
|
subTitleText.gameObject.SetActive(false);
|
|
}
|
|
}
|
|
}
|