Example #1
0
        /// <summary>
        /// Removes the top panel from the stack, with the given transition(s)
        /// </summary>
        /// <param name="transition">Type of transition(s) to play</param>
        /// <returns>The popped panel</returns>
        public IUIPanel Pop(Transition transition)
        {
            // pop top
            IUIPanel poppedPanel = m_stack.Pop();

            Assert.IsNotNull(poppedPanel, "UIStack.Pop: Top panel is null");
            poppedPanel.IsActive = false;
            poppedPanel.OnPop(BitField.IsFlagSet(transition, Transition.Outro));

            // show prev
            if (Count > 0)
            {
                IUIPanel newTop = Peek();
                Assert.IsNotNull(poppedPanel, "UIStack.Pop: New top panel is null");
                newTop.IsActive = true;
                newTop.OnShow(BitField.IsFlagSet(transition, Transition.Intro));
            }

            return(poppedPanel);
        }