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); }
protected void AddUpgradeButton(GuiList buildingActions, string unitToUpgrade, int tier, Player player) { StringBuilder buttonText = new StringBuilder(); buttonText.Append("Upgrade to tier ").Append(tier + 1).Append(": ("); buttonText.Append(SoldierRegistry.GetUpgradeCost(unitToUpgrade, player.soldierTiers[unitToUpgrade])).Append("G): "); // Soldier ('cost'G) buildingActions.addElement(ElementBuildButton.CreateBuildButton(buildingActions.Bounds.Location, buttonText.ToString(), () => { TryUpgradeUnit(unitToUpgrade); }, "Upgrade")); }
protected void AddRecruitingButton(GuiList buildingActions, string unitToRecruit) { StringBuilder labelNextToButtonText = new StringBuilder(); labelNextToButtonText.Append(Translations.GetTranslation(unitToRecruit)).Append(" ("); // Soldier ( labelNextToButtonText.Append(SoldierRegistry.GetSoldierCost(unitToRecruit)).Append("G): "); // Soldier ('cost'G) buildingActions.addElement(ElementBuildButton.CreateBuildButton(buildingActions.Bounds.Location, labelNextToButtonText.ToString(), () => TrySpawnUnit(unitToRecruit), "Recruit")); }
private void AddBuilderButton(EconomyGrid grid, GuiList listBuilderActions, string buildingName, Type buildingType) { // Create the label for the element StringBuilder label = new StringBuilder(); label.Append(Translations.GetTranslation(buildingName)).Append(" ("); label.Append(BuildingRegistry.GetCost(buildingName)).Append("G): "); // Create the element using the label, and add a BuildBuilding clickhandler listBuilderActions.addElement(ElementBuildButton.CreateBuildButton(listBuilderActions.Bounds.Location, label.ToString(), BuildBuilding(grid, buildingName, buildingType))); // Also add this buildingID-Type pair to the BuildingRegistry BuildingRegistry.buildingTypeById[buildingName] = buildingType; }
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))); } }
public override void PopulateBuildingActions(GuiList buildingActions) { buildingActions.addElement(ElementBuildButton.CreateBuildButton(buildingActions.Bounds.Location, "Builder (500G)", () => TrySpawnBuilder())); }