public void Show(C_NavigationObj obj) { if (obj == null) { Debug.Log("传入了空"); return; } if (obj.sonS != null && obj.sonS.Count == 0) { Debug.Log("点的是最下层的,不给反应"); return; } curObj = obj; OpenPanel(curObj); CreateButton(curObj); }
/// 点这个物体,出他的子菜单 public void CreateButton(C_NavigationObj obj) { int layer = obj.layer; Transform parent = panelS[layer]; foreach (C_NavigationObj son in obj.sonS) { Button btn = Instantiate(buttonPrefab, parent); btn.transform.name = son.name; btn.GetComponentInChildren <Text>().text = son.name; C_NavigationBtn objBtn = btn.GetComponent <C_NavigationBtn>(); objBtn.manager = this; objBtn.obj = son; objBtn.AddClickListener(); //btn.onClick.AddListener(()=>Show(obj)); } }
public void OpenPanel(C_NavigationObj obj) { OpenPanel(obj.layer); }