优化反射绑定

This commit is contained in:
2026-07-24 14:51:03 +08:00
parent e63f1fb000
commit 39220c761f
9 changed files with 195 additions and 122 deletions
+7 -4
View File
@@ -21,30 +21,33 @@ namespace XericUI.ReflectionUIGenerator
[Tooltip("编组排序值,越小越靠前")]
private int _groupOrder;
/// <summary>内容挂载点 — 子 UI 组件应放入此 Transform</summary>
/// <summary>内容挂载点 — 子 UI 组件或子组应放入此 Transform</summary>
public Transform contentRoot;
/// <summary>父编组(为 null 表示根组,直接挂在 Manager 下)</summary>
public XuiAvrgMDGroup ParentGroup { get; private set; }
/// <summary>编组路径对应的组名</summary>
public string GroupName => _groupName;
/// <summary>编组排序值</summary>
public int GroupOrder => _groupOrder;
/// <summary>上下文层级深度(如 "group1/subgroup" → depth=2)</summary>
/// <summary>上下文层级深度(如 "Stats/Speed" → depth=2)</summary>
public int ContextDepth { get; private set; }
/// <summary>
/// 初始化编组容器
/// </summary>
public void Initialize(string groupPath, int order)
public void Initialize(string groupPath, int order, XuiAvrgMDGroup parent = null)
{
_groupName = groupPath;
_groupOrder = order;
ParentGroup = parent;
ContextDepth = string.IsNullOrEmpty(groupPath) ? 0 : groupPath.Split('/').Length;
gameObject.name = $"Group [{groupPath}]";
// 如果没有指定 contentRoot,自动使用自身作为挂载点
if (contentRoot == null)
contentRoot = transform;
}