Esempio n. 1
0
        public async virtual void Show(string uiName, Action complete = null)
        {
            if (!_views.ContainsKey(uiName))
            {
                var go = await Addressables.InstantiateAsync(uiName, _root).Task;

                _views[uiName] = GetNewView(uiName, go);
                SetLayerParent(_views[uiName], _layerMgr);
            }

            IView view  = _views[uiName];
            var   layer = view.Self.GetComponent <ILayer>();

            if (layer.Layer == UILayer.BASE_UI)
            {
                //正在显示的base界面隐藏
                if (_baseUiStack.Count > 0)
                {
                    _baseUiStack.Peek().Hide();
                }

                //显示当前要显示的界面
                UIStack group = new UIStack(uiName, view);
                _baseUiStack.Push(group);
            }
            else
            {
                _baseUiStack.Peek().Show(uiName, view);
            }

            if (complete != null)
            {
                complete();
            }
        }
Esempio n. 2
0
        public IView Show(string name, IView view)
        {
            var layer = view.Self.GetComponent <ILayer>();

            ShowAll();

            if (layer.Layer == _subLayer)
            {
                UIStack stack = new UIStack(name, view);
                _uiStack.Push(stack);
                _uiStack.Peek().Show();
            }
            else if (layer.Layer > _subLayer)
            {
                _uiStack.Peek().Show(name, view);
            }

            return(view);
        }