Ejemplo n.º 1
0
 /// <summary>
 /// 按layer入栈
 /// </summary>
 /// <param name="uilevel"></param>
 /// <param name="ui"></param>
 public void OnCreatUI(int uilevel, IUIBehaviour ui, string uiBehaviourName)
 {
     if (Push(uilevel, ui))
     {
         mAllUIStackSite.Add(uiBehaviourName, uilevel);
     }
 }
Ejemplo n.º 2
0
        /// <summary>
        /// 隐藏UI
        /// </summary>
        /// <param name="uiBehaviourName"></param>
        public void HideUI(string uiBehaviourName)
        {
            IUIBehaviour uiBehaviour = null;

            if (mAllUI.TryGetValue(uiBehaviourName, out uiBehaviour))
            {
                uiBehaviour.Hide();
            }
        }
Ejemplo n.º 3
0
        public void CloseLastUI(int uilevel)
        {
            IUIBehaviour ui = GetLastUI(uilevel);

            if (ui != null)
            {
                QUIManager.Instance.CloseUI(ui.Transform.gameObject.name);
            }
        }
Ejemplo n.º 4
0
		/// <summary>
		/// 获取UIBehaviour
		/// </summary>
		/// <param name="uiBehaviourName"></param>
		/// <returns></returns>
		public UIPanel GetUI(string uiBehaviourName)
		{
			IUIBehaviour retUiBehaviour = null;
			if (mAllUI.TryGetValue(uiBehaviourName, out retUiBehaviour))
			{
				return retUiBehaviour as UIPanel;
			}
			return null;
		}
Ejemplo n.º 5
0
        /// <summary>
        /// 获取UIBehaviour
        /// </summary>
        /// <param name="uiBehaviourName"></param>
        /// <returns></returns>
        public QUIBehaviour GetUI(string uiBehaviourName)
        {
            IUIBehaviour retUiBehaviour = null;

            if (mAllUI.TryGetValue(uiBehaviourName, out retUiBehaviour))
            {
                return(retUiBehaviour as QUIBehaviour);
            }
            return(null);
        }
Ejemplo n.º 6
0
        public void RemoveUI(string uiName, IUIBehaviour ui)
        {
            var uilevel = GetUILevel(uiName);

            if (mAllStack.ContainsKey(uilevel))
            {
                mAllStack[uilevel].Remove(ui);
                mAllUIStackSite.Remove(uiName);
            }
        }
Ejemplo n.º 7
0
		/// <summary>
		/// 隐藏UI
		/// </summary>
		/// <param name="uiBehaviourName"></param>
		public void HideUI(string uiBehaviourName)
		{
			IUIBehaviour uiBehaviour = null;
			if (mAllUI.TryGetValue(uiBehaviourName, out uiBehaviour))
			{
				uiBehaviour.Hide();
                mLayerLogic.OnUIPanelHide(uiBehaviour as UIPanel);
                ReSetLayerIndexDirty();
            }
		}
Ejemplo n.º 8
0
        /// <summary>
        /// 显示UIBehaiviour
        /// </summary>
        /// <param name="uiBehaviourName"></param>
        public void ShowUI(string uiBehaviourName)
        {
            IUIBehaviour uiBehaviour = null;

            if (mAllUI.TryGetValue(uiBehaviourName, out uiBehaviour))
            {
                uiBehaviour.Show();
                mLayerLogic.OnUIPanelShow(uiBehaviour as QUIBehaviour);
                ReSetLayerIndexDirty();
            }
        }
Ejemplo n.º 9
0
        /// <summary>
        /// 关闭并卸载UI
        /// </summary>
        /// <param name="behaviourName"></param>
        public void CloseUI(string behaviourName)
        {
            IUIBehaviour behaviour = null;

            mAllUI.TryGetValue(behaviourName, out behaviour);

            if (null != behaviour)
            {
                behaviour.Close();
                mAllUI.Remove(behaviourName);
            }
        }
Ejemplo n.º 10
0
        private bool Push(int uilevel, IUIBehaviour ui)
        {
            if (!mAllStack.ContainsKey(uilevel))
            {
                mAllStack.Add(uilevel, new List <IUIBehaviour>());
            }
            if (!mAllStack[uilevel].Contains(ui))
            {
                mAllStack[uilevel].Add(ui);
                return(true);
            }

            return(false);
        }
Ejemplo n.º 11
0
        /// <summary>
        /// 关闭并卸载UI
        /// </summary>
        /// <param name="behaviourName"></param>
        public void CloseUI(string behaviourName)
        {
            IUIBehaviour behaviour = null;

            mAllUI.TryGetValue(behaviourName, out behaviour);

            if (null != behaviour)
            {
                behaviour.Close();
                mAllUI.Remove(behaviourName);
                mUIPanelStack.RemoveUI(behaviourName, behaviour);
                mLayerLogic.OnUIPanelClose(behaviour as QUIBehaviour);
                ReSetLayerIndexDirty();
            }
        }
Ejemplo n.º 12
0
        public void SetLayer(int uiLevel, IUIBehaviour ui)
        {
            switch (uiLevel)
            {
            case UILevel.Bg:
                ui.Transform.SetParent(mBgTrans);
                break;

            case UILevel.AnimationUnderPage:
                ui.Transform.SetParent(mAnimationUnderPageTrans);
                break;

            case UILevel.Common:
                ui.Transform.SetParent(mCommonTrans);
                break;

            case UILevel.AnimationOnPage:
                ui.Transform.SetParent(mAnimationOnPageTrans);
                break;

            case UILevel.PopUI:
                ui.Transform.SetParent(mPopUITrans);
                break;

            case UILevel.Const:
                ui.Transform.SetParent(mConstTrans);
                break;

            case UILevel.Toast:
                ui.Transform.SetParent(mToastTrans);
                break;

            case UILevel.Forward:
                ui.Transform.SetParent(mForwardTrans);
                break;
            }

            var uiGoRectTrans = ui.Transform as RectTransform;

            uiGoRectTrans.offsetMin          = Vector2.zero;
            uiGoRectTrans.offsetMax          = Vector2.zero;
            uiGoRectTrans.anchoredPosition3D = Vector3.zero;
            uiGoRectTrans.anchorMin          = Vector2.zero;
            uiGoRectTrans.anchorMax          = Vector2.one;

            ui.Transform.LocalScaleIdentity();
        }