2025-08-11 14:04:06 -04:00
|
|
|
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;
|
|
|
|
|
|
2026-07-19 16:44:58 -04:00
|
|
|
/// <summary>
|
|
|
|
|
/// 初始化设置控件的标题区域。
|
2026-07-25 13:27:53 -04:00
|
|
|
/// <para>
|
|
|
|
|
/// 标题与说明不再由此基础类写入 I2 Key。请在对应 <see cref="TMP_Text"/> 上配置
|
|
|
|
|
/// <c>LocalizedTMPText</c>,使静态文案与控件逻辑完全解耦。
|
|
|
|
|
/// </para>
|
|
|
|
|
/// <paramref name="preservePrefabTitle"/> 为 true 时保留 Prefab 的标题区域;这是设置页面的默认行为。
|
2026-07-19 16:44:58 -04:00
|
|
|
/// </summary>
|
2026-07-25 13:27:53 -04:00
|
|
|
public virtual void SetUp(bool preservePrefabTitle = true)
|
2025-08-11 14:04:06 -04:00
|
|
|
{
|
2026-07-19 16:44:58 -04:00
|
|
|
if (preservePrefabTitle)
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2026-07-25 13:27:53 -04:00
|
|
|
titleBackground.gameObject.SetActive(false);
|
|
|
|
|
titleText.gameObject.SetActive(false);
|
|
|
|
|
subTitleText.gameObject.SetActive(false);
|
2025-08-11 14:04:06 -04:00
|
|
|
}
|
|
|
|
|
}
|
2026-07-19 16:44:58 -04:00
|
|
|
}
|