예제 #1
0
        static void onGetSharedAssets(params object[] param)
        {
            if (param == null)
            {
                Debug.LogWarning("param == null");
                return;
            }
            NewList list = (NewList)(param[0]);

            if (list.Count >= 3)
            {
                object      cb   = list[0];
                CLPanelBase p    = list[1] as CLPanelBase;
                object      orgs = list[2];
                if (cb != null)
                {
                    Utl.doCallback(cb, p, orgs);
                }
            }
            else
            {
                Debug.LogWarning("list.Count ====0");
            }
            ObjPool.listPool.returnObject(list);
        }
예제 #2
0
        public static void onShowPanel(CLPanelBase panel)
        {
            if (panel == null)
            {
                return;
            }
            showingPanels[panel.gameObject.name] = panel;
            panelCacheQueue.Remove(panel);
            panelCacheQueue.Insert(0, panel);
            CLPanelBase bottomPanel = null;

            if (panelCacheQueue.Count > self.cachePanelSize)
            {
                bottomPanel = (panelCacheQueue[panelCacheQueue.Count - 1]) as CLPanelBase;
                panelCacheQueue.RemoveAt(panelCacheQueue.Count - 1);
                if (bottomPanel.destroyWhenHide)
                {
                    if (!bottomPanel.isActive && !CLPanelManager.panelRetainLayer.Contains(bottomPanel))
                    {
                        //虽然页面是关掉了,但是如果还是在panelRetainLayer里,则不能删除,因为当关掉顶层页面时,这个页面还是会被打开
                        CLPanelManager.destroyPanel(bottomPanel, false);
                    }
                }
            }
        }
예제 #3
0
 public static void showPanel(CLPanelBase panel)
 {
     //if(panel == null) return;
     //Debug.LogError("====show panel==="+panel.name);
     seaShowPanel.Enqueue(panel);
     isShowPanel = true;
 }
예제 #4
0
        public static void doShowTopPanel(CLPanelBase panel, bool isRetainCurr, bool isShowCurr, bool immed)
        {
            //        yield return null;
            isShowPrePanel = isShowCurr;
            oldoldPanel    = oldPanel;
            if (panelRetainLayer.Count > 0)
            {
                if (!isRetainCurr)
                {
                    self.depth -= depthOffset;
                    self.depth  = self.depth < depthOffset ? depthOffset : self.depth;
                    oldPanel    = panelRetainLayer.Pop();
                }
                else
                {
                    oldPanel = panelRetainLayer.Peek();
                }
            }
            else
            {
                oldPanel = null;
            }
            panelRetainLayer.Push(panel);
            //		if (isShowCurr) {
            //			self.depth += 10;
            //		}

            topPanel       = panel;
            isShowTopPanel = true;
            if (immed)
            {
                self.Update();
            }
        }
예제 #5
0
        public void _show(object callback, List <string> list)
        {
            NGUITools.SetActive(gameObject, true);
            List <string> tmplist = defautSpriteNameList;

            if (list != null && list.Count > 0)
            {
                tmplist = list;
            }
            if (tmplist != null && tmplist.Count > 0)
            {
                int index = NumEx.NextInt(0, tmplist.Count);
                CLUIUtl.setSpriteFit(sprite, tmplist [index]);
            }

            finishCallback = callback;
//		NGUITools.SetActive (label.gameObject, false);
            tweenAlpha.Play(true);

            CLPanelBase p = CLPanelManager.topPanel;

            panel.depth       = p == null ? 3000 : p.panel.depth + CLPanelManager.depthOffset + 100;
            panel.renderQueue = UIPanel.RenderQueue.StartAt;
            // 设置startingRenderQueue是为了可以在ui中使用粒子效果,注意在粒子中要绑定CLUIParticle角本
            panel.startingRenderQueue = CLPanelManager.Const_RenderQueue + this.panel.depth;
        }
예제 #6
0
 public static void hidePanel(CLPanelBase panel)
 {
     //if(panel == null) return;
     //Debug.LogError("====hide panel==="+panel.name);
     seaHidePanel.Enqueue(panel);
     isHidePanel = true;
     self.Update();
 }
예제 #7
0
 public static void onHidePanel(CLPanelBase panel)
 {
     if (panel == null)
     {
         return;
     }
     showingPanels.Remove(panel.gameObject.name);
 }
예제 #8
0
        void CLPBackplateProc(CLPanelBase p)
        {
            CLPanelBase panel = getPanel("PanelBackplate");

            if (panel == null)
            {
                return;
            }
            CLPBackplate.self.proc(p);
        }
예제 #9
0
 public void clean()
 {
     panelBuff.Clear();
     panelAssetBundle.Clear();
     panelCacheQueue.Clear();
     showingPanels.Clear();
     topPanel      = null;
     isFinishStart = false;
     mask.SetActive(false);
 }
예제 #10
0
 public override void onTopPanelChange(CLPanelBase p)
 {
     try {
         if (lfonTopPanelChange != null)
         {
             call(lfonTopPanelChange, p);
         }
     } catch (System.Exception e) {
         Debug.LogError(e);
     }
 }
예제 #11
0
        public static void destoryAllPanel()
        {
            ArrayList list = new ArrayList();

            list.AddRange(panelAssetBundle.Values);
            for (int i = 0; i < list.Count; i++)
            {
                destroyPanel((CLPanelBase)(list [i]));
            }
            panelRetainLayer.Clear();
            topPanel = null;
        }
예제 #12
0
        public static void onGetCalenderPanel(params object[] orgs)
        {
            CLPanelBase p    = orgs [0] as CLPanelBase;
            ArrayList   list = orgs [1] as ArrayList;

            if (p == null)
            {
                return;
            }
            p.setData(list);
            CLPanelManager.showPanel(p);
        }
예제 #13
0
        public void _proc(CLPanelBase clpanel)
        {
            setData(clpanel);
            show();
            this.panel.depth = clpanel.panel.depth - 1;
            Vector3 pos = transform.localPosition;

            this.panel.renderQueue = UIPanel.RenderQueue.StartAt;
            // 设置startingRenderQueue是为了可以在ui中使用粒子效果,注意在粒子中要绑定CLUIParticle角本
            this.panel.startingRenderQueue = CLPanelManager.Const_RenderQueue + this.panel.depth;
            pos.z = -180;
            transform.localPosition = pos;
        }
예제 #14
0
        //关闭所有层**********************************************************************
        public static void hideAllPanel(string exceptPanelName = null)
        {
            CLPanelBase p = null;

            oldPanel    = null;
            oldoldPanel = null;
            CLPanelBase exceptPanel = null;
            int         count       = panelRetainLayer.Count;

            for (int i = 0; i < count; i++)
            {
                p = panelRetainLayer.Pop();
                if (p.name.Equals(exceptPanel))
                {
                    exceptPanel = p;
                    self.depth -= depthOffset;
                    self.depth  = self.depth < depthOffset ? depthOffset : self.depth;
                }
                else
                {
                    self.depth -= depthOffset;
                    self.depth  = self.depth < depthOffset ? depthOffset : self.depth;
                    seaHidePanel.Enqueue(p);
                    isHidePanel = true;
                }
            }
            if (exceptPanel != null)
            {
                panelRetainLayer.Push(exceptPanel);
                exceptPanel.depth = self.depth;
            }

            oldPanel    = null;
            oldoldPanel = null;
            self.mask.SetActive(false);
            self.Update();

            foreach (DictionaryEntry cell in panelBuff)
            {
                p = cell.Value as CLPanelBase;
                if (p != null && p.gameObject.activeInHierarchy)
                {
                    if (!p.name.Equals(exceptPanel))
                    {
                        hidePanel(p);
                    }
                }
            }
        }
예제 #15
0
 public void Start()
 {
     if (!isFinishStart)
     {
         for (int i = 0; i < uiPanelRoot.childCount; i++)
         {
             CLPanelBase p = uiPanelRoot.GetChild(i).GetComponent <CLPanelBase>();
             if (p != null)
             {
                 panelBuff[p.name] = p;
             }
         }
         isFinishStart = true;
     }
 }
예제 #16
0
파일: CLMainBase.cs 프로젝트: coolape/mibao
        // Use this for initialization
        public override void Start()
        {
            DateEx.init();
            // 显示公司logo页面
            CLPanelBase panel = CLPanelManager.getPanel(firstPanel);

            try {
                CLPanelManager.showPanel(panel);
                //		SoundEx.playSound ("Coolape", 1);
                // 初始化
                StartCoroutine(gameInit());
            } catch (System.Exception e) {
                Debug.LogError(e);
            }
        }
예제 #17
0
 public void proc(CLPanelBase clpanel)
 {
     if (clpanel == null)
     {
         procOtherPanel();
         return;
     }
     if (clpanel.isNeedBackplate)
     {
         _proc(clpanel);
     }
     else
     {
         procOtherPanel();
     }
 }
예제 #18
0
        public static void destroyPanel(CLPanelBase p, bool needCallHideFunc)
        {
            if (p == null || p.name == CLMainBase.self.firstPanel)
            {
                return;
            }
            string pName = p.name;

            panelBuff.Remove(pName);
            panelAssetBundle.Remove(pName);
            if (needCallHideFunc)
            {
                p.hide();
            }
            GameObject.DestroyImmediate(p.gameObject, true);
            p = null;
        }
예제 #19
0
        public static void rmPanelRetainLayer(CLPanelBase panel)
        {
            Stack <CLPanelBase> tmpStack = new Stack <CLPanelBase>();
            CLPanelBase         p        = null;

            while (panelRetainLayer.Count > 0)
            {
                p = panelRetainLayer.Pop();
                if (p != panel)
                {
                    tmpStack.Push(p);
                }
            }
            while (tmpStack.Count > 0)
            {
                panelRetainLayer.Push(tmpStack.Pop());
            }
        }
예제 #20
0
        //关闭所有层**********************************************************************
        public static void hideAllPanel()
        {
            oldPanel    = null;
            oldoldPanel = null;
            int count = panelRetainLayer.Count;

            for (int i = 0; i < count; i++)
            {
//				hideTopPanel (null, false, true);
                self.depth -= depthOffset;
                self.depth  = self.depth < depthOffset ? depthOffset : self.depth;
                seaHidePanel.Enqueue(panelRetainLayer.Pop());
                isHidePanel = true;
            }
            oldPanel    = null;
            oldoldPanel = null;
            self.mask.SetActive(false);
            self.Update();
        }
예제 #21
0
        public static void hideTopPanel(CLPanelBase panel, bool showMain, bool immed)
        {
            if (panel == null || (panelRetainLayer.Count > 0 && panelRetainLayer.Peek() == panel))
            {
                if (showMain && !string.IsNullOrEmpty(self.mainPanelName) &&
                    topPanel != null && string.Compare(self.mainPanelName, topPanel.name) == 0)
                {
                    topPanel.refresh();
                    return;
                }
                if (panelRetainLayer.Count > 0)
                {
                    self.depth -= depthOffset;
                    self.depth  = self.depth < depthOffset ? depthOffset : self.depth;
                    seaHidePanel.Enqueue(panelRetainLayer.Pop());
                    isHidePanel = true;
                }
                if (panelRetainLayer.Count > 0)
                {
                    isShowTopPanel = true;
                }
                else
                {
                    if (CLPBackplate.self != null)
                    {
                        CLPBackplate.self.proc(null);
                    }
                }
                oldPanel    = oldoldPanel;
                oldoldPanel = null;
            }
            else
            {
                rmPanelRetainLayer(panel);
                seaHidePanel.Enqueue(panel);
                isHidePanel = true;
            }

            if (immed)
            {
                self.Update();
            }
        }
예제 #22
0
        public static CLPanelBase getPanel(string pName)
        {
            if (!isFinishStart)
            {
                CLPanelManager.self.Start();
            }
            if (panelBuff[pName] != null)
            {
                return((CLPanelBase)(panelBuff[pName]));
            }
#if UNITY_5_6_OR_NEWER
            Transform tr = self.transform.Find(pName);
#else
            Transform tr = self.transform.FindChild(pName);
#endif
            if (tr != null)
            {
                CLPanelBase p = tr.GetComponent <CLPanelBase>();
                if (p != null)
                {
                    panelBuff[pName] = p;
                    return(p);
                }
            }
            //		if (self.isUnity3dType) {
            //#if !UNITY_ANDROID
            //			string path = PStr.begin().a(PathCfg.persistentDataPath).a("/")
            //				.a(PathCfg.self.panelDataPath).a(PathCfg.self.platform).a("/").a(pName).a(".unity3d").end();
            //#if UNITY_EDITOR
            //			path = path.Replace("/upgradeRes/", "/upgradeRes4Publish/");
            //#endif
            //			AssetBundle ab = AssetBundle.LoadFromFile(path);
            //#if UNITY_EDITOR
            //			if(ab == null) {
            //				Debug.LogError(pName + " is null");
            //			}
            //#endif
            //			return onGetPanel(pName, ab, null, null);
            //#endif
            //		}
            return(null);
        }
예제 #23
0
        void onTopPanelChange(CLPanelBase p)
        {
            //			CLPanelBase[] ps = panelRetainLayer.ToArray ();
            //			if (ps != null) {
            //				for (int i = 0; i < ps.Length; i++) {
            //					ps [i].onTopPanelChange (p);
            //				}
            //			}
            ArrayList list = MapEx.vals2List(showingPanels);

            if (list != null)
            {
                for (int i = 0; i < list.Count; i++)
                {
                    ((CLPanelBase)(list[i])).onTopPanelChange(p);
                }
                list.Clear();
                list = null;
            }
        }
예제 #24
0
        public static void showConfirm(string msg, bool isShowOneButton, string button1,
                                       object callback1, string button2, object callback2)
        {
            CLPanelBase p = CLPanelManager.getPanel("PanelConfirm");

            if (p == null)
            {
                return;
            }
            ArrayList list = new ArrayList();

            list.Add(msg);
            list.Add(isShowOneButton);
            list.Add(button1);
            list.Add(callback1);
            list.Add(button2);
            list.Add(callback2);
            p.setData(list);
            CLPanelManager.showPanel(p);
        }
예제 #25
0
        public static void finishGetPanel(string pName, AssetBundle ab, object callback, object paras)
        {
            if (ab != null)
            {
                GameObject prefab = ab.mainAsset as GameObject;
                ab.Unload(false);
                ab = null;
                GameObject go = GameObject.Instantiate(prefab) as GameObject;
                go.name                    = pName;
                go.transform.parent        = self.transform;
                go.transform.localScale    = Vector3.one;
                go.transform.localPosition = Vector3.zero;

                CLPanelBase p = go.GetComponent <CLPanelBase>();
                if (p.isNeedResetAtlase)
                {
                    CLUIUtl.resetAtlasAndFont(p.transform, false);
                }
                panelBuff[pName]        = p;
                panelAssetBundle[pName] = p;

                CLSharedAssets sharedAsset = go.GetComponent <CLSharedAssets>();
                if (sharedAsset != null)
                {
                    NewList param = ObjPool.listPool.borrowObject();
                    param.Add(callback);
                    param.Add(p);
                    param.Add(paras);
                    sharedAsset.init((Callback)onGetSharedAssets, param, null);
                }
                else
                {
                    if (p != null)
                    {
                        Utl.doCallback(callback, p, paras);
                    }
                }
            }
            NGUITools.SetActive(self.mask, false);
            return;// null;
        }
예제 #26
0
        public static void getPanelAsy(string pName, object callback, object paras)
        {
            NGUITools.SetActive(self.mask, true);
            if (!isFinishStart)
            {
                CLPanelManager.self.Start();
            }
            CLPanelBase p = null;

            if (panelBuff[pName] != null)
            {
                p = ((CLPanelBase)(panelBuff[pName]));
            }
            if (p == null)
            {
#if UNITY_5_6_OR_NEWER
                Transform tr = self.transform.Find(pName);
#else
                Transform tr = self.transform.FindChild(pName);
#endif
                if (tr != null)
                {
                    p = tr.GetComponent <CLPanelBase>();
                    if (p != null)
                    {
                        panelBuff[pName] = p;
                    }
                }
            }

            if (p != null)
            {
                Utl.doCallback(callback, p, paras);
                NGUITools.SetActive(self.mask, false);
            }
            else
            {
                self.StartCoroutine(loadPanel(pName, callback, paras));
            }
        }
예제 #27
0
 public virtual void onTopPanelChange(CLPanelBase p)
 {
     //TODO:
 }
예제 #28
0
 public static void destroyPanel(CLPanelBase p)
 {
     destroyPanel(p, true);
 }
예제 #29
0
        public void Update()
        {
            if (isShowPanel)
            {
                isShowPanel = false;
                CLPanelBase p = seaShowPanel.Dequeue();
                if (p != null)
                {
                    p.show();
                    p.panel.renderQueue = UIPanel.RenderQueue.StartAt;
                    // 设置startingRenderQueue是为了可以在ui中使用粒子效果,注意在粒子中要绑定CLUIParticle角本
                    p.panel.startingRenderQueue = Const_RenderQueue + p.panel.depth;
                }
                if (seaShowPanel.Count > 0)
                {
                    isShowPanel = true;
                }
            }

            if (isHidePanel)
            {
                isHidePanel = false;
                CLPanelBase p = seaHidePanel.Dequeue();
                if (p != null)
                {
                    p.hide();
                }
                if (seaHidePanel.Count > 0)
                {
                    isHidePanel = true;
                }
                else
                {
                    CLPBackplateProc(null);
                }
            }

            if (isShowTopPanel)
            {
                isShowTopPanel = false;

                if (oldPanel != null)
                {
                    if (!isShowPrePanel)
                    {
                        oldPanel.hide();
                        if (oldoldPanel != null)
                        {
                            //							Vector3 newPos = oldoldPanel.transform.localPosition;
                            //							oldoldPanel.transform.localPosition = newPos;
                            oldPanel    = oldoldPanel;
                            oldoldPanel = null;
                        }
                    }
                    else
                    {
                        //						Vector3 newPos = oldPanel.transform.localPosition;
                        //						oldPanel.transform.localPosition = newPos;
                        //						if (oldoldPanel != null) {
                        //							newPos = oldoldPanel.transform.localPosition;
                        //							oldoldPanel.transform.localPosition = newPos;
                        //						}
                    }
                }
                //置顶的处理放在后面,防止oldoldPannel = curPannel的情况
                if (panelRetainLayer.Count > 0)
                {
                    //GlobalMemoryVar.curStatus.changeTo (GlobalMemoryVar.sNgui);
                    float panelZ = 0;
                    if (topPanel != null)
                    {
                        panelZ = topPanel.transform.localPosition.z;
                    }
                    topPanel = panelRetainLayer.Peek();
                    if (topPanel != null)
                    {
                        if (!topPanel.isActive)
                        {
                            depth         += depthOffset;
                            topPanel.depth = depth;
                            topPanel.show();
                        }
                        else
                        {
                            topPanel.depth = depth;
                            topPanel.refresh();
                        }
                        topPanel.panel.renderQueue = UIPanel.RenderQueue.StartAt;
                        // 设置startingRenderQueue是为了可以在ui中使用粒子效果,注意在粒子中要绑定CLUIParticle角本
                        topPanel.panel.startingRenderQueue = Const_RenderQueue + depth;

                        Vector3 newPos = topPanel.transform.localPosition;
                        newPos.z = -topPanel.depth;
                        topPanel.transform.localPosition = newPos;
                    }

                    CLPBackplateProc(topPanel);
                    onTopPanelChange(topPanel);
                }
                else
                {
                    CLPBackplateProc(null);
                }
            }
        }
예제 #30
0
 public static void hideTopPanel(CLPanelBase panel)
 {
     hideTopPanel(panel, true, true);
 }