补全缺失的预编译块

This commit is contained in:
2026-06-24 14:13:20 +08:00
parent 18de448f43
commit 7d8ed6148d
7 changed files with 32 additions and 8 deletions
+4
View File
@@ -1,5 +1,7 @@
using System;
#if ODIN_INSPECTOR
using Sirenix.OdinInspector;
#endif
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;
@@ -8,8 +10,10 @@ namespace XericUI.Core.Base
{
public class XericUIBehaciour : UIBehaviour
{
#if ODIN_INSPECTOR
[InfoBox("脚本必填属性存在空引用!请检查开放属性后再试", InfoMessageType.Error, VisibleIf = "PublicFieldNullReference")]
[HideLabel, DisplayAsString]
#endif
string __EMPTYFIELD;
@@ -12,16 +12,21 @@ namespace XericUI.Core.Text
public static string DebugSelfName => "<TextMeshPro>";
#region TMP_Text
/// <summary>
/// 获取文本容器中的字符串内容
/// </summary>
/// <param name="obj"></param>
/// <returns></returns>
public static string GetStringContext<T>(this ObjectVessel<T> obj)
#if dUI_TextMeshPro
where T : TMP_Text
=> obj != null ? obj.Target.text : string.Empty;
#else
where T : UnityEngine.UI.Text
=> obj != null ? obj.Target.text : string.Empty;
#endif
/// <summary>
/// 获取文本容器中的字符串内容
/// </summary>
@@ -29,6 +34,7 @@ namespace XericUI.Core.Text
/// <param name="value"></param>
/// <returns></returns>
public static void SetStringContext<T>(this ObjectVessel<T> obj, string value)
#if dUI_TextMeshPro
where T : TMP_Text
{
if (obj != null)
@@ -36,7 +42,15 @@ namespace XericUI.Core.Text
else
Debug.LogError($"正在向空{DebugSelfName}对象赋值");
}
#else
where T : UnityEngine.UI.Text
{
if (obj != null)
obj.Target.text = value;
else
Debug.LogError($"正在向空{DebugSelfName}对象赋值");
}
#endif
#endregion
}