public void SetCurrScene(GameObject sceneGo)
 {
     CurrActiveScene = _Add(sceneGo);
     //
     for (int i = 0; i < sceneUnits.Count; ++i)
     {
         UIAPI.SetVisible(sceneUnits[i].scene, (sceneUnits[i] == CurrActiveScene) || (sceneUnits[i] == Logic));
     }
 }
Ejemplo n.º 2
0
        // 当新用户首次登录游戏时(对于老用户而言,也须强制弹出一次)
        public void FirstOnceShowProtocol()
        {
            if (_OpenedUseProtocolObj == null)
            {
                _OpenedUseProtocolObj = NGUITools.AddChild(this.gameObject, UseProtocol);

                if (_OpenedUseProtocolObj != null)
                {
                    // 取得当前最大depth值
                    UIPanel[] panels = this.gameObject.GetComponentsInChildren <UIPanel>(true);
                    int       depth  = 0;
                    for (int i = 0; i < panels.Length; ++i)
                    {
                        UIPanel p = panels[i];
                        depth = Mathf.Max(p.depth, depth);
                    }

                    // 重新给新加进来的panel赋值
                    panels = _OpenedUseProtocolObj.GetComponentsInChildren <UIPanel>(true);
                    if (panels != null)
                    {
                        List <UIPanel> addPanels = new List <UIPanel>(panels);
                        addPanels.Sort((UIPanel p1, UIPanel p2) =>
                        {
                            if (p1 == null)
                            {
                                return(1);
                            }
                            if (p2 == null)
                            {
                                return(-1);
                            }
                            return(p1.depth - p2.depth);
                        });
                        for (int i = 0; i < addPanels.Count; ++i)
                        {
                            UIPanel p = panels[i];
                            p.depth = depth + i;
                        }
                    }
                }
            }

            UIAPI.SetVisible(_OpenedUseProtocolObj, true);
        }