mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-25 21:03:15 -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 =
|
AutoPlay =
|
||||||
Show AutoPlay button =
|
Show AutoPlay button =
|
||||||
Multi-turn AutoPlay amount =
|
Multi-turn AutoPlay amount =
|
||||||
|
AutoPlay until victory =
|
||||||
|
|
||||||
Start AutoPlay =
|
Start AutoPlay =
|
||||||
AutoPlay End Turn =
|
AutoPlay End Turn =
|
||||||
|
@ -392,9 +392,14 @@ class GameInfo : IsPartOfGameInfoSerialization, HasGameInfoSerializationVersion
|
|||||||
// Do we need to break if player won?
|
// Do we need to break if player won?
|
||||||
if (simulateUntilWin && player.victoryManager.hasWon()) {
|
if (simulateUntilWin && player.victoryManager.hasWon()) {
|
||||||
simulateUntilWin = false
|
simulateUntilWin = false
|
||||||
|
UncivGame.Current.settings.autoPlay.stopAutoPlay()
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Do we need to stop AutoPlay?
|
||||||
|
if (UncivGame.Current.settings.autoPlay.isAutoPlaying() && player.victoryManager.hasWon())
|
||||||
|
UncivGame.Current.settings.autoPlay.stopAutoPlay()
|
||||||
|
|
||||||
// Clean up
|
// Clean up
|
||||||
TurnManager(player).endTurn(progressBar)
|
TurnManager(player).endTurn(progressBar)
|
||||||
|
|
||||||
|
@ -326,6 +326,7 @@ class GameSettings {
|
|||||||
|
|
||||||
class GameSettingsAutoPlay {
|
class GameSettingsAutoPlay {
|
||||||
var showAutoPlayButton: Boolean = false
|
var showAutoPlayButton: Boolean = false
|
||||||
|
var autoPlayUntilEnd: Boolean = false
|
||||||
var autoPlayMaxTurns = 10
|
var autoPlayMaxTurns = 10
|
||||||
var fullAutoPlayAI: Boolean = true
|
var fullAutoPlayAI: Boolean = true
|
||||||
var autoPlayMilitary: Boolean = true
|
var autoPlayMilitary: Boolean = true
|
||||||
|
@ -59,7 +59,18 @@ fun autoPlayTab(
|
|||||||
settings.autoPlay.stopAutoPlay() }
|
settings.autoPlay.stopAutoPlay() }
|
||||||
|
|
||||||
|
|
||||||
addAutoPlayMaxTurnsSlider(this, settings, optionsPopup.selectBoxMinWidth)
|
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))}
|
||||||
|
|
||||||
|
|
||||||
|
if (!settings.autoPlay.autoPlayUntilEnd)
|
||||||
|
addAutoPlayMaxTurnsSlider(this, settings, optionsPopup.selectBoxMinWidth)
|
||||||
|
|
||||||
// optionsPopup.addCheckbox(
|
// optionsPopup.addCheckbox(
|
||||||
// this,
|
// this,
|
||||||
// "Full AutoPlay AI",
|
// "Full AutoPlay AI",
|
||||||
|
@ -38,7 +38,8 @@ class NextTurnButton(
|
|||||||
if (!worldScreen.viewingCiv.isSpectator())
|
if (!worldScreen.viewingCiv.isSpectator())
|
||||||
TurnManager(worldScreen.viewingCiv).automateTurn()
|
TurnManager(worldScreen.viewingCiv).automateTurn()
|
||||||
worldScreen.nextTurn()
|
worldScreen.nextTurn()
|
||||||
settings.autoPlay.turnsToAutoPlay--
|
if (!settings.autoPlay.autoPlayUntilEnd)
|
||||||
|
settings.autoPlay.turnsToAutoPlay--
|
||||||
settings.autoPlay.autoPlayTurnInProgress = false
|
settings.autoPlay.autoPlayTurnInProgress = false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package com.unciv.ui.screens.worldscreen.unit.actions
|
package com.unciv.ui.screens.worldscreen.unit.actions
|
||||||
|
|
||||||
import com.unciv.GUI
|
import com.unciv.GUI
|
||||||
|
import com.unciv.UncivGame
|
||||||
import com.unciv.logic.civilization.NotificationCategory
|
import com.unciv.logic.civilization.NotificationCategory
|
||||||
import com.unciv.logic.civilization.NotificationIcon
|
import com.unciv.logic.civilization.NotificationIcon
|
||||||
import com.unciv.logic.map.mapunit.MapUnit
|
import com.unciv.logic.map.mapunit.MapUnit
|
||||||
@ -18,7 +19,7 @@ object UnitActionsPillage {
|
|||||||
fun getPillageActions(unit: MapUnit, tile: Tile): List<UnitAction> {
|
fun getPillageActions(unit: MapUnit, tile: Tile): List<UnitAction> {
|
||||||
val pillageAction = getPillageAction(unit, tile)
|
val pillageAction = getPillageAction(unit, tile)
|
||||||
?: return listOf()
|
?: 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)
|
return listOf(pillageAction)
|
||||||
else return listOf(UnitAction(UnitActionType.Pillage, pillageAction.title) {
|
else return listOf(UnitAction(UnitActionType.Pillage, pillageAction.title) {
|
||||||
val pillageText = "Are you sure you want to pillage this [${tile.getImprovementToPillageName()!!}]?"
|
val pillageText = "Are you sure you want to pillage this [${tile.getImprovementToPillageName()!!}]?"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user