拼ui 一些业务逻辑x实现

This commit is contained in:
2026-03-19 06:15:09 +08:00
parent f5c6f143c0
commit 49e45ac464
1118 changed files with 246518 additions and 5368 deletions
@@ -11,7 +11,12 @@ public class loadtopandbottomPrefab: MonoBehaviour
{
if (top_and_bottom_Panel != null && gameobject_to_Instantiate_below != null)
{
GameObject instantiated = Instantiate(top_and_bottom_Panel, gameobject_to_Instantiate_below.transform);
GameObject instantiated = FindExistingPanelInstance();
if (instantiated == null)
{
instantiated = Instantiate(top_and_bottom_Panel, gameobject_to_Instantiate_below.transform);
}
Canvas canvas = instantiated.GetComponent<Canvas>();
if (canvas != null)
{
@@ -30,6 +35,34 @@ public class loadtopandbottomPrefab: MonoBehaviour
}
}
GameObject FindExistingPanelInstance()
{
if (gameobject_to_Instantiate_below == null || top_and_bottom_Panel == null)
{
return null;
}
string prefabName = top_and_bottom_Panel.name;
Transform parent = gameobject_to_Instantiate_below.transform;
for (int i = 0; i < parent.childCount; i++)
{
Transform child = parent.GetChild(i);
if (child == null)
{
continue;
}
bool nameMatches = child.name == prefabName || child.name == prefabName + "(Clone)";
bool hasBars = child.Find("TOP") != null || child.Find("BTM") != null;
if (nameMatches && hasBars)
{
return child.gameObject;
}
}
return null;
}
void Bind_Main_Panel(GameObject instantiated)
{
if (instantiated == null)