From 0cc1a89b4da17312e2602d5bda4cce409196da08 Mon Sep 17 00:00:00 2001
From: LiRuoChen <571244399@qq.com>
Date: Mon, 29 Jun 2026 19:29:42 +0800
Subject: [PATCH 1/4] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E4=B8=80=E4=BA=9B?=
=?UTF-8?q?=E5=BF=AB=E6=8D=B7=E7=94=A8=E6=B3=95=E3=80=82?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
Editor/OverrideUI/XericStyleImageEditor.cs | 67 +++++++++++++++----
Editor/SuperStyleSheet/StyleFieldDrawer.cs | 16 ++++-
.../Rendering/Component/XericUIActionTable.cs | 2 +
3 files changed, 71 insertions(+), 14 deletions(-)
diff --git a/Editor/OverrideUI/XericStyleImageEditor.cs b/Editor/OverrideUI/XericStyleImageEditor.cs
index f345d08..3623cab 100644
--- a/Editor/OverrideUI/XericStyleImageEditor.cs
+++ b/Editor/OverrideUI/XericStyleImageEditor.cs
@@ -1,3 +1,4 @@
+using UnityEngine;
using UnityEditor;
using UnityEditor.UI;
@@ -6,8 +7,9 @@ using XericUI.OverrideUI;
namespace XericUIEditor.OverrideUI
{
///
- /// XericStyleImage 的 Inspector 编辑器——继承 GraphicEditor,
- /// 额外展示颜色、纹理、材质三个 StyleField 和自动刷新开关。
+ /// XericStyleImage 的 Inspector 编辑器——
+ /// 仅显示颜色样式字段 + raycastTarget / raycastPadding / maskable。
+ /// 不展示原始 Color/Sprite/Material(被样式表接管)。
///
[CustomEditor(typeof(XericStyleImage), true)]
[CanEditMultipleObjects]
@@ -16,30 +18,71 @@ namespace XericUIEditor.OverrideUI
private SerializedProperty m_ColorStyleProp;
private SerializedProperty m_TextureStyleProp;
private SerializedProperty m_MaterialStyleProp;
- private SerializedProperty m_AutoRefreshProp;
+ private SerializedProperty m_RaycastTargetProp;
+ private SerializedProperty m_RaycastPaddingProp;
+ private SerializedProperty m_MaskableProp;
+ private SerializedProperty m_ColorProp;
+
+ // 折叠状态
+ private static bool s_ColorFoldout = false;
+ private static bool s_TextureFoldout = false;
+ private static bool s_MaterialFoldout = false;
protected override void OnEnable()
{
base.OnEnable();
- m_ColorStyleProp = serializedObject.FindProperty("m_ColorStyle");
+ m_ColorStyleProp = serializedObject.FindProperty("m_ColorStyle");
m_TextureStyleProp = serializedObject.FindProperty("m_TextureStyle");
m_MaterialStyleProp = serializedObject.FindProperty("m_MaterialStyle");
- m_AutoRefreshProp = serializedObject.FindProperty("m_AutoRefresh");
+ m_RaycastTargetProp = serializedObject.FindProperty("m_RaycastTarget");
+ m_RaycastPaddingProp = serializedObject.FindProperty("m_RaycastPadding");
+ m_MaskableProp = serializedObject.FindProperty("m_Maskable");
+ m_ColorProp = serializedObject.FindProperty("m_Color");
}
public override void OnInspectorGUI()
{
- base.OnInspectorGUI();
- EditorGUILayout.Space();
-
serializedObject.Update();
+ // === 颜色样式(主要展示) ===
EditorGUILayout.LabelField("样式表配置", EditorStyles.boldLabel);
- EditorGUILayout.PropertyField(m_ColorStyleProp);
- EditorGUILayout.PropertyField(m_TextureStyleProp);
- EditorGUILayout.PropertyField(m_MaterialStyleProp);
- EditorGUILayout.PropertyField(m_AutoRefreshProp);
+ EditorGUILayout.Space(2);
+ if (m_ColorStyleProp != null)
+ EditorGUILayout.PropertyField(m_ColorStyleProp, new GUIContent("颜色样式"));
+
+ // 纹理和材质样式折叠(通常不需要改动)
+ s_TextureFoldout = EditorGUILayout.Foldout(s_TextureFoldout, "纹理 / 材质样式(高级)", true);
+ if (s_TextureFoldout)
+ {
+ EditorGUI.indentLevel++;
+ if (m_TextureStyleProp != null)
+ EditorGUILayout.PropertyField(m_TextureStyleProp, new GUIContent("纹理样式"));
+ if (m_MaterialStyleProp != null)
+ EditorGUILayout.PropertyField(m_MaterialStyleProp, new GUIContent("材质样式"));
+ EditorGUI.indentLevel--;
+ }
+
+ EditorGUILayout.Space(8);
+
+ // === 颜色预览(只读) ===
+ if (m_ColorProp != null)
+ {
+ EditorGUI.BeginDisabledGroup(true);
+ EditorGUILayout.PropertyField(m_ColorProp, new GUIContent("颜色(预览)"));
+ EditorGUI.EndDisabledGroup();
+ }
+
+ EditorGUILayout.Space(4);
+
+ // === Raycast 与 Mask ===
+ EditorGUILayout.LabelField("交互", EditorStyles.boldLabel);
+ if (m_RaycastTargetProp != null)
+ EditorGUILayout.PropertyField(m_RaycastTargetProp, new GUIContent("Raycast Target"));
+ if (m_RaycastPaddingProp != null)
+ EditorGUILayout.PropertyField(m_RaycastPaddingProp, new GUIContent("Raycast Padding"));
+ if (m_MaskableProp != null)
+ EditorGUILayout.PropertyField(m_MaskableProp, new GUIContent("Maskable"));
serializedObject.ApplyModifiedProperties();
}
diff --git a/Editor/SuperStyleSheet/StyleFieldDrawer.cs b/Editor/SuperStyleSheet/StyleFieldDrawer.cs
index 888e6db..2d86818 100644
--- a/Editor/SuperStyleSheet/StyleFieldDrawer.cs
+++ b/Editor/SuperStyleSheet/StyleFieldDrawer.cs
@@ -26,6 +26,11 @@ namespace XericUIEditor
public override float GetPropertyHeight(SerializedProperty property, GUIContent label)
{
+ var nsProp = property.FindPropertyRelative("Namespace");
+ var pathProp = property.FindPropertyRelative("StylePath");
+ if (nsProp == null || pathProp == null)
+ return LINE_HEIGHT + PADDING * 2;
+
string key = GetFoldKey(property);
bool expanded = s_FoldoutStates.TryGetValue(key, out bool f) && f;
@@ -37,7 +42,7 @@ namespace XericUIEditor
// 有值才显示值类型行
string ns = GetNamespace(property);
- string path = property.FindPropertyRelative("StylePath").stringValue;
+ string path = pathProp.stringValue;
StyleValue val = StyleManager.GetValue(ns, path);
if (val != null && val.ValueType != null)
rowCount++;
@@ -59,6 +64,12 @@ namespace XericUIEditor
SerializedProperty nsProp = property.FindPropertyRelative("Namespace");
SerializedProperty pathProp = property.FindPropertyRelative("StylePath");
+ if (nsProp == null || pathProp == null)
+ {
+ EditorGUI.LabelField(position, label, "(StyleField 未初始化)");
+ return;
+ }
+
// === 标题行:折叠箭头 + 标签 + 路径下拉 ===
Rect headerRect = new Rect(position.x, position.y + PADDING, position.width, LINE_HEIGHT);
@@ -213,7 +224,8 @@ namespace XericUIEditor
private static string GetNamespace(SerializedProperty property)
{
- string ns = property.FindPropertyRelative("Namespace").stringValue;
+ var nsProp = property.FindPropertyRelative("Namespace");
+ string ns = nsProp?.stringValue;
return string.IsNullOrEmpty(ns) ? "default" : ns;
}
diff --git a/Runtime/XTable/Rendering/Component/XericUIActionTable.cs b/Runtime/XTable/Rendering/Component/XericUIActionTable.cs
index aacd167..d7d4adc 100644
--- a/Runtime/XTable/Rendering/Component/XericUIActionTable.cs
+++ b/Runtime/XTable/Rendering/Component/XericUIActionTable.cs
@@ -93,6 +93,8 @@ namespace XericUI.XTable.Rendering.Component
}
}
+ public XTableCellData this[int row, int col] => TableData.GetOrCreateCell(row, col);
+
public float[] RowHeights => m_RowHeights;
public float[] ColWidths => m_ColWidths;
From b871e947b106993e4c96820fb191fbc5c64bf905 Mon Sep 17 00:00:00 2001
From: lrc <571244399@qq.com>
Date: Tue, 30 Jun 2026 09:13:36 +0800
Subject: [PATCH 2/4] =?UTF-8?q?=E6=95=B4=E5=90=88=E8=A1=A8=E5=8F=82?=
=?UTF-8?q?=E6=95=B0=E7=B3=BB=E7=BB=9F?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../XericUIActionTable.StyleParams.cs | 99 +++++++++++++++++
.../XericUIActionTable.StyleParams.cs.meta | 11 ++
.../Rendering/Component/XericUIActionTable.cs | 103 +++++++-----------
3 files changed, 150 insertions(+), 63 deletions(-)
create mode 100644 Runtime/XTable/Rendering/Component/XericUIActionTable.StyleParams.cs
create mode 100644 Runtime/XTable/Rendering/Component/XericUIActionTable.StyleParams.cs.meta
diff --git a/Runtime/XTable/Rendering/Component/XericUIActionTable.StyleParams.cs b/Runtime/XTable/Rendering/Component/XericUIActionTable.StyleParams.cs
new file mode 100644
index 0000000..19ed9b6
--- /dev/null
+++ b/Runtime/XTable/Rendering/Component/XericUIActionTable.StyleParams.cs
@@ -0,0 +1,99 @@
+using TMPro;
+using UnityEngine;
+using XericLibrary.Runtime.SuperStyleSheet;
+
+namespace XericUI.XTable.Rendering.Component
+{
+ ///
+ /// 表格样式参数——统一管理所有样式路径与回退值。
+ /// 修改此处的常量即可全局调整表格外观,无需在各方法中查找硬编码字符串。
+ ///
+ public partial class XericUIActionTable
+ {
+ #region 样式路径常量
+
+ public const string STYLE_CELL_BG_COLOR = "/cell/bg/color";
+ public const string STYLE_CELL_FG_COLOR = "/cell/fg/color";
+ public const string STYLE_CELL_SELECTION_BG_COLOR = "/cell/selection/bg/color";
+
+ public const string STYLE_CELL_BORDER_TOP_COLOR = "/cell/border/top/color";
+ public const string STYLE_CELL_BORDER_TOP_WIDTH = "/cell/border/top/width";
+ public const string STYLE_CELL_BORDER_BOTTOM_COLOR = "/cell/border/bottom/color";
+ public const string STYLE_CELL_BORDER_BOTTOM_WIDTH = "/cell/border/bottom/width";
+ public const string STYLE_CELL_BORDER_LEFT_COLOR = "/cell/border/left/color";
+ public const string STYLE_CELL_BORDER_LEFT_WIDTH = "/cell/border/left/width";
+ public const string STYLE_CELL_BORDER_RIGHT_COLOR = "/cell/border/right/color";
+ public const string STYLE_CELL_BORDER_RIGHT_WIDTH = "/cell/border/right/width";
+
+ public const string STYLE_CELL_FONT_SIZE = "/cell/font/size";
+ public const string STYLE_CELL_FONT_ALIGNMENT = "/cell/font/alignment";
+ public const string STYLE_CELL_FONT_RICH_TEXT = "/cell/font/richText";
+ public const string STYLE_CELL_FONT_ASSET = "/cell/font/fontAsset";
+
+ public const string STYLE_CELL_DEFAULT_HEIGHT = "/cell/default/height";
+ public const string STYLE_CELL_DEFAULT_WIDTH = "/cell/default/width";
+
+ #endregion
+
+ #region 回退值(GetStyleColor/GetStyleFloat/GetStyleInt 兜底参数)
+
+ public static readonly Color BG_COLOR_FALLBACK = new Color(0.18f, 0.18f, 0.18f, 1f);
+ public static readonly Color FG_COLOR_FALLBACK = new Color(0.05f, 0.05f, 0.05f);
+ public static readonly Color SELECTION_COLOR_FALLBACK = new Color(0.2f, 0.5f, 1f, 0.3f);
+ public static readonly Color BORDER_COLOR_FALLBACK = new Color(0.35f, 0.35f, 0.35f, 0.5f);
+ public static readonly float BORDER_WIDTH_FALLBACK = 1f;
+ public static readonly int FONT_SIZE_FALLBACK = 14;
+
+ #endregion
+
+ #region 动态默认值(EnsureDefaultStyleNamespace 中 AddDynamicStyle 的初始值,匹配 DefaultTableStyles.xsss)
+
+ public static readonly Color DEFAULT_BG_COLOR = Color.white;
+ public static readonly Color DEFAULT_FG_COLOR = new Color(0.1f, 0.1f, 0.1f);
+ public static readonly Color DEFAULT_BORDER_COLOR = new Color(0.8f, 0.8f, 0.8f);
+ public static readonly float DEFAULT_BORDER_WIDTH = 1f;
+ public static readonly Color DEFAULT_SELECTION_COLOR = new Color(0.2f, 0.5f, 1f, 0.3f);
+ public static readonly int DEFAULT_FONT_SIZE = 14;
+ public const string DEFAULT_FONT_ALIGNMENT = "MiddleCenter";
+ public const bool DEFAULT_FONT_RICH_TEXT = true;
+ public const float DEFAULT_CELL_HEIGHT = 40f;
+ public const float DEFAULT_CELL_WIDTH = 100f;
+
+ #endregion
+
+ #region 运行时硬编码色值
+
+ public static readonly Color RT_SELECTION_COLOR = new Color(0.18f, 0.42f, 0.82f, 0.25f);
+ public static readonly Color RT_MULTI_SELECT_COLOR = new Color(0.18f, 0.42f, 0.82f, 0.12f);
+ public static readonly Color RT_FOCUS_COLOR = new Color(0.22f, 0.55f, 0.95f, 0.35f);
+ public static readonly Color RT_BORDER_COLOR = new Color(0.35f, 0.35f, 0.35f, 0.5f);
+ public const float RT_BORDER_WIDTH = 1f;
+
+ #endregion
+
+ #region 便捷取值方法(封装路径 + 回退值)
+
+ private Color GetCellBgColor(string ns) =>
+ GetStyleColor(ns, STYLE_CELL_BG_COLOR, BG_COLOR_FALLBACK);
+
+ private Color GetCellFgColor(string ns) =>
+ GetStyleColor(ns, STYLE_CELL_FG_COLOR, FG_COLOR_FALLBACK);
+
+ private Color GetCellSelectionBgColor(string ns) =>
+ GetStyleColor(ns, STYLE_CELL_SELECTION_BG_COLOR, SELECTION_COLOR_FALLBACK);
+
+ private Color GetCellBorderColor(string ns) =>
+ GetStyleColor(ns, STYLE_CELL_BORDER_BOTTOM_COLOR, BORDER_COLOR_FALLBACK);
+
+ private float GetCellBorderWidth(string ns) =>
+ GetStyleFloat(ns, STYLE_CELL_BORDER_BOTTOM_WIDTH, BORDER_WIDTH_FALLBACK);
+
+ private int GetCellFontSize(string ns) =>
+ GetStyleInt(ns, STYLE_CELL_FONT_SIZE, FONT_SIZE_FALLBACK);
+
+ private TMP_FontAsset GetCellFontAsset(string ns) =>
+ GetStyleFontAsset(ns, STYLE_CELL_FONT_ASSET);
+
+ #endregion
+ }
+}
diff --git a/Runtime/XTable/Rendering/Component/XericUIActionTable.StyleParams.cs.meta b/Runtime/XTable/Rendering/Component/XericUIActionTable.StyleParams.cs.meta
new file mode 100644
index 0000000..dc8e1c4
--- /dev/null
+++ b/Runtime/XTable/Rendering/Component/XericUIActionTable.StyleParams.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 0521a59402d81494a9874fcda645ed81
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Runtime/XTable/Rendering/Component/XericUIActionTable.cs b/Runtime/XTable/Rendering/Component/XericUIActionTable.cs
index b030bec..36f78c6 100644
--- a/Runtime/XTable/Rendering/Component/XericUIActionTable.cs
+++ b/Runtime/XTable/Rendering/Component/XericUIActionTable.cs
@@ -660,7 +660,7 @@ namespace XericUI.XTable.Rendering.Component
bgRt.sizeDelta = new Vector2(m_TotalWidth, m_TotalHeight);
var bgImg = m_BackgroundGo.GetComponent();
- bgImg.color = GetStyleColor(m_DefaultStyleNamespace, "/cell/bg/color", new Color(0.18f, 0.18f, 0.18f, 1f));
+ bgImg.color = GetCellBgColor(m_DefaultStyleNamespace);
bgImg.raycastTarget = false;
}
@@ -800,16 +800,15 @@ namespace XericUI.XTable.Rendering.Component
private void RenderCells(int sr, int er, int sc, int ec)
{
- Color fgFallback = new Color(0.05f, 0.05f, 0.05f);
string ns = m_DefaultStyleNamespace;
// 编辑器模式:从样式表 pull 所有颜色值
#if UNITY_EDITOR
if (!Application.isPlaying)
{
- Color selectionColor = GetStyleColor(ns, "/cell/selection/bg/color", new Color(0.2f, 0.5f, 1f, 0.3f));
- Color borderColor = GetStyleColor(ns, "/cell/border/bottom/color", new Color(0.35f, 0.35f, 0.35f, 0.5f));
- float borderWidth = GetStyleFloat(ns, "/cell/border/bottom/width", 1f);
+ Color selectionColor = GetCellSelectionBgColor(ns);
+ Color borderColor = GetCellBorderColor(ns);
+ float borderWidth = GetCellBorderWidth(ns);
Color multiSelectColor = new Color(selectionColor.r, selectionColor.g, selectionColor.b, selectionColor.a * 0.4f);
Color focusColor = new Color(selectionColor.r + 0.04f, selectionColor.g + 0.13f, selectionColor.b + 0.13f, selectionColor.a * 1.4f);
@@ -876,10 +875,10 @@ namespace XericUI.XTable.Rendering.Component
txt.Rect.anchoredPosition = new Vector2(cellX + 4, cellY);
txt.Rect.sizeDelta = new Vector2(cellW - 8, cellH);
txt.Text.text = data.Text;
- txt.Text.color = GetStyleColor(cellNS, "/cell/fg/color", fgFallback);
- txt.Text.fontSize = GetStyleInt(cellNS, "/cell/font/size", 14);
+ txt.Text.color = GetCellFgColor(cellNS);
+ txt.Text.fontSize = GetCellFontSize(cellNS);
txt.Text.alignment = TextAlignmentOptions.Midline;
- txt.Text.font = GetStyleFontAsset(cellNS, "/cell/font/fontAsset") ?? txt.Text.font;
+ txt.Text.font = GetCellFontAsset(cellNS) ?? txt.Text.font;
}
}
}
@@ -888,9 +887,9 @@ namespace XericUI.XTable.Rendering.Component
#endif
// 运行时模式
- Color rtSelectionColor = new Color(0.18f, 0.42f, 0.82f, 0.25f);
- Color rtMultiSelectColor = new Color(0.18f, 0.42f, 0.82f, 0.12f);
- Color rtFocusColor = new Color(0.22f, 0.55f, 0.95f, 0.35f);
+ Color rtSelectionColor = RT_SELECTION_COLOR;
+ Color rtMultiSelectColor = RT_MULTI_SELECT_COLOR;
+ Color rtFocusColor = RT_FOCUS_COLOR;
for (int r = sr; r < er && r < m_RowHeights.Length; r++)
{
@@ -935,13 +934,13 @@ namespace XericUI.XTable.Rendering.Component
var hLine = m_Assembler.GetImage("cell_hline");
hLine.Rect.anchoredPosition = new Vector2(cellX, cellY - cellH);
- hLine.Rect.sizeDelta = new Vector2(cellW, 1f);
- hLine.Image.color = new Color(0.35f, 0.35f, 0.35f, 0.5f);
+ hLine.Rect.sizeDelta = new Vector2(cellW, RT_BORDER_WIDTH);
+ hLine.Image.color = RT_BORDER_COLOR;
var vLine = m_Assembler.GetImage("cell_vline");
- vLine.Rect.anchoredPosition = new Vector2(cellX + cellW - 1, cellY);
- vLine.Rect.sizeDelta = new Vector2(1f, cellH);
- vLine.Image.color = new Color(0.35f, 0.35f, 0.35f, 0.5f);
+ vLine.Rect.anchoredPosition = new Vector2(cellX + cellW - RT_BORDER_WIDTH, cellY);
+ vLine.Rect.sizeDelta = new Vector2(RT_BORDER_WIDTH, cellH);
+ vLine.Image.color = RT_BORDER_COLOR;
if (data == null) continue;
@@ -951,16 +950,7 @@ namespace XericUI.XTable.Rendering.Component
txt.Rect.anchoredPosition = new Vector2(cellX + 4, cellY);
txt.Rect.sizeDelta = new Vector2(cellW - 8, cellH);
txt.Text.text = data.Text;
-
-#if UNITY_EDITOR
- if (!Application.isPlaying)
- {
- txt.Text.color = GetStyleColor(cellNS, "/cell/fg/color", fgFallback);
- txt.Text.fontSize = GetStyleInt(cellNS, "/cell/font/size", 14);
- txt.Text.alignment = TextAlignmentOptions.Midline;
- txt.Text.font = GetStyleFontAsset(cellNS, "/cell/font/fontAsset") ?? txt.Text.font;
- }
-#endif
+ // 运行时样式由 StyleBoundElement 被动更新,此处仅设置文本内容
}
}
}
@@ -1090,45 +1080,32 @@ namespace XericUI.XTable.Rendering.Component
private void EnsureDefaultStyleNamespace()
{
- // 避免在样式表尚未加载时触发 HasStyle → GetValue 的命名空间不存在错误
- var namespaces = StyleManager.GetAvailableNamespaces();
- if (namespaces == null || !namespaces.Contains(m_DefaultStyleNamespace))
+ // 检查命名空间是否已存在,避免 HasStyle → GetValue 对不存在的命名空间报错
+ bool nsExists = StyleManager.GetAvailableNamespaces()?.Contains(m_DefaultStyleNamespace) == true;
+
+ // 命名空间已存在且样式已加载(来自 .xsss),无需添加回退值
+ if (nsExists && StyleManager.HasStyle(m_DefaultStyleNamespace, STYLE_CELL_BG_COLOR))
return;
- if (!StyleManager.HasStyle(m_DefaultStyleNamespace, "/cell/bg/color"))
- {
- // 回退默认值匹配 DefaultTableStyles.xsss
- StyleManager.AddDynamicStyle(m_DefaultStyleNamespace, "/cell/bg/color", Color.white);
- StyleManager.AddDynamicStyle(m_DefaultStyleNamespace, "/cell/fg/color",
- new Color(0.1f, 0.1f, 0.1f));
- StyleManager.AddDynamicStyle(m_DefaultStyleNamespace, "/cell/border/top/color",
- new Color(0.8f, 0.8f, 0.8f));
- StyleManager.AddDynamicStyle(m_DefaultStyleNamespace, "/cell/border/top/width", 1f);
- StyleManager.AddDynamicStyle(m_DefaultStyleNamespace, "/cell/border/bottom/color",
- new Color(0.8f, 0.8f, 0.8f));
- StyleManager.AddDynamicStyle(m_DefaultStyleNamespace, "/cell/border/bottom/width", 1f);
- StyleManager.AddDynamicStyle(m_DefaultStyleNamespace, "/cell/border/left/color",
- new Color(0.8f, 0.8f, 0.8f));
- StyleManager.AddDynamicStyle(m_DefaultStyleNamespace, "/cell/border/left/width", 1f);
- StyleManager.AddDynamicStyle(m_DefaultStyleNamespace, "/cell/border/right/color",
- new Color(0.8f, 0.8f, 0.8f));
- StyleManager.AddDynamicStyle(m_DefaultStyleNamespace, "/cell/border/right/width", 1f);
- StyleManager.AddDynamicStyle(m_DefaultStyleNamespace, "/cell/selection/bg/color",
- new Color(0.2f, 0.5f, 1f, 0.3f));
- StyleManager.AddDynamicStyle(m_DefaultStyleNamespace, "/cell/font/size", 14);
- StyleManager.AddDynamicStyle(m_DefaultStyleNamespace, "/cell/font/alignment", "MiddleCenter");
- StyleManager.AddDynamicStyle(m_DefaultStyleNamespace, "/cell/font/richText", true);
-#if UNITY_EDITOR
- // 编辑器下尝试加载默认字体资源
- var defaultFont = UnityEditor.AssetDatabase.LoadAssetAtPath(
- "Packages/com.lrss3.xericuiactionvessel/Runtime/Font/SourceHanSansSC-Regular-2 SDF.asset");
- if (defaultFont != null)
- StyleManager.AddDynamicStyle(m_DefaultStyleNamespace, "/cell/font/fontAsset", defaultFont);
-#endif
- StyleManager.AddDynamicStyle(m_DefaultStyleNamespace, "/cell/default/height", 40f);
- StyleManager.AddDynamicStyle(m_DefaultStyleNamespace, "/cell/default/width", 100f);
- StyleManager.ForceRefresh();
- }
+ // 回退默认值匹配 DefaultTableStyles.xsss
+ // AddDynamicStyle 自动创建命名空间(如果尚不存在)
+ StyleManager.AddDynamicStyle(m_DefaultStyleNamespace, STYLE_CELL_BG_COLOR, DEFAULT_BG_COLOR);
+ StyleManager.AddDynamicStyle(m_DefaultStyleNamespace, STYLE_CELL_FG_COLOR, DEFAULT_FG_COLOR);
+ StyleManager.AddDynamicStyle(m_DefaultStyleNamespace, STYLE_CELL_BORDER_TOP_COLOR, DEFAULT_BORDER_COLOR);
+ StyleManager.AddDynamicStyle(m_DefaultStyleNamespace, STYLE_CELL_BORDER_TOP_WIDTH, DEFAULT_BORDER_WIDTH);
+ StyleManager.AddDynamicStyle(m_DefaultStyleNamespace, STYLE_CELL_BORDER_BOTTOM_COLOR, DEFAULT_BORDER_COLOR);
+ StyleManager.AddDynamicStyle(m_DefaultStyleNamespace, STYLE_CELL_BORDER_BOTTOM_WIDTH, DEFAULT_BORDER_WIDTH);
+ StyleManager.AddDynamicStyle(m_DefaultStyleNamespace, STYLE_CELL_BORDER_LEFT_COLOR, DEFAULT_BORDER_COLOR);
+ StyleManager.AddDynamicStyle(m_DefaultStyleNamespace, STYLE_CELL_BORDER_LEFT_WIDTH, DEFAULT_BORDER_WIDTH);
+ StyleManager.AddDynamicStyle(m_DefaultStyleNamespace, STYLE_CELL_BORDER_RIGHT_COLOR, DEFAULT_BORDER_COLOR);
+ StyleManager.AddDynamicStyle(m_DefaultStyleNamespace, STYLE_CELL_BORDER_RIGHT_WIDTH, DEFAULT_BORDER_WIDTH);
+ StyleManager.AddDynamicStyle(m_DefaultStyleNamespace, STYLE_CELL_SELECTION_BG_COLOR, DEFAULT_SELECTION_COLOR);
+ StyleManager.AddDynamicStyle(m_DefaultStyleNamespace, STYLE_CELL_FONT_SIZE, DEFAULT_FONT_SIZE);
+ StyleManager.AddDynamicStyle(m_DefaultStyleNamespace, STYLE_CELL_FONT_ALIGNMENT, DEFAULT_FONT_ALIGNMENT);
+ StyleManager.AddDynamicStyle(m_DefaultStyleNamespace, STYLE_CELL_FONT_RICH_TEXT, DEFAULT_FONT_RICH_TEXT);
+ StyleManager.AddDynamicStyle(m_DefaultStyleNamespace, STYLE_CELL_DEFAULT_HEIGHT, DEFAULT_CELL_HEIGHT);
+ StyleManager.AddDynamicStyle(m_DefaultStyleNamespace, STYLE_CELL_DEFAULT_WIDTH, DEFAULT_CELL_WIDTH);
+ StyleManager.ForceRefresh();
}
#endregion
From de83b9c48e80a02eeb774bf17daba393de0449ab Mon Sep 17 00:00:00 2001
From: LiRuoChen <571244399@qq.com>
Date: Tue, 30 Jun 2026 09:16:20 +0800
Subject: [PATCH 3/4] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E9=BB=98=E8=AE=A4?=
=?UTF-8?q?=E6=A0=B7=E5=BC=8F?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../StyleSheetUI/DefaultXericStyleSheet.xsss | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/Runtime/Core/StyleSheetUI/DefaultXericStyleSheet.xsss b/Runtime/Core/StyleSheetUI/DefaultXericStyleSheet.xsss
index eaed782..960b247 100644
--- a/Runtime/Core/StyleSheetUI/DefaultXericStyleSheet.xsss
+++ b/Runtime/Core/StyleSheetUI/DefaultXericStyleSheet.xsss
@@ -10,4 +10,20 @@ namespace: default
.PressedColor = (0.78,0.78,0.78,1)
.SelectedColor = (0.96,0.96,0.96,1)
.DisabledColor = (0.6,0.6,0.6,0.8)
+}
+
+/toggle/TargetGraphic/ColorTint:UnityEngine.UI.ColorBlock/ {
+.NormalColor = (1,1,1,1)
+.HighlightedColor = (0.96,0.96,0.96,1)
+.PressedColor = (0.78,0.78,0.78,1)
+.SelectedColor = (0.96,0.96,0.96,1)
+.DisabledColor = (0.6,0.6,0.6,0.8)
+}
+
+/image/ColorTint:UnityEngine.UI.ColorBlock/ {
+.NormalColor = (1,1,1,1)
+.HighlightedColor = (0.96,0.96,0.96,1)
+.PressedColor = (0.78,0.78,0.78,1)
+.SelectedColor = (0.96,0.96,0.96,1)
+.DisabledColor = (0.6,0.6,0.6,0.8)
}
\ No newline at end of file
From 054890251bd6ec6e9f193ffdc0ef8e6b1d652db8 Mon Sep 17 00:00:00 2001
From: LiRuoChen <571244399@qq.com>
Date: Tue, 30 Jun 2026 10:08:27 +0800
Subject: [PATCH 4/4] backup
---
Runtime/XTable/Rendering/Component/XericUIActionTable.cs | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/Runtime/XTable/Rendering/Component/XericUIActionTable.cs b/Runtime/XTable/Rendering/Component/XericUIActionTable.cs
index 554eb99..31876d1 100644
--- a/Runtime/XTable/Rendering/Component/XericUIActionTable.cs
+++ b/Runtime/XTable/Rendering/Component/XericUIActionTable.cs
@@ -12,7 +12,7 @@ using XericLibrary.Runtime.SuperStyleSheet;
#if UNITY_EDITOR
using UnityEditor;
#endif
-
+//233333Git666
namespace XericUI.XTable.Rendering.Component
{
///
@@ -22,7 +22,7 @@ namespace XericUI.XTable.Rendering.Component
///
[ExecuteAlways]
[AddComponentMenu("Xeric UI Vessel/Table/Xeric UI Action Table", 60)]
- public class XericUIActionTable : XericUIBehaciour, IPointerClickHandler
+ public partial class XericUIActionTable : XericUIBehaciour, IPointerClickHandler
{
#region 常量