分离具体属性组件,加入样式表系统

This commit is contained in:
2026-07-25 22:47:14 +08:00
parent b1636d5932
commit 3fbb82f40e
38 changed files with 742 additions and 38 deletions
@@ -13,14 +13,18 @@ namespace XericUI.ReflectionUIGenerator
[Tooltip("关联的 Text 组件(未设置则自动查找)")]
private UnityEngine.UI.Text _uiText;
#if dUI_TextMeshPro
[SerializeField]
[Tooltip("关联的 TMP_Text 组件(未设置则自动查找)")]
private TMPro.TMP_Text _tmpText;
#endif
private void Awake()
{
if (_uiText == null) _uiText = GetComponent<UnityEngine.UI.Text>();
#if dUI_TextMeshPro
if (_tmpText == null) _tmpText = GetComponent<TMPro.TMP_Text>();
#endif
}
public override void BindToAccessor(
@@ -48,9 +52,15 @@ namespace XericUI.ReflectionUIGenerator
{
string displayStr = value?.ToString() ?? "";
#if dUI_TextMeshPro
if (_tmpText != null)
{
_tmpText.text = displayStr;
else if (_uiText != null)
return;
}
#endif
if (_uiText != null)
_uiText.text = displayStr;
}
}