Exemplo n.º 1
0
        private void UpdateNextElement()
        {
            for (int i = 0; i < 1; i++)
            {
                GuiElement current = Stack[i];

                GuiElement next = current.GetNextElement(AllElements);

                if (Stack.CanPush(next))
                {
                    // Only call OnExit() if this is the first new element.
                    bool invokeExit = Stack.Count == 1;

                    Stack.Push(next);
                    Console.WriteLine("Stack is now length " + Stack.Count);

                    if (invokeExit)
                    {
                        Stack.Current.OnExit();
                    }
                }
            }
        }
Exemplo n.º 2
0
 /// <summary>
 /// Returns true if given element can be pushed onto stack.
 /// </summary>
 public bool CanPush(GuiElement element)
 {
     return(element != null && !List.Contains(element));
 }
Exemplo n.º 3
0
 /// <summary>
 /// This function is called sequentially on every element in the containing state manager.
 /// <para>Return true to set the given element as the next element.</para>
 /// </summary>
 protected abstract bool NextElementSelector(GuiElement element);
Exemplo n.º 4
0
 /// <summary>
 /// Returns true if stack contains element.
 /// </summary>
 public bool Contains(GuiElement element) => List.Contains(element);