This commit is contained in:
2026-06-07 11:49:55 +08:00
parent ff0f3bde54
commit 1897658a00
98 changed files with 9903 additions and 13907 deletions

View File

@@ -10,7 +10,7 @@ namespace BaseGames.UI.Settings
/// <summary>
/// 数据驱动设置面板:据 <see cref="SettingsSchemaSO"/> 生成控件行并绑定 <see cref="ISettingsService"/>。
///
/// 取代硬编码的 <see cref="BaseGames.UI.SettingsPanelController"/>:策划改表即可增删 / 重排 / 改标签 / 分节,
/// 取代旧的硬编码设置面板控制器:策划改表即可增删 / 重排 / 改标签 / 分节,
/// 无需改代码。每行据 <see cref="SettingKey"/> 自动选用 Slider / Toggle / Dropdown 行预制件,
/// 并复用通用控件 <see cref="UISlider"/> / <see cref="UIDropdown"/>。
///
@@ -73,10 +73,17 @@ namespace BaseGames.UI.Settings
}
}
private void Clear()
/// <summary>清空已生成的行(容器全部子节点)。编辑器预览与运行时关闭共用(编辑期用 DestroyImmediate。</summary>
public void Clear()
{
foreach (var go in _spawned) if (go != null) Destroy(go);
_spawned.Clear();
if (_container == null) return;
for (int i = _container.childCount - 1; i >= 0; i--)
{
var child = _container.GetChild(i).gameObject;
if (Application.isPlaying) Destroy(child);
else DestroyImmediate(child);
}
}
private GameObject PrefabFor(ControlKind kind) => kind switch