表格:初始化改逐项对齐(有则复用、无则新建);背景原点按 rect 实际尺寸换算
- Awake 与三个重建入口不再"先清空再重建",改走 ReconcileGeneratedHierarchy:模板、背景、 边框、冻结层逐项检查,存在就复用(各自重置 rect 与内容),缺了才建。编辑模式下预制体实例 里的对象本来就不能 DestroyImmediate,这条路径也顺手绕开了它。 - 池的四个显隐回调与 ReleaseAllTrackedCells 跳过已销毁的根:手工删过生成物之后, ReturnCounter 会把已销毁对象交给 SetActive,抛 MissingReferenceException。 - XTableBackgroundRenderer 的图元坐标按 rectTransform.rect 换算:本地原点是轴心、图元坐标是 左上角原点,以前只在 pivot=(0,1) 时重合;现在轴心是什么都对,不再依赖调用方先摆好 pivot。
This commit is contained in:
@@ -190,6 +190,8 @@ namespace XericUI.XTable.Rendering.Elements
|
||||
{
|
||||
// Counter 整体重新借出前清空历史 Slot 的视觉状态;未重新绑定的 Slot
|
||||
// 即使随 Counter 激活,也不会保留冻结区域的旧内容。
|
||||
// 手工删过生成物/域重载后,池里可能留着已销毁的根:SetActive 会抛 MissingReferenceException。
|
||||
if (items[i] == null || items[i].Root == null) continue;
|
||||
ResetImageDefaults(items[i]);
|
||||
items[i].Root.SetActive(true);
|
||||
}
|
||||
@@ -199,6 +201,8 @@ namespace XericUI.XTable.Rendering.Elements
|
||||
{
|
||||
for (int i = 0; i < items.Count; i++)
|
||||
{
|
||||
// 已销毁的根不能再碰(Unbind 会读 Rect);跳过即可,重载后池会重建。
|
||||
if (items[i] == null || items[i].Root == null) continue;
|
||||
items[i].Style?.Unbind();
|
||||
items[i].Root.SetActive(false);
|
||||
}
|
||||
@@ -210,6 +214,8 @@ namespace XericUI.XTable.Rendering.Elements
|
||||
{
|
||||
// Counter 整体重新借出前清空历史 Slot 的视觉状态;未重新绑定的 Slot
|
||||
// 即使随 Counter 激活,也不会保留冻结区域的旧内容。
|
||||
// 同 SetImageCounterActive:已销毁的槽位直接跳过,不要回调到原生层。
|
||||
if (items[i] == null || items[i].Root == null) continue;
|
||||
ResetTextDefaults(items[i]);
|
||||
items[i].Root.SetActive(true);
|
||||
}
|
||||
@@ -219,6 +225,8 @@ namespace XericUI.XTable.Rendering.Elements
|
||||
{
|
||||
for (int i = 0; i < items.Count; i++)
|
||||
{
|
||||
// 已销毁的根不能再碰(Unbind 会读 Rect);跳过即可,重载后池会重建。
|
||||
if (items[i] == null || items[i].Root == null) continue;
|
||||
items[i].Style?.Unbind();
|
||||
items[i].Root.SetActive(false);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user