/// <summary> /// check has exist <paramref name="uniPopupHandler"/> in active stack /// </summary> /// <param name="uniPopupHandler"></param> /// <returns></returns> public bool HasPoup(IUniPopupHandler uniPopupHandler) { foreach (var handler in _stacks) { if (handler == uniPopupHandler) { return(true); } } return(false); }
/// <summary> /// show popup /// </summary> /// <param name="uniPopupHandler">popup wanna show</param> public void Show(IUniPopupHandler uniPopupHandler) { var lastOrder = 0; if (_stacks.Count > 0) { var top = _stacks.Peek(); lastOrder = top.Canvas.sortingOrder; } uniPopupHandler.UpdateSortingOrder(lastOrder + 10); SortingOrder.OnNext(lastOrder); _stacks.Push(uniPopupHandler); uniPopupHandler.Show(); // show }
/// <summary> /// show popup and hide previous popup /// </summary> /// <param name="uniPopupHandler">popup wanna show</param> /// <param name="number">number previous popup wanna hide</param> public void Show(IUniPopupHandler uniPopupHandler, int number) { if (number > _stacks.Count) { number = _stacks.Count; } for (int i = 0; i < number; i++) { var p = _stacks.Pop(); p.Close(); } Show(uniPopupHandler); }
/// <summary> /// show popup and hide all previous popup /// </summary> /// <param name="uniPopupHandler">popup wanna show</param> public void ShowAndHideAll(IUniPopupHandler uniPopupHandler) { Show(uniPopupHandler, _stacks.Count); }