Ejemplo n.º 1
0
 /// <summary>
 /// Kills this dialog box
 /// </summary>
 /// <param name="baseObject"></param>
 private void CloseDialogBox(BaseObject baseObject)
 {
     Die();
 }
Ejemplo n.º 2
0
 /// <summary>
 /// An empty pass through event to use for objects that obtain the ClickableModule by inheritance, but have no click function themselves
 /// </summary>
 /// <param name="clickedObject"></param>
 public static void EmptyClick(BaseObject clickedObject)
 {
 }
Ejemplo n.º 3
0
 public Collider(BaseObject parent)
 {
     Parent = parent;
 }
 /// <summary>
 /// When we click the options button, we add some dialog for the options and hide this dialog.
 /// </summary>
 /// <param name="clickedObject"></param>
 protected void AddOptionsDialog(BaseObject clickedObject)
 {
     Hide();
     OptionsDialog.Show();
 }
 /// <summary>
 /// When we click the quit to lobby button, we want to stop the current game and go back to the lobby screen.
 /// </summary>
 /// <param name="clickedObject"></param>
 protected virtual void QuitToLobby(BaseObject clickedObject)
 {
 }
 /// <summary>
 /// When we click the quit to desktop button, we want to stop the current game and quit to desktop.
 /// </summary>
 /// <param name="clickedObject"></param>
 protected void QuitToDesktop(BaseObject clickedObject)
 {
     ScreenManager.Instance.EndGame();
 }
 /// <summary>
 /// If we click the resume button, we hide this dialog and the options dialog and resume the game.
 /// </summary>
 /// <param name="clickedObject"></param>
 private void ResumeGame(BaseObject clickedObject)
 {
     Hide();
     OptionsDialog.Hide();
 }
Ejemplo n.º 8
0
 /// <summary>
 /// Removes an InGameUIObject from this screen's InGameUIObjects manager
 /// </summary>
 /// <param name="uiObjectToRemove"></param>
 public void RemoveInGameUIObject(BaseObject uiObjectToRemove)
 {
     InGameUIObjects.RemoveChild(uiObjectToRemove);
 }
Ejemplo n.º 9
0
 /// <summary>
 /// Removes a ScreenUIObject from this screen's ScreenUIObjects manager
 /// </summary>
 /// <param name="uiObjectToRemove"></param>
 public void RemoveScreenUIObject(BaseObject uiObjectToRemove)
 {
     ScreenUIObjects.RemoveChild(uiObjectToRemove);
 }
Ejemplo n.º 10
0
 /// <summary>
 /// Removes a GameObject from this screen's GameObjects manager
 /// </summary>
 /// <param name="gameObjectToRemove">The game object to remove</param>
 public void RemoveGameObject(BaseObject gameObjectToRemove)
 {
     GameObjects.RemoveChild(gameObjectToRemove);
 }
Ejemplo n.º 11
0
 /// <summary>
 /// Removes a UIObject from this screen's EnvironmentObjects manager
 /// </summary>
 /// <param name="environmentObjectToRemove">The environment object to remove</param>
 public void RemoveEnvironmentObject(BaseObject environmentObjectToRemove)
 {
     EnvironmentObjects.RemoveChild(environmentObjectToRemove);
 }
Ejemplo n.º 12
0
        /// <summary>
        /// The actual implementation of MoveNext stored in a separate function for convenience and recursive calling
        /// </summary>
        /// <returns></returns>
        private bool BreadthFirstImpl()
        {
            // Check to see whether we are at the root - we need to do custom behaviour here
            if (current == Root)
            {
                // If we have no children, we are done
                if (current.ChildrenCount == 0)
                {
                    return(false);
                }

                // Get the first child under the root
                current = current.FirstChild();
                CurrentLevel++;

                return(EitherCorrectTypeOrPerformImpl());
            }

            // We are not at the root, but have found a child not of type T

            // Run through our siblings until we have found a sibling of type T
            while (current.HasNextSibling)
            {
                current = current.NextSibling;
                return(EitherCorrectTypeOrPerformImpl());
            }

            // If our parent has another sibling who's children we need to iterate through, we go to that sibling and get it's first child
            BaseObject currentParent = current.Parent;

            if (currentParent.HasNextSibling)
            {
                while (currentParent.HasNextSibling)
                {
                    if (currentParent.NextSibling.ChildrenCount > 0)
                    {
                        current = currentParent.NextSibling.FirstChild();
                        return(EitherCorrectTypeOrPerformImpl());
                    }

                    // Move to the next sibling
                    currentParent = currentParent.NextSibling;
                }
            }

            // None of the siblings on this level are of type T

            // Later on instead of moving up one, we need to move down from the root the number of levels we are in - 1

            // Find the first sibling of our current which has children - we do this by going to the root and iterating down to the level we were at
            // Only go through the nodes with children
            current = Root;
            for (int i = 0; i < CurrentLevel; i++)
            {
                current = current.FindChild <BaseObject>(x => x.ChildrenCount > 0);
            }

            if (current == null)
            {
                // If no siblings exist with children, we are done
                return(false);
            }

            // Get the first child under the first sibling with children
            current = current.FirstChild();
            CurrentLevel++;

            return(EitherCorrectTypeOrPerformImpl());
        }
Ejemplo n.º 13
0
 public BaseObjectIterator(BaseObject root)
 {
     Root         = root;
     current      = root;
     CurrentLevel = 0;
 }
Ejemplo n.º 14
0
 /// <summary>
 /// Resets our iterator to the top of our hierarchy
 /// </summary>
 public void Reset()
 {
     current      = Root;
     CurrentLevel = 0;
 }