Esempio n. 1
0
        /// <summary>
        /// 覆盖一个组
        /// </summary>
        /// <param name="prefabs"></param>
        /// <param name="destroyBefore"></param>
        public UIGroup Cover(IEnumerable <GameObject> prefabs, bool destroyBefore, params object[] args)
        {
            //关闭底下的界面
            if (this.Pages.Count > 0)              //栈里面有页面.
            {
                var lastPage = this.Pages.Peek();  //返回栈顶元素但是不弹出该元素.(最后一个显示出来的页面)
                lastPage.SendBeenCover();          //OnUIPause().
                foreach (var @group in lastPage)
                {
                    foreach (var uiPageItem in @group)
                    {
                        uiPageItem.Instance.SetActive(false);                        //禁用上一个Group.
//						Despawn(uiPageItem.Instance, destroyBefore);//这里不使用回收,为了避免复用之后,退回该界面状态丢失
                    }
                }
            }
            //生成新层
            UIPage newPage = new UIPage();

            this.Pages.Push(newPage);            //入栈.

            var newGroup = new UIGroup(this, prefabs);

            newPage.AddLast(newGroup);
            UpdateCanvasOrder();
            newGroup.SendEnterStack(args);
            return(newGroup);
        }
Esempio n. 2
0
        /// <summary>
        /// 覆盖一个组
        /// </summary>
        /// <param name="prefabs"></param>
        /// <param name="destroyBefore"></param>
        public UIGroup Cover(IEnumerable <GameObject> prefabs, bool destroyBefore)
        {
            //回收底下的界面
            if (this.Pages.Count > 0)
            {
                var lastPage = this.Pages.Peek();
                lastPage.SendBeenCover();
                foreach (var @group in lastPage)
                {
                    foreach (var uiPageItem in @group)
                    {
                        Despawn(uiPageItem.Instance, destroyBefore);
                    }
                }
            }
            //生成新层
            UIPage newPage = new UIPage();

            this.Pages.Push(newPage);

            var newGroup = new UIGroup(this, prefabs);

            newPage.AddLast(newGroup);
            UpdateCanvasOrder();
            newGroup.SendEnterStack();
            return(newGroup);
        }
Esempio n. 3
0
        /// <summary>
        /// 叠加一个组
        /// </summary>
        /// <param name="prefabs"></param>
        public UIGroup Overlay(IEnumerable <GameObject> prefabs, params object[] args)
        {
            if (this.Pages.Count == 0)
            {
                this.Pages.Push(new UIPage());
            }
            var page      = this.Pages.Peek();       //返回栈顶元素(不删除).
            var lastGroup = page.Last;

            if (lastGroup != null)
            {
                lastGroup.Value.SendBeenOverlay();  //不覆盖.
            }
            var group = new UIGroup(this, prefabs); //实例一个新组.

            page.AddLast(group);                    //添加到栈顶元素链表的末尾.
            UpdateCanvasOrder();
            group.SendEnterStack(args);             //执行--OnUIShow()
            return(group);
        }
Esempio n. 4
0
        /// <summary>
        /// 叠加一个组
        /// </summary>
        /// <param name="prefabs"></param>
        public UIGroup Overlay(IEnumerable <GameObject> prefabs)
        {
            if (this.Pages.Count == 0)
            {
                this.Pages.Push(new UIPage());
            }
            var page      = this.Pages.Peek();
            var lastGroup = page.Last;

            if (lastGroup != null)
            {
                lastGroup.Value.SendBeenOverlay();
            }
            var group = new UIGroup(this, prefabs);

            page.AddLast(group);
            UpdateCanvasOrder();
            group.SendEnterStack();
            return(group);
        }