private void AddTab(UIPanelBase panelBase) { if (rightTabs == null) { return; } rightTabs.transform.parent = panelBase.transform; rightTabs.transform.localPosition = Vector3.zero; rightTabs.SetActive(true); //清空功能页签 m_dicTabFunc.Clear(); int index = 1; Dictionary <int, UITabGrid> dicTabs = null; if (!panelBase.dicUITabGrid.TryGetValue(index, out dicTabs)) { dicTabs = new Dictionary <int, UITabGrid>(6); panelBase.dicUITabGrid.Add(index, dicTabs); } dicTabs.Clear(); UITabGrid grid = null; List <UIPanelManager.PanelTabData.PanelTabUnit> tabUnitDatas = panelBase.PanelInfo.PanelTaData.GetTabUnitList(); UIPanelManager.PanelTabData.PanelTabUnit tabUnit = null; List <int> activeTabIndex = new List <int>(); bool tabFuncOpen = false; for (int i = 0; i < panelBase.PanelInfo.PanelTaData.Count; i++) { tabUnit = tabUnitDatas[i]; grid = m_lstTabGrid[tabUnit.PosIndex]; if (grid == null) { continue; } if (!activeTabIndex.Contains(tabUnit.PosIndex)) { activeTabIndex.Add(tabUnit.PosIndex); } //grid.transform.parent = root; grid.gameObject.SetActive(true); // grid.transform.localPosition = new UnityEngine.Vector3(0, -i * 93, 0); grid.SetHightLight(false); grid.TabID = tabUnit.EnumValue; grid.TabType = index; grid.SetName(tabUnit.EnumName); dicTabs.Add(grid.TabID, grid); grid.SetRedPointStatus(false); grid.SetSoundEffectType(ButtonPlay.ButtonSountEffectType.FuncTabFirst); tabFuncOpen = DataManager.Manager <GuideManager>().IsTabFuncOpen(tabUnit.FuncID); grid.SetOpenStatus(tabFuncOpen); grid.gameObject.name = tabUnit.ObjName; if (!tabFuncOpen && tabUnit.FuncID != 0 && !m_dicTabFunc.ContainsKey(tabUnit.FuncID)) { m_dicTabFunc.Add(tabUnit.FuncID, grid); } grid.RegisterUIEventDelegate((eventType, data, param) => { switch (eventType) { case UIEventType.Click: if (data is UITabGrid) { UITabGrid tabGRid = data as UITabGrid; OnCilckTogglePanel(ref panelBase, grid.TabType, tabGRid.TabID); } break; default: break; } }); } coudsss++; for (int j = 0; j < m_lstTabGrid.Count; j++) { if (!activeTabIndex.Contains(j)) { m_lstTabGrid[j].gameObject.SetActive(false); } } }