修复bug

This commit is contained in:
shenjianxing 2025-04-17 11:41:26 +08:00
parent c1e138c2c4
commit 7003fc038c
2 changed files with 9 additions and 2 deletions

View File

@ -421,7 +421,6 @@ namespace QFramework.Example
bodyItem.transform.Find("Content/Btns").gameObject.SetActive(false);
bodyItem.transform.Find("Content/Label").GetComponent<TextMeshProUGUI>().text = body.Name;
var bodyToggle = bodyItem.GetComponent<Toggle>();
bodyToggle.isOn = body.isShow;
GameObject obj = Utility.FindObj(body.Path);
obj.SetActive(body.isShow);
bodyToggle.onValueChanged.AddListener(isOn =>
@ -429,6 +428,7 @@ namespace QFramework.Example
SetAllChildren<Transform>(obj.transform, isOn);
obj.SetActive(isOn);
});
bodyToggle.isOn = body.isShow;
var iconImg = bodyItem.transform.Find("Icon").GetComponent<Image>();
LoadIcon(body.Icon, body, iconImg);
}

View File

@ -348,6 +348,7 @@ namespace QFramework.Example
for (int i = 0; i < parent.childCount; i++)
{
Transform child = parent.GetChild(i);
Transform subContent = child.Find("SubContent");
Transform labelTransform = child.Find("Content/Toggle/Content/Label");
if (labelTransform != null)
{
@ -359,7 +360,6 @@ namespace QFramework.Example
{
GameObject clone = GameObject.Instantiate(SearchItem.gameObject, SearchContent);
searchItemMap.Add(clone, child.gameObject);
Transform subContent = child.Find("SubContent");
Button btn = clone.transform.Find("Button").GetComponent<Button>();
btn.onClick.AddListener(() =>
{
@ -383,6 +383,13 @@ namespace QFramework.Example
}
}
}
else
{
if (subContent.childCount > 0)
{
CheckChildren(subContent, str);
}
}
}
}
}