/// <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); } }
/// <summary> /// 隐藏UI /// </summary> /// <param name="uiBehaviourName"></param> public void HideUI(string uiBehaviourName) { IUIBehaviour uiBehaviour = null; if (mAllUI.TryGetValue(uiBehaviourName, out uiBehaviour)) { uiBehaviour.Hide(); } }
public void CloseLastUI(int uilevel) { IUIBehaviour ui = GetLastUI(uilevel); if (ui != null) { QUIManager.Instance.CloseUI(ui.Transform.gameObject.name); } }
/// <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; }
/// <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); }
public void RemoveUI(string uiName, IUIBehaviour ui) { var uilevel = GetUILevel(uiName); if (mAllStack.ContainsKey(uilevel)) { mAllStack[uilevel].Remove(ui); mAllUIStackSite.Remove(uiName); } }
/// <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(); } }
/// <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(); } }
/// <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); } }
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); }
/// <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(); } }
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(); }