Make it easier to buy units and buildings from production menu
See original GitHub issueRight now, when one wants to buy units or buildings in the city they have to: Select the thing, click “build” or “produce” (or similar), after it is selected for production they can click on “Buy”.
How about adding a buy button to the select screen of a unit/building in the city?
I’m guessing you could add the logic in the https://github.com/yairm210/UnCiv/blob/master/core/src/com/unciv/ui/pickerscreens/ConstructionPickerScreen.kt
similar to:
for (building in GameBasics.Buildings.values) {
if (!building.isBuildable(cityConstructions) && building.name!=cityConstructions.currentConstruction) continue
val productionTextButton = getProductionButton(building.name,
building.name + "\r\n" + cityConstructions.turnsToConstruction(building.name) + " {turns}".tr(),
building.getDescription(true, currentPlayerCiv.policies.getAdoptedPolicies()),
"Build [${building.name}]".tr())
if (building.isWonder)
wonders.addActor(productionTextButton)
else
+ if (building !is SpecialConstruction &&
+ !(building is Building && building.isWonder)) {
+ row()
+ val buildingGoldCost = building.getGoldCost(city.civInfo.policies.getAdoptedPolicies())
+ val buildingBuyButton = TextButton("Buy for [$buildingGoldCost] gold".tr(), +CameraStageBaseScreen.skin)
+ buildingBuyButton.onClick("coin") {
+ city.cityConstructions.purchaseBuilding(city.cityConstructions.currentConstruction)
+ update()
+ }
+ if (buildingGoldCost > city.civInfo.gold) {
+ buildingBuyButton.disable()
+ }
regularBuildings.addActor(productionTextButton)
+ regularBuildings.addActor(buildingBuyButton)
+ }
}
for (unit in GameBasics.Units.values.filter { it.isBuildable(cityConstructions)}) {
+ if (unit !is SpecialConstruction &&
+ !(unit is Building && unit.isWonder)) {
+ row()
+ val buildingGoldCost = unit.getGoldCost(city.civInfo.policies.getAdoptedPolicies())
+ val buildingBuyButton = TextButton("Buy for [$buildingGoldCost] gold".tr(), +CameraStageBaseScreen.skin)
+ buildingBuyButton.onClick("coin") {
+ city.cityConstructions.purchaseBuilding(city.cityConstructions.currentConstruction)
+ update()
+ }
+ if (buildingGoldCost > city.civInfo.gold) {
+ buildingBuyButton.disable()
+ }
units.addActor(getProductionButton(unit.name,
unit.name + "\r\n" + cityConstructions.turnsToConstruction(unit.name) + " {turns}".tr(),
unit.getDescription(true), "Train [${unit.name}]".tr()))
+ regularBuildings.addActor(buildingBuyButton)
+ }
}
I’m aware this doesn’t work as of now, especially because of this line:
city.cityConstructions.purchaseBuilding(city.cityConstructions.currentConstruction)
and I’m not sure what the difference between add() and addActor() is, but I hope my idea comes across and my code is semi-usable
Best and keep it up! 👍
Issue Analytics
- State:
- Created 5 years ago
- Comments:9 (4 by maintainers)
Top Results From Across the Web
Is there a way to purchase partially completed units?
No. You will purchase a new unit, and the unit in production will continue to be produced. If you change production, you'll have...
Read more >Beginner's Guide to Unit Production - Paradox Forum
In this week's video, I discuss producing units by building them in colony centers, buying them from NPC factions, and using operations to ......
Read more >[Civ5] I was wondering about the cost efficiency of purchasing ...
I only included unique buildings/units with different Production ... Buildings) and some make certain items cheaper to buy (e.g. Level 1 ...
Read more >Quick way to Select Production buildings and use them
My Idea : Double Click on one of your production buildings make all of buildings of same type selected then you can Select...
Read more >Victoria 3: How To Manage Your Construction - TheGamer
The best way to increase both of these variables is through Government Administration buildings, and since Taxation Capacity is a state-specific ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
So instead, I decided to remodel the entire left side of the city screen to look like the original civ.
Should enter 2.12.2 =D
Sneak peek:
Interesting, I’ll check it out!