/// <summary> /// 置顶的方法 /// </summary> /// <param name="UIname">U iname.</param> public void UpUIPanel(string UIname) { if (UIStack.Count < 2) { return; } UIBase oldUI = UIStack.Peek(); oldUI.DoOnPausing(); UIBase UITarget = GetUIBase(UIname); List <UIBase> list = new List <UIBase> (UIStack.ToArray()); List <UIBase> li = new List <UIBase> (); for (int i = list.Count - 1; i >= 0; i--) { if (list [i].UIName != UIname) { li.Add(list[i]); } } li.Add(UITarget); UIStack.Clear(); int layer = 6; foreach (var item in li) { UIStack.Push(item); item.UILayer = layer; layer++; } UIStack.Peek().DoOnResuming(); }
//入栈,显示界面 public void PushUIPanel(string UIName) { if (UIStack.Count > 0) { UIBase old_topUI = UIStack.Peek(); old_topUI.DoOnPausing(); } UIBase new_topUI = GetUIBase(UIName); new_topUI.DoOnEntering(); UIStack.Push(new_topUI); }
/// <summary> /// 入栈 /// </summary> public UIBase PushUIPanel(string UIname) { if (UIStack.Count > 0) { UIBase old_topUI = UIStack.Peek(); old_topUI.DoOnPausing(); } UIBase new_topUI = GetUIBase(UIname); new_topUI.DoOnEntering(); UIStack.Push(new_topUI); foreach (string ui in currentUIDic.Keys) { if (ui == UIname) { return(new_topUI); } } new_topUI.UILayer = currentUIDic.Count; currentUIDic.Add(UIname, new_topUI); new_topUI.transform.SetSiblingIndex(new_topUI.UILayer); return(new_topUI); }