Пример #1
0
    /// <summary>
    ///
    /// </summary>
    /// <param name="panel"></param>
    /// <param name="nTabIndex">索引</param>
    /// <param name="nTabType">第几类页签</param>
    public void OnCilckTogglePanel(ref UIPanelBase panel, int nTabType, int nTabIndex)
    {
        if (null == panel)
        {
            return;
        }
        UIPanelManager.PanelTabData.PanelTabUnit unit = null;
        if (null == panel.PanelInfo || !panel.PanelInfo.PanelTaData.TryGetTabUnit(nTabIndex, out unit))
        {
            Engine.Utility.Log.Error("Panel LocalInfo Error id:{0}!", panel.PanelId);
            return;
        }
        int openLv = 0;

        if (!DataManager.Manager <GuideManager>().IsTabFuncOpen(unit.FuncID, out openLv))
        {
            TipsManager.Instance.ShowLocalFormatTips(LocalTextType.Trailer_Commond_xitongyeqiankaiqi, unit.EnumName, openLv);
            return;
        }
        bool reset = panel.OnTogglePanel(nTabType, nTabIndex);

        if (reset)
        {
            panel.dicActiveTabGrid[nTabType] = nTabIndex;
            Dictionary <int, UITabGrid> dicTabs = null;
            if (panel.dicUITabGrid.TryGetValue(nTabType, out dicTabs))
            {
                foreach (var item in dicTabs)
                {
                    item.Value.SetHightLight(item.Value.TabID == nTabIndex);
                }
            }
        }
    }
Пример #2
0
    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);
            }
        }
    }