diff --git a/android/assets/jsons/Tutorials_English.json b/android/assets/jsons/Tutorials_English.json index 98745a56..2247e259 100644 --- a/android/assets/jsons/Tutorials_English.json +++ b/android/assets/jsons/Tutorials_English.json @@ -290,4 +290,22 @@ ] ] + SiegeUnitTrained:[ + [ + "You have trained a siege unit!", + "Siege units are extremely powerful against cities, but need to be Set Up before they can attack.", + "Once your siege unit is set up, it can attack from the current tile,", + " but once moved to another tile, it will need to be set up again." + ] + ] + + CanEmbark:[ + [ + "Your land units can now embark!", + "Siege units are extremely powerful against cities, but need to be Set Up before they can attack.", + "Once your siege unit is set up, it can attack from the current tile,", + " but once moved to another tile, it will need to be set up again." + ] + ] + } diff --git a/core/src/com/unciv/ui/worldscreen/WorldScreen.kt b/core/src/com/unciv/ui/worldscreen/WorldScreen.kt index eea2fb9c..06ba3ecc 100644 --- a/core/src/com/unciv/ui/worldscreen/WorldScreen.kt +++ b/core/src/com/unciv/ui/worldscreen/WorldScreen.kt @@ -12,6 +12,7 @@ import com.unciv.logic.GameSaver import com.unciv.logic.civilization.CivilizationInfo import com.unciv.logic.civilization.DiplomaticStatus import com.unciv.models.gamebasics.tile.ResourceType +import com.unciv.models.gamebasics.unit.UnitType import com.unciv.ui.pickerscreens.GreatPersonPickerScreen import com.unciv.ui.pickerscreens.PolicyPickerScreen import com.unciv.ui.pickerscreens.TechButton @@ -236,7 +237,7 @@ class WorldScreen : CameraStageBaseScreen() { // but the main thread does other stuff, including showing tutorials which guess what? Changes the game data // BOOM! Exception! // That's why this needs to be after the game is saved. - shouldUpdate=true + shouldUpdateBecauseOfNewTurn=true nextTurnButton.setText("Next turn".tr()) Gdx.input.inputProcessor = stage @@ -255,14 +256,15 @@ class WorldScreen : CameraStageBaseScreen() { } } - private var shouldUpdate=false + private var shouldUpdateBecauseOfNewTurn=false override fun render(delta: Float) { - if(shouldUpdate){ // This is so that updates happen in the MAIN THREAD, where there is a GL Context, + if(shouldUpdateBecauseOfNewTurn){ // This is so that updates happen in the MAIN THREAD, where there is a GL Context, // otherwise images will not load properly! update() + val shownTutorials = UnCivGame.Current.settings.tutorialsShown displayTutorials("NextTurn") - if("BarbarianEncountered" !in UnCivGame.Current.settings.tutorialsShown + if("BarbarianEncountered" !in shownTutorials && civInfo.getViewableTiles().any { it.getUnits().any { unit -> unit.civInfo.isBarbarianCivilization() } }) displayTutorials("BarbarianEncountered") if(civInfo.cities.size > 2) displayTutorials("SecondCity") @@ -272,12 +274,18 @@ class WorldScreen : CameraStageBaseScreen() { val resources = civInfo.getCivResources() if(resources.keys.any { it.resourceType==ResourceType.Luxury }) displayTutorials("LuxuryResource") if(resources.keys.any { it.resourceType==ResourceType.Strategic}) displayTutorials("StrategicResource") - if(civInfo.exploredTiles.asSequence().map { gameInfo.tileMap[it] }.any { it.isCityCenter() && it.getOwner()!=civInfo }) + if("EnemyCity" !in shownTutorials + && civInfo.exploredTiles.asSequence().map { gameInfo.tileMap[it] } + .any { it.isCityCenter() && it.getOwner()!=civInfo }) displayTutorials("EnemyCity") if("Enables construction of Spaceship parts" in civInfo.getBuildingUniques()) displayTutorials("ApolloProgram") + if(civInfo.getCivUnits().any { it.baseUnit.unitType == UnitType.Siege }) + displayTutorials("SiegeUnitTrained") + if(civInfo.tech.getUniques().contains("Enables embarkation for land units")) + displayTutorials("CanEmbark") - shouldUpdate=false + shouldUpdateBecauseOfNewTurn=false } super.render(delta) }