Exemple #1
0
        //对于Fill层,不允许同时显示多个全屏界面,同时按照互斥级别处理显示
        protected override bool CheckWndLayerState(bool visible)
        {
            //不允许同时显示多个全屏界面
            if (GetLayer() == WndLayerDef.WND_LAYER_FILL && visible)
            {
                RectTransform rect = UISystem.Instance.GetWndLayerTrans(WndLayerDef.WND_LAYER_FILL);
                for (int i = 0; i < rect.childCount; ++i)
                {
                    Transform r = rect.GetChild(i);
                    if (r != null)
                    {
                        IUIWndView wnd = r.GetComponent <IUIWndView>();
                        if (wnd != null && wnd.GetUIWnd().IsVisible())
                        {
                            //如果希望显示的界面互斥级别高于正在显示的,则隐藏正在显示的Fill层界面
                            if (GetMutexLevel() >= wnd.GetUIWnd().GetMutexLevel())
                            {
                                wnd.GetUIWnd().SetVisible(false);
                                return(true);
                            }//否则不允许显示
                            else
                            {
                                return(false);
                            }

                            #region 暂不用
                            //Func<bool> resetCurrentFillWnd = () =>
                            //{
                            //    wnd.GetUIWnd().SetVisible(false);
                            //    SetVisibleEx(visible);
                            //    return true;
                            //};

                            //TooltipAndDialog.UIDialogData data = new TooltipAndDialog.UIDialogData(
                            //                       title: "警告",
                            //                       message: "该操作将会离开房间界面",
                            //                       buttons: new UIWidgets.DialogActions() { { "确认", resetCurrentFillWnd } ,
                            //                                       {"取消",null } },
                            //                       modal: true
                            //                       );
                            //UISystem.Instance.SendWndMessage(WndMsgID.WND_MSG_COMMON_DIALOG, data);

                            //return;
                            #endregion
                        }
                    }
                }
            }
            return(true);
        }
Exemple #2
0
        protected bool CheckShowCursorByWNDLayer(WndLayerDef _eLayer)
        {
            RectTransform layerTrans = m_layerTransform[(int)_eLayer];

            if (layerTrans == null)
            {
                return(false);
            }

            for (int i = layerTrans.childCount - 1; i >= 0; --i)
            {
                Transform wndViewTrans = layerTrans.GetChild(i);
                if (wndViewTrans.gameObject.activeSelf)
                {
                    IUIWndView view = wndViewTrans.GetComponent <IUIWndView>();
                    if (view != null)
                    {
                        IUIWnd wnd = view.GetUIWnd();
                        if (wnd.IsCanCloseKey() || _eLayer == WndLayerDef.WND_LAYER_FILL)
                        {
                            return(true);
                        }
                    }
                }
            }
            return(false);
        }
Exemple #3
0
        /// <summary>
        /// 设置某互斥界面单独显示
        /// </summary>
        /// <param name="_wndView">界面</param>
        /// <param name="_eWndLayerNotVisible">处理层</param>
        internal void SetMutexWndVisbleAlone(IUIWndView _wndView, params WndLayerDef[] _eWndLayerNotVisible)
        {
            if (_wndView == null)
            {
                return;
            }

            foreach (WndLayerDef layerDef in _eWndLayerNotVisible)
            {
                RectTransform LayerTrans = GetWndLayerTrans(layerDef);
                if (LayerTrans != null)
                {
                    for (int i = LayerTrans.childCount - 1; i >= 0; --i)
                    {
                        Transform childTrans = LayerTrans.GetChild(i);
                        if (childTrans == null)
                        {
                            continue;
                        }

                        IUIWndView wndView = childTrans.GetComponent <IUIWndView>();
                        if (wndView == null)
                        {
                            continue;
                        }

                        if (wndView != _wndView && wndView.GetUIWnd().GetMutexLevel() > WndMutexLevelDef.WND_Mutex_None)
                        {
                            if (_wndView.GetUIWnd().GetMutexLevel() >= wndView.GetUIWnd().GetMutexLevel())
                            {
                                if (wndView.IsVisible())
                                {
                                    wndView.GetUIWnd().SetVisible(false);
                                }
                            }
                        }
                    }
                }
            }
        }
Exemple #4
0
        public static void RegisterWndViewForLayer(IUIWndView _uView)
        {
            if (_uView.GetTransform() == null || _uView.GetUIWnd() == null)
            {
                return;
            }
            USpeedUILayerElement viewLayerElement = _uView.GetTransform().GetComponent <USpeedUILayerElement>() ?? _uView.GetTransform().gameObject.AddComponent <USpeedUILayerElement>();

            viewLayerElement.UILayerElementType  = USpeedUILayerElement.EUILayerElementType.ELET_UI;
            viewLayerElement.IsUIRequirRaycaster = true;

            //重新调整canvas的Sorting信息
            //viewLayerElement = true;

            //调整SortingLayer,目前都统一用一个Layer,layer多的话会影响渲染效率
            viewLayerElement.SortingLayerName = CalculateLayerName(_uView.GetUIWnd().GetLayer());
            //调整SortingOrder
            viewLayerElement.SortingLayerOrder = CheckSortingOrderRange(CalculateWndViewLayerOrder(_uView));

            //计算Layer的Z轴坐标 layerDef越大,越靠近相机
            //Vector3 tmpPos = _nLayer.GetTransform.localPosition;
            //tmpPos.z = ((int)WndLayerDef.WND_LAYER_MAX - (int)_nLayerDef) * LayerZAxisDistance;
            //_nLayer.GetTransform.localPosition = tmpPos;
        }
Exemple #5
0
        // 处理按下关闭窗口键
        private void OnPressCloseKey()
        {
            int layer = (int)WndLayerDef.WND_LAYER_MAX - 1;

            for (; layer >= 0; --layer)
            {
                RectTransform layerTrans = m_layerTransform[layer];
                if (layerTrans == null)
                {
                    continue;
                }

                for (int i = layerTrans.childCount - 1; i >= 0; --i)
                {
                    Transform wndViewTrans = layerTrans.GetChild(i);
                    if (wndViewTrans.gameObject.activeSelf)
                    {
                        IUIWndView view = wndViewTrans.GetComponent <IUIWndView>();
                        if (view != null)
                        {
                            IUIWnd wnd = view.GetUIWnd();
                            if (wnd != null)
                            {
                                if (wnd.HaveEscCallBack())
                                {
                                    wnd.OnEscCallBack();
                                    return;
                                }
                                if (wnd.OnCloseKey())
                                {
                                    wnd.SetVisible(false);
                                    return;
                                }
                            }
                        }
                    }
                }
            }
            //如果目前没有窗口需要关闭,则打开系统设置界面
            SendWndMessage(WndMsgID.WND_MSG_SYSTEMSETTING_SHOW, null);
        }