ui: invert child action buttons in selected table rows to light on dark

This commit is contained in:
ZHU MINCHAO committed 2026-11-04 10:33:20 +08:00
1 parent 4bf7e58b36
commit a5ff9418ab
1 file changed
+20
+20
View File
@@ -315,6 +315,26 @@ namespace Decentralized
if (pBtn != null && pBtn.gameObject != r.Root) continue;
t.color = r.Selected ? KeyText : Ink;
}
if (r.Selected)
{
// 选中行整行反色(深墨底):行内的操作按钮反转为浅色底、深墨字
foreach (var cBtn in r.Root.GetComponentsInChildren<Button>(true))
{
if (cBtn.gameObject == r.Root) continue;
cBtn.transition = Selectable.Transition.None;
var img = cBtn.GetComponent<Image>();
if (img != null)
{
img.sprite = MachineryStyle.White;
img.type = Image.Type.Simple;
img.color = KeyText;
}
foreach (var t in cBtn.GetComponentsInChildren<TextMeshProUGUI>(true))
{
t.color = Ink;
}
}
}
if (r.OnClick != null)
{
var btn = r.Root.GetComponent<Button>() ?? r.Root.AddComponent<Button>();