thr_dev/dev2 #9

Merged
lrss3 merged 3 commits from thr_dev/dev2 into master 2026-06-24 15:18:42 +08:00
8 changed files with 35 additions and 12 deletions
+4
View File
@@ -1,5 +1,7 @@
using System; using System;
#if ODIN_INSPECTOR
using Sirenix.OdinInspector; using Sirenix.OdinInspector;
#endif
using UnityEngine; using UnityEngine;
using UnityEngine.EventSystems; using UnityEngine.EventSystems;
using UnityEngine.UI; using UnityEngine.UI;
@@ -8,8 +10,10 @@ namespace XericUI.Core.Base
{ {
public class XericUIBehaciour : UIBehaviour public class XericUIBehaciour : UIBehaviour
{ {
#if ODIN_INSPECTOR
[InfoBox("脚本必填属性存在空引用!请检查开放属性后再试", InfoMessageType.Error, VisibleIf = "PublicFieldNullReference")] [InfoBox("脚本必填属性存在空引用!请检查开放属性后再试", InfoMessageType.Error, VisibleIf = "PublicFieldNullReference")]
[HideLabel, DisplayAsString] [HideLabel, DisplayAsString]
#endif
string __EMPTYFIELD; string __EMPTYFIELD;
@@ -12,16 +12,21 @@ namespace XericUI.Core.Text
public static string DebugSelfName => "<TextMeshPro>"; public static string DebugSelfName => "<TextMeshPro>";
#region TMP_Text #region TMP_Text
/// <summary> /// <summary>
/// 获取文本容器中的字符串内容 /// 获取文本容器中的字符串内容
/// </summary> /// </summary>
/// <param name="obj"></param> /// <param name="obj"></param>
/// <returns></returns> /// <returns></returns>
public static string GetStringContext<T>(this ObjectVessel<T> obj) public static string GetStringContext<T>(this ObjectVessel<T> obj)
#if dUI_TextMeshPro
where T : TMP_Text where T : TMP_Text
=> obj != null ? obj.Target.text : string.Empty; => obj != null ? obj.Target.text : string.Empty;
#else
where T : UnityEngine.UI.Text
=> obj != null ? obj.Target.text : string.Empty;
#endif
/// <summary> /// <summary>
/// 获取文本容器中的字符串内容 /// 获取文本容器中的字符串内容
/// </summary> /// </summary>
@@ -29,6 +34,7 @@ namespace XericUI.Core.Text
/// <param name="value"></param> /// <param name="value"></param>
/// <returns></returns> /// <returns></returns>
public static void SetStringContext<T>(this ObjectVessel<T> obj, string value) public static void SetStringContext<T>(this ObjectVessel<T> obj, string value)
#if dUI_TextMeshPro
where T : TMP_Text where T : TMP_Text
{ {
if (obj != null) if (obj != null)
@@ -36,7 +42,15 @@ namespace XericUI.Core.Text
else else
Debug.LogError($"正在向空{DebugSelfName}对象赋值"); Debug.LogError($"正在向空{DebugSelfName}对象赋值");
} }
#else
where T : UnityEngine.UI.Text
{
if (obj != null)
obj.Target.text = value;
else
Debug.LogError($"正在向空{DebugSelfName}对象赋值");
}
#endif
#endregion #endregion
} }
@@ -5,7 +5,9 @@ using System.ComponentModel;
using System.Linq; using System.Linq;
using Deconstruction.Runtime.UI; using Deconstruction.Runtime.UI;
using JetBrains.Annotations; using JetBrains.Annotations;
#if ODIN_INSPECTOR
using Sirenix.OdinInspector; using Sirenix.OdinInspector;
#endif
using TMPro; using TMPro;
using UnityEngine; using UnityEngine;
using UnityEngine.UI; using UnityEngine.UI;
@@ -2,7 +2,9 @@ using System;
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
#if ODIN_INSPECTOR
using Sirenix.OdinInspector; using Sirenix.OdinInspector;
#endif
using UnityEngine; using UnityEngine;
using UnityEngine.Pool; using UnityEngine.Pool;
using UnityEngine.Serialization; using UnityEngine.Serialization;
@@ -48,9 +48,7 @@ namespace XericUI.ReflectionUIGenerator
} }
private System.Type _valueType; private System.Type _valueType;
/// <summary> #if ODIN_INSPECTOR // 属性类型名称枚举
/// 属性类型名称枚举
/// </summary>
private IEnumerable AssemblyValueTypeNames private IEnumerable AssemblyValueTypeNames
{ {
get get
@@ -75,6 +73,7 @@ namespace XericUI.ReflectionUIGenerator
} }
} }
private static ValueDropdownList<string> _assemblyValueTypeName = null; private static ValueDropdownList<string> _assemblyValueTypeName = null;
#endif
/// <summary> /// <summary>
/// 直接定义所有需要检查的类型 /// 直接定义所有需要检查的类型
@@ -1,7 +1,9 @@
using System; using System;
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
#if ODIN_INSPECTOR
using Sirenix.OdinInspector; using Sirenix.OdinInspector;
#endif
using UnityEngine; using UnityEngine;
using UnityEngine.Serialization; using UnityEngine.Serialization;
@@ -273,6 +275,7 @@ namespace XericUI.ReflectionUIGenerator
/// </summary> /// </summary>
public void ClearTriggerEvent() public void ClearTriggerEvent()
{ {
#if dUI_TextMeshPro
if (TMPInputField) if (TMPInputField)
{ {
TMPInputField.onEndEdit.RemoveAllListeners(); TMPInputField.onEndEdit.RemoveAllListeners();
@@ -284,7 +287,7 @@ namespace XericUI.ReflectionUIGenerator
TMPInputField.onValueChanged.RemoveAllListeners(); TMPInputField.onValueChanged.RemoveAllListeners();
TMPInputField.onTouchScreenKeyboardStatusChanged.RemoveAllListeners(); TMPInputField.onTouchScreenKeyboardStatusChanged.RemoveAllListeners();
} }
#endif
if (UIInputField) if (UIInputField)
{ {
UIInputField.onEndEdit.RemoveAllListeners(); UIInputField.onEndEdit.RemoveAllListeners();
@@ -1,9 +1,8 @@
using System.Collections.Generic; using System.Collections.Generic;
using Sirenix.OdinInspector;
using Sirenix.Utilities;
using UnityEngine; using UnityEngine;
using UnityEngine.Pool; using UnityEngine.Pool;
using UnityEngine.UI; using UnityEngine.UI;
using XericLibrary.Runtime.MacroLibrary;
namespace XericUI.OverrideLayout namespace XericUI.OverrideLayout
{ {
+3 -3
View File
@@ -2,7 +2,6 @@ using System.Collections.Generic;
using UnityEngine; using UnityEngine;
using UnityEngine.UI; using UnityEngine.UI;
using XericLibrary.Runtime.MacroLibrary; using XericLibrary.Runtime.MacroLibrary;
using XericLibraryEditor.Debug;
using System; using System;
namespace XericUI.VisualForm namespace XericUI.VisualForm
@@ -858,8 +857,9 @@ namespace XericUI.VisualForm
Vector2 center = pixelSafeZone.center; Vector2 center = pixelSafeZone.center;
Vector3 size = new Vector3(pixelSafeZone.width, pixelSafeZone.height, 0.001f); Vector3 size = new Vector3(pixelSafeZone.width, pixelSafeZone.height, 0.001f);
canvas.DrawGizmosCanvasRect_Warn(pixelSafeZone); // ReSharper disable once InvokeAsExtensionMethod
XericLibraryEditor.Debug.MacroGizmosDraw.DrawGizmosCanvasRect_Warn(canvas, pixelSafeZone);
} }
#endif #endif