mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-23 03:23:17 -04:00
Moved automation settings to AutoPlayTab and renamed it to AutomationTab (#11765)
* Moved automation settings to AutoPlayTab * Renamed the AutoPlayTab to AutomationTab * Added a translation
This commit is contained in:
parent
dc9bf45009
commit
fec30364a9
@ -890,6 +890,9 @@ Hide =
|
|||||||
HIGHLY EXPERIMENTAL - YOU HAVE BEEN WARNED! =
|
HIGHLY EXPERIMENTAL - YOU HAVE BEEN WARNED! =
|
||||||
You need to restart the game for this change to take effect. =
|
You need to restart the game for this change to take effect. =
|
||||||
|
|
||||||
|
# AutomationTab
|
||||||
|
Automation =
|
||||||
|
|
||||||
# AutoPlay
|
# AutoPlay
|
||||||
AutoPlay =
|
AutoPlay =
|
||||||
Show AutoPlay button =
|
Show AutoPlay button =
|
||||||
|
@ -2,18 +2,61 @@ package com.unciv.ui.popups.options
|
|||||||
|
|
||||||
import com.badlogic.gdx.scenes.scene2d.ui.Table
|
import com.badlogic.gdx.scenes.scene2d.ui.Table
|
||||||
import com.unciv.GUI
|
import com.unciv.GUI
|
||||||
|
import com.unciv.logic.civilization.PlayerType
|
||||||
import com.unciv.models.metadata.GameSettings
|
import com.unciv.models.metadata.GameSettings
|
||||||
|
import com.unciv.ui.components.extensions.addSeparator
|
||||||
import com.unciv.ui.components.widgets.UncivSlider
|
import com.unciv.ui.components.widgets.UncivSlider
|
||||||
import com.unciv.ui.components.extensions.toLabel
|
import com.unciv.ui.components.extensions.toLabel
|
||||||
import com.unciv.ui.screens.basescreen.BaseScreen
|
import com.unciv.ui.screens.basescreen.BaseScreen
|
||||||
import com.unciv.ui.screens.worldscreen.WorldScreen
|
|
||||||
|
|
||||||
fun autoPlayTab(optionsPopup: OptionsPopup
|
fun automationTab(optionsPopup: OptionsPopup
|
||||||
): Table = Table(BaseScreen.skin).apply {
|
): Table = Table(BaseScreen.skin).apply {
|
||||||
pad(10f)
|
pad(10f)
|
||||||
defaults().pad(5f)
|
defaults().pad(5f)
|
||||||
|
|
||||||
val settings = optionsPopup.settings
|
val settings = optionsPopup.settings
|
||||||
|
add("Automation".toLabel(fontSize = 24)).colspan(2).row()
|
||||||
|
|
||||||
|
optionsPopup.addCheckbox(this, "Auto-assign city production", settings.autoAssignCityProduction, true) { shouldAutoAssignCityProduction ->
|
||||||
|
settings.autoAssignCityProduction = shouldAutoAssignCityProduction
|
||||||
|
val worldScreen = GUI.getWorldScreenIfActive()
|
||||||
|
if (shouldAutoAssignCityProduction && worldScreen != null &&
|
||||||
|
worldScreen.viewingCiv.isCurrentPlayer() && worldScreen.viewingCiv.playerType == PlayerType.Human
|
||||||
|
) {
|
||||||
|
worldScreen.gameInfo.getCurrentPlayerCivilization().cities.forEach { city ->
|
||||||
|
city.cityConstructions.chooseNextConstruction()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
optionsPopup.addCheckbox(this, "Auto-build roads", settings.autoBuildingRoads) { settings.autoBuildingRoads = it }
|
||||||
|
optionsPopup.addCheckbox(
|
||||||
|
this,
|
||||||
|
"Automated workers replace improvements",
|
||||||
|
settings.automatedWorkersReplaceImprovements
|
||||||
|
) { settings.automatedWorkersReplaceImprovements = it }
|
||||||
|
optionsPopup.addCheckbox(
|
||||||
|
this,
|
||||||
|
"Automated units move on turn start",
|
||||||
|
settings.automatedUnitsMoveOnTurnStart, true
|
||||||
|
) { settings.automatedUnitsMoveOnTurnStart = it }
|
||||||
|
optionsPopup.addCheckbox(
|
||||||
|
this,
|
||||||
|
"Automated units can upgrade",
|
||||||
|
settings.automatedUnitsCanUpgrade, false
|
||||||
|
) { settings.automatedUnitsCanUpgrade = it }
|
||||||
|
optionsPopup.addCheckbox(
|
||||||
|
this,
|
||||||
|
"Automated units choose promotions",
|
||||||
|
settings.automatedUnitsChoosePromotions, false
|
||||||
|
) { settings.automatedUnitsChoosePromotions = it }
|
||||||
|
optionsPopup.addCheckbox(
|
||||||
|
this,
|
||||||
|
"Cities auto-bombard at end of turn",
|
||||||
|
settings.citiesAutoBombardAtEndOfTurn, false
|
||||||
|
) { settings.citiesAutoBombardAtEndOfTurn = it }
|
||||||
|
|
||||||
|
addSeparator()
|
||||||
|
add("AutoPlay".toLabel(fontSize = 24)).colspan(2).row()
|
||||||
// fun addAutoPlaySections() {
|
// fun addAutoPlaySections() {
|
||||||
// optionsPopup.addCheckbox(
|
// optionsPopup.addCheckbox(
|
||||||
// this,
|
// this,
|
||||||
@ -60,19 +103,19 @@ fun autoPlayTab(optionsPopup: OptionsPopup
|
|||||||
GUI.getWorldScreenIfActive()?.autoPlay?.stopAutoPlay()
|
GUI.getWorldScreenIfActive()?.autoPlay?.stopAutoPlay()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
optionsPopup.addCheckbox(
|
optionsPopup.addCheckbox(
|
||||||
this,
|
this,
|
||||||
"AutoPlay until victory",
|
"AutoPlay until victory",
|
||||||
settings.autoPlay.autoPlayUntilEnd, false
|
settings.autoPlay.autoPlayUntilEnd, false
|
||||||
) { settings.autoPlay.autoPlayUntilEnd = it
|
) { settings.autoPlay.autoPlayUntilEnd = it
|
||||||
if (!it) addAutoPlayMaxTurnsSlider(this, settings, optionsPopup.selectBoxMinWidth)
|
if (!it) addAutoPlayMaxTurnsSlider(this, settings, optionsPopup.selectBoxMinWidth)
|
||||||
else optionsPopup.tabs.replacePage(optionsPopup.tabs.activePage, autoPlayTab(optionsPopup))}
|
else optionsPopup.tabs.replacePage(optionsPopup.tabs.activePage, automationTab(optionsPopup))}
|
||||||
|
|
||||||
|
|
||||||
if (!settings.autoPlay.autoPlayUntilEnd)
|
if (!settings.autoPlay.autoPlayUntilEnd)
|
||||||
addAutoPlayMaxTurnsSlider(this, settings, optionsPopup.selectBoxMinWidth)
|
addAutoPlayMaxTurnsSlider(this, settings, optionsPopup.selectBoxMinWidth)
|
||||||
|
|
||||||
// optionsPopup.addCheckbox(
|
// optionsPopup.addCheckbox(
|
||||||
// this,
|
// this,
|
||||||
// "Full AutoPlay AI",
|
// "Full AutoPlay AI",
|
@ -20,43 +20,6 @@ fun gameplayTab(
|
|||||||
optionsPopup.addCheckbox(this, "Auto Unit Cycle", settings.autoUnitCycle, true) { settings.autoUnitCycle = it }
|
optionsPopup.addCheckbox(this, "Auto Unit Cycle", settings.autoUnitCycle, true) { settings.autoUnitCycle = it }
|
||||||
optionsPopup.addCheckbox(this, "Move units with a single tap", settings.singleTapMove) { settings.singleTapMove = it }
|
optionsPopup.addCheckbox(this, "Move units with a single tap", settings.singleTapMove) { settings.singleTapMove = it }
|
||||||
optionsPopup.addCheckbox(this, "Move units with a long tap", settings.longTapMove) { settings.longTapMove = it }
|
optionsPopup.addCheckbox(this, "Move units with a long tap", settings.longTapMove) { settings.longTapMove = it }
|
||||||
optionsPopup.addCheckbox(this, "Auto-assign city production", settings.autoAssignCityProduction, true) { shouldAutoAssignCityProduction ->
|
|
||||||
settings.autoAssignCityProduction = shouldAutoAssignCityProduction
|
|
||||||
val worldScreen = GUI.getWorldScreenIfActive()
|
|
||||||
if (shouldAutoAssignCityProduction && worldScreen != null &&
|
|
||||||
worldScreen.viewingCiv.isCurrentPlayer() && worldScreen.viewingCiv.playerType == PlayerType.Human
|
|
||||||
) {
|
|
||||||
worldScreen.gameInfo.getCurrentPlayerCivilization().cities.forEach { city ->
|
|
||||||
city.cityConstructions.chooseNextConstruction()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
optionsPopup.addCheckbox(this, "Auto-build roads", settings.autoBuildingRoads) { settings.autoBuildingRoads = it }
|
|
||||||
optionsPopup.addCheckbox(
|
|
||||||
this,
|
|
||||||
"Automated workers replace improvements",
|
|
||||||
settings.automatedWorkersReplaceImprovements
|
|
||||||
) { settings.automatedWorkersReplaceImprovements = it }
|
|
||||||
optionsPopup.addCheckbox(
|
|
||||||
this,
|
|
||||||
"Automated units move on turn start",
|
|
||||||
settings.automatedUnitsMoveOnTurnStart, true
|
|
||||||
) { settings.automatedUnitsMoveOnTurnStart = it }
|
|
||||||
optionsPopup.addCheckbox(
|
|
||||||
this,
|
|
||||||
"Automated units can upgrade",
|
|
||||||
settings.automatedUnitsCanUpgrade, false
|
|
||||||
) { settings.automatedUnitsCanUpgrade = it }
|
|
||||||
optionsPopup.addCheckbox(
|
|
||||||
this,
|
|
||||||
"Automated units choose promotions",
|
|
||||||
settings.automatedUnitsChoosePromotions, false
|
|
||||||
) { settings.automatedUnitsChoosePromotions = it }
|
|
||||||
optionsPopup.addCheckbox(
|
|
||||||
this,
|
|
||||||
"Cities auto-bombard at end of turn",
|
|
||||||
settings.citiesAutoBombardAtEndOfTurn, false
|
|
||||||
) { settings.citiesAutoBombardAtEndOfTurn = it }
|
|
||||||
optionsPopup.addCheckbox(this, "Order trade offers by amount", settings.orderTradeOffersByAmount) { settings.orderTradeOffersByAmount = it }
|
optionsPopup.addCheckbox(this, "Order trade offers by amount", settings.orderTradeOffersByAmount) { settings.orderTradeOffersByAmount = it }
|
||||||
optionsPopup.addCheckbox(this, "Ask for confirmation when pressing next turn", settings.confirmNextTurn) { settings.confirmNextTurn = it }
|
optionsPopup.addCheckbox(this, "Ask for confirmation when pressing next turn", settings.confirmNextTurn) { settings.confirmNextTurn = it }
|
||||||
|
|
||||||
|
@ -85,8 +85,8 @@ class OptionsPopup(
|
|||||||
ImageGetter.getImage("OtherIcons/Options"), 24f
|
ImageGetter.getImage("OtherIcons/Options"), 24f
|
||||||
)
|
)
|
||||||
tabs.addPage(
|
tabs.addPage(
|
||||||
"AutoPlay",
|
"Automation",
|
||||||
autoPlayTab(this),
|
automationTab(this),
|
||||||
ImageGetter.getImage("OtherIcons/NationSwap"), 24f
|
ImageGetter.getImage("OtherIcons/NationSwap"), 24f
|
||||||
)
|
)
|
||||||
tabs.addPage(
|
tabs.addPage(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user