Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
 public InventoryPlayer(InventoryScreen parent, string inventoryFont, Point position)
 {
     contentList = new List <InventorySlot>();
     itemsToDraw = GuiList.createNewList(position, 10, new List <GuiLabel>(), 300);
     parent.addElement(itemsToDraw);
     fontName = inventoryFont;
 }
Ejemplo n.º 3
0
        public OverlayEconomyState()
        {
            // Add the end turn button
            buttonEndTurn = GuiButton.createButtonWithLabel(new Point((int)MaxOfEmpires.OverlayPos.X + 20, 10), "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 labels for unit stats
            listArmySoldiers = GuiList.createNewList(new Point(buttonEndTurn.Bounds.Location.X, labelCurrentPlayer.Bounds.Bottom + 5), 5, new System.Collections.Generic.List <GuiLabel>(), 300);

            addElement(listArmySoldiers);
        }
Ejemplo n.º 4
0
        public void InitBuildingList(EconomyGrid grid)
        {
            // Create the list of building possibilities
            listBuilderActions = GuiList.createNewList(BuildingInfoPosition, 5, new List <GuiElement>(), 300);

            // Add all the corresponding elements to the building actions list
            AddBuilderButton(grid, listBuilderActions, "building.town", typeof(Town));
            AddBuilderButton(grid, listBuilderActions, "building.mine", typeof(Mine));
            AddBuilderButton(grid, listBuilderActions, "building.trainingGrounds", typeof(TrainingGrounds));
            AddBuilderButton(grid, listBuilderActions, "building.academy", typeof(Academy));

            // Also add the capital to the building registry, for saving and loading from files
            BuildingRegistry.buildingTypeById["building.capital"] = typeof(Capital);

            // Make sure the list knows how big it is and add it to the screen
            listBuilderActions.calculateElementPositions();
            addElement(listBuilderActions);

            // Create the building actions list and add it to the screen
            listBuildingActions = GuiList.createNewList(BuildingInfoPosition, 5, new List <GuiElement>(), 300);
            addElement(listBuildingActions);
        }
Ejemplo n.º 5
0
        public GuiList getLabels(int xPos, string fontName)
        {
            // Create a list of labels
            List <GuiLabel> allLabels = new List <GuiLabel>();

            // Initialize the labels and add them to the list

            // TODO it would be better to make these labels fields and update them, rather than creating new ones every update.
            // This would also eliminate the need to re-add them to another list every update, as the reference stays equal. -Ebilkill

            labelHeroStats   = GuiLabel.createNewLabel(new Vector2(xPos, 0), "Hero " + heroes[0].Name + " has " + heroes[0].Stats.HP + " HP.", fontName);
            labelEnemyStats  = GuiLabel.createNewLabel(new Vector2(xPos, 200), "Enemy " + enemies[0].Name + " has " + enemies[0].Stats.HP + " HP.", fontName);
            labelElapsedTime = GuiLabel.createNewLabel(new Vector2(xPos, 300), "Elapsed time " + Math.Round(elapsedTime, 2), fontName);
            labelCountdown   = GuiLabel.createNewLabel(new Vector2(xPos, 400), "Countdown " + Math.Round(countdown, 2), fontName);

            allLabels.Add(labelHeroStats);
            allLabels.Add(labelEnemyStats);
            allLabels.Add(labelElapsedTime);
            allLabels.Add(labelCountdown);

            // Return the generated list
            return(GuiList.createNewList(new Point(xPos, 0), 3, allLabels));
        }