mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-25 04:43:05 -04:00
Added AutoPlay until end setting (#10789)
* Added a new AutoPlay until end button * Added the new AutoPlay until victory setting to translation * Reverted some comment fixes to hopefully not have a merge conflict
This commit is contained in:
parent
f529d969f0
commit
7417b4c041
@ -861,6 +861,7 @@ You need to restart the game for this change to take effect. =
|
||||
AutoPlay =
|
||||
Show AutoPlay button =
|
||||
Multi-turn AutoPlay amount =
|
||||
AutoPlay until victory =
|
||||
|
||||
Start AutoPlay =
|
||||
AutoPlay End Turn =
|
||||
|
@ -392,8 +392,13 @@ class GameInfo : IsPartOfGameInfoSerialization, HasGameInfoSerializationVersion
|
||||
// Do we need to break if player won?
|
||||
if (simulateUntilWin && player.victoryManager.hasWon()) {
|
||||
simulateUntilWin = false
|
||||
UncivGame.Current.settings.autoPlay.stopAutoPlay()
|
||||
break
|
||||
}
|
||||
|
||||
// Do we need to stop AutoPlay?
|
||||
if (UncivGame.Current.settings.autoPlay.isAutoPlaying() && player.victoryManager.hasWon())
|
||||
UncivGame.Current.settings.autoPlay.stopAutoPlay()
|
||||
|
||||
// Clean up
|
||||
TurnManager(player).endTurn(progressBar)
|
||||
|
@ -326,6 +326,7 @@ class GameSettings {
|
||||
|
||||
class GameSettingsAutoPlay {
|
||||
var showAutoPlayButton: Boolean = false
|
||||
var autoPlayUntilEnd: Boolean = false
|
||||
var autoPlayMaxTurns = 10
|
||||
var fullAutoPlayAI: Boolean = true
|
||||
var autoPlayMilitary: Boolean = true
|
||||
|
@ -58,8 +58,19 @@ fun autoPlayTab(
|
||||
) { settings.autoPlay.showAutoPlayButton = it
|
||||
settings.autoPlay.stopAutoPlay() }
|
||||
|
||||
|
||||
optionsPopup.addCheckbox(
|
||||
this,
|
||||
"AutoPlay until victory",
|
||||
settings.autoPlay.autoPlayUntilEnd, false
|
||||
) { settings.autoPlay.autoPlayUntilEnd = it
|
||||
if (!it) addAutoPlayMaxTurnsSlider(this, settings, optionsPopup.selectBoxMinWidth)
|
||||
else optionsPopup.tabs.replacePage(optionsPopup.tabs.activePage, autoPlayTab(optionsPopup))}
|
||||
|
||||
addAutoPlayMaxTurnsSlider(this, settings, optionsPopup.selectBoxMinWidth)
|
||||
|
||||
if (!settings.autoPlay.autoPlayUntilEnd)
|
||||
addAutoPlayMaxTurnsSlider(this, settings, optionsPopup.selectBoxMinWidth)
|
||||
|
||||
// optionsPopup.addCheckbox(
|
||||
// this,
|
||||
// "Full AutoPlay AI",
|
||||
|
@ -38,7 +38,8 @@ class NextTurnButton(
|
||||
if (!worldScreen.viewingCiv.isSpectator())
|
||||
TurnManager(worldScreen.viewingCiv).automateTurn()
|
||||
worldScreen.nextTurn()
|
||||
settings.autoPlay.turnsToAutoPlay--
|
||||
if (!settings.autoPlay.autoPlayUntilEnd)
|
||||
settings.autoPlay.turnsToAutoPlay--
|
||||
settings.autoPlay.autoPlayTurnInProgress = false
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.unciv.ui.screens.worldscreen.unit.actions
|
||||
|
||||
import com.unciv.GUI
|
||||
import com.unciv.UncivGame
|
||||
import com.unciv.logic.civilization.NotificationCategory
|
||||
import com.unciv.logic.civilization.NotificationIcon
|
||||
import com.unciv.logic.map.mapunit.MapUnit
|
||||
@ -18,7 +19,7 @@ object UnitActionsPillage {
|
||||
fun getPillageActions(unit: MapUnit, tile: Tile): List<UnitAction> {
|
||||
val pillageAction = getPillageAction(unit, tile)
|
||||
?: return listOf()
|
||||
if (pillageAction.action == null || unit.civ.isAI())
|
||||
if (pillageAction.action == null || unit.civ.isAI() || (unit.civ.isHuman() && UncivGame.Current.settings.autoPlay.isAutoPlaying()))
|
||||
return listOf(pillageAction)
|
||||
else return listOf(UnitAction(UnitActionType.Pillage, pillageAction.title) {
|
||||
val pillageText = "Are you sure you want to pillage this [${tile.getImprovementToPillageName()!!}]?"
|
||||
|
Loading…
x
Reference in New Issue
Block a user