public OverlayEconomyState()
        {
            // Add the end turn button
            buttonEndTurn = GuiButton.createButtonWithLabel(MaxOfEmpires.overlayPos.ToPoint(), "End turn", null, "font");
            addElement(buttonEndTurn);

            // Add a label showing whose turn it currently is
            labelCurrentPlayer = GuiLabel.createNewLabel(new Vector2(buttonEndTurn.Bounds.Right + 2, buttonEndTurn.Bounds.Top + 2), "Current player: ", "font");
            addElement(labelCurrentPlayer);

            // Add a label telling the player how much money they have
            labelPlayerMoney = GuiLabel.createNewLabel(new Vector2(labelCurrentPlayer.Bounds.Left, labelCurrentPlayer.Bounds.Bottom + 5), "Money: 0G", "font");
            addElement(labelPlayerMoney);

            labelPlayerMoneyPerTurn = GuiLabel.createNewLabel(new Vector2(labelCurrentPlayer.Bounds.Left, labelPlayerMoney.Bounds.Bottom + 5), "Money per turn: 0G", "font");
            addElement(labelPlayerMoneyPerTurn);

            // Add a label telling the player how much population they have
            labelPlayerPopulation = GuiLabel.createNewLabel(new Vector2(labelCurrentPlayer.Bounds.Left, labelPlayerMoneyPerTurn.Bounds.Bottom + 5), "Free Population: 0", "font");
            addElement(labelPlayerPopulation);

            // Add labels for unit stats
            listArmySoldiers = GuiList.createNewList(new Point(labelPlayerMoneyPerTurn.Bounds.Location.X, labelPlayerPopulation.Bounds.Bottom + 5), 5, new List <GuiElement>(), 300);
            listArmySoldiers.addElement(ElementArmySelection.CreateBuildButton(Point.Zero, "1", null, null)); // Add this so that the size is calculated correctly
            addElement(listArmySoldiers);

            buildingInfoPosition = new Point(buttonEndTurn.Bounds.Left, listArmySoldiers.Bounds.Bottom + listArmySoldiers.MaxHeight + 5);

            // Remove this label so that it doesn't display bullshit :)
            listArmySoldiers.removeElement(0);
        }
        private void UpdateArmyInformation(Army a)
        {
            listArmySoldiers.clear();
            foreach (string soldierType in a.UnitsAndCounts.Keys)
            {
                // Create the label to add to the list
                StringBuilder sb = new StringBuilder();
                sb.Append(Translations.GetTranslation(soldierType));
                sb.Append(": ");
                sb.Append(a.SelectedUnits[soldierType] + "/");
                sb.Append(a.UnitsAndCounts[soldierType]);

                // Add this label to the list
                listArmySoldiers.addElement(ElementArmySelection.CreateBuildButton(Point.Zero, sb.ToString(), AddSelected(soldierType, a), LowerSelected(soldierType, a)));
            }
        }
        /// <summary>
        /// Creates a new element with a label and a button, allowing a player to build a building using a builder.
        /// </summary>
        /// <param name="startPos">The starting position of this element on the screen.</param>
        /// <param name="unitNameWithCount">The string in the label.</param>
        /// <param name="addSelectionHandler">The click handler for the button.</param>
        /// <returns>The element with the label and the button.</returns>
        public static ElementArmySelection CreateBuildButton(Point startPos, string unitNameWithCount, GuiButton.OnClickHandler addSelectionHandler, GuiButton.OnClickHandler removeSelectionHandler)
        {
            // Create the new element using the starting position, and add the click handler
            Rectangle            rect   = new Rectangle(startPos, new Point(0));
            ElementArmySelection retVal = new ElementArmySelection(startPos, unitNameWithCount, " - ", " + ");

            retVal.buttonRemoveSelection.ClickHandler = removeSelectionHandler;
            retVal.buttonAddSelection.ClickHandler    = addSelectionHandler;

            // Calculate the location and size of this object
            Point location = new Point(retVal.labelUnitSelection.Bounds.Left, retVal.buttonRemoveSelection.Bounds.Top);
            Point size     = new Point(retVal.buttonRemoveSelection.Bounds.Right - location.X, retVal.buttonRemoveSelection.Bounds.Bottom - location.Y + 5);

            retVal.Bounds = new Rectangle(location, size);

            // Return the newly generated object
            return(retVal);
        }