Cleaned up tutorials

This commit is contained in:
Yair Morgenstern 2019-12-12 20:58:02 +02:00
parent acf91b4e12
commit 58d58ef3a3
13 changed files with 55 additions and 75 deletions

View File

@ -1 +1 @@
{showWorkedTiles:true,resolution:900x600,tutorialsShown:[_OtherCivEncountered,CityFounded,_BarbarianEncountered,ContactMe,TechPickerScreen,CityEntered,AfterCityEntered,EnemyCity,GoldenAge,Roads_and_Railroads,LuxuryResource,StrategicResource,Unhappiness,NewGame,TileLayout,UnitSelected,TileClicked,Injured_Units,Workers,CanEmbark,Siege_Units,_EnemyCityNeedsConqueringWithMeleeUnit,NextTurn,PolicyPickerScreen,City_Range,Apollo_Program],soundEffectsVolume:0.1,tileSet:ThorfMaps}
{showResourcesAndImprovements:false,tutorialsShown:[World_Map,Unit_Selected,Slow_Start,_City_Founded,First_Steps,Injured_Units,Workers,_OtherCivEncountered,_BarbarianEncountered,Roads_and_Railroads,Golden_Age,Idle_Units,Contact_Me,Luxury_Resource,Strategic_Resource,Enemy_City,Apollo_Program,Embarking,Tile_Clicked,Technology,Culture_and_Policies,City_Range,Cities,Next_Turn,Siege_Units,Happiness,Unhappiness,New_Game,_GameCrashed],missionsCompleted:[Move unit,Found city,Enter city screen,Found city,Enter city screen,Enter city screen,Found city,Pick technology,Enter city screen,Pick construction,Found city,Enter city screen,Enter city screen,Pass a turn,Enter city screen,Enter city screen,Reassign worked tiles,Pass a turn,Meet another civilization,Open the options table,Pass a turn,Pass a turn,Meet another civilization,Pass a turn,Pick technology,Pass a turn,Pass a turn,Move unit],soundEffectsVolume:1,musicVolume:0,showPixelUnits:true,nuclearWeaponEnabled:true,userId:8d2cbffc-2b96-4617-aa49-0c68f6fe15c4}

View File

@ -1,6 +1,14 @@
{
// Each entry s a tutorial, but the tutorial may be spread over separate paragraphs.
// Entries starting with a _ will NOT be shown in Civilopedia.
Introduction: [
[
"Welcome to Unciv!",
"Because this is a complex game, there are basic tasks to help familiarize you with the game.",
"These are completely optional, and you're welcome to explore the game on your own!",
]
],
// Civilopedia only, because players said this was too wall-of-text
New_Game: [
@ -64,26 +72,6 @@
]
],
Cities: [
[
"Each population in your city can work a single tile, providing the city with that tile's yields.",
"Population can be assigned and unassigned by clicking on the tiles - ",
" but of course, you can only assign population if you have idle population to spare!"
],
[
"The center tile of a city is always worked, and doesn't require population,",
" but it cannot be improved by tile improvements."
"The city's production always goes towards the current construction - ",
" you can pick the city's construction by clicking on the construction button on the bottom-left"
]
[
"Cities grow in population when you amass enough surplus food.",
"Similarly, your city's borders grow when you amass enough culture,",
" which is not generated by tiles but rather by buildings."
],
],
Happiness:[
@ -176,19 +164,14 @@
Luxury_Resource: [
[
"Luxury resources within your domain and with their specific improvement are connected to your trade network.",
"Each unique Luxury resource you have adds 5 happiness to your civilization,",
" but extra resources of the same type don't add anything, ",
" so use them for trading with other civilizations!"
"Each unique Luxury resource you have adds 5 happiness to your civilization, but extra resources of the same type don't add anything, so use them for trading with other civilizations!"
]
]
Strategic_Resource: [
[
"Strategic resources within your domain and with their specific improvement are connected to your trade network.",
"Strategic resources allow you to train units and construct buildings that",
" require those specific resources, for example the Horseman requires Horses."
"Each unit 'consumes' a copy of that resource, but if the unit is killed you can ",
" construct a new unit wth your now-unused resource.",
"Strategic resources allow you to train units and construct buildings that require those specific resources, for example the Horseman requires Horses."
"The top bar keeps count of how many unused strategic resources you own."
]
]
@ -258,8 +241,7 @@
Workers:[
[
"Workers are vital to your cities' growth, since only they can construct improvements on tiles",
"Improvements raise the yield of your tiles, allowing your city to produce more and grow faster",
" while working the same amount of tiles!"
"Improvements raise the yield of your tiles, allowing your city to produce more and grow faster while working the same amount of tiles!"
]
]

View File

@ -255,7 +255,7 @@ class CivilizationInfo {
popupAlerts.add(PopupAlert(AlertType.FirstContact,otherCiv.civName))
if(isCurrentPlayer() || otherCiv.isCurrentPlayer())
UncivGame.Current.settings.addMissionCompleted("Meet another civilization")
UncivGame.Current.settings.addCompletedTutorialTask("Meet another civilization")
}
override fun toString(): String {return civName} // for debug

View File

@ -327,7 +327,7 @@ class MapUnit {
if (tile.turnsToImprovement != 0) return
if(civInfo.isCurrentPlayer())
UncivGame.Current.settings.addMissionCompleted("Construct an improvement")
UncivGame.Current.settings.addCompletedTutorialTask("Construct an improvement")
when {
tile.improvementInProgress!!.startsWith("Remove") -> {
val tileImprovement = tile.getTileImprovement()

View File

@ -10,7 +10,7 @@ class GameSettings {
var language: String = "English"
var resolution: String = "900x600"
var tutorialsShown = ArrayList<String>()
var missionsCompleted = ArrayList<String>()
var tutorialTasksCompleted = ArrayList<String>()
var hasCrashedRecently = false
var soundEffectsVolume = 0.5f
var musicVolume = 0.5f
@ -30,8 +30,8 @@ class GameSettings {
GameSaver().setGeneralSettings(this)
}
fun addMissionCompleted(mission:String){
missionsCompleted.add(mission)
fun addCompletedTutorialTask(tutorialTask:String){
tutorialTasksCompleted.add(tutorialTask)
save()
}
}

View File

@ -48,7 +48,7 @@ class CityScreen(internal val city: CityInfo) : CameraStageBaseScreen() {
init {
onBackButtonClicked { game.setWorldScreen() }
addTiles()
UncivGame.Current.settings.addMissionCompleted("Enter city screen")
UncivGame.Current.settings.addCompletedTutorialTask("Enter city screen")
val tableBackgroundColor = ImageGetter.getBlue().lerp(Color.BLACK,0.5f)
@ -71,7 +71,6 @@ class CityScreen(internal val city: CityInfo) : CameraStageBaseScreen() {
stage.addActor(buildingsTableContainer)
update()
displayTutorials("Cities")
}
internal fun update() {
@ -217,7 +216,7 @@ class CityScreen(internal val city: CityInfo) : CameraStageBaseScreen() {
if (tileGroup.isWorkable && UncivGame.Current.worldScreen.isPlayersTurn) {
if (!tileInfo.isWorked() && city.population.getFreePopulation() > 0) {
city.workedTiles.add(tileInfo.position)
game.settings.addMissionCompleted("Reassign worked tiles")
game.settings.addCompletedTutorialTask("Reassign worked tiles")
}
else if (tileInfo.isWorked()) city.workedTiles.remove(tileInfo.position)
city.cityStats.update()

View File

@ -55,7 +55,7 @@ class ConstructionsTable(val cityScreen: CityScreen) : Table(CameraStageBaseScre
cityScreen.city.cityConstructions.currentConstructionIsUserSet = true
cityScreen.city.cityStats.update()
cityScreen.update()
cityScreen.game.settings.addMissionCompleted("Pick construction")
cityScreen.game.settings.addCompletedTutorialTask("Pick construction")
}
}

View File

@ -51,7 +51,7 @@ class TechPickerScreen(internal val civInfo: CivilizationInfo, centerOnTech: Tec
setButtonsInfo()
rightSideButton.setText("Pick a tech".tr())
rightSideButton.onClick("paper") {
game.settings.addMissionCompleted("Pick technology")
game.settings.addCompletedTutorialTask("Pick technology")
if (isFreeTechPick) civTech.getFreeTechnology(selectedTech!!.name)
else civTech.techsToResearch = tempTechsToResearch

View File

@ -23,14 +23,14 @@ class Tutorials{
fun displayTutorials(name: String, screen:CameraStageBaseScreen) {
if (!UncivGame.Current.settings.showTutorials) return
if (UncivGame.Current.settings.tutorialsShown.contains(name)) return
if(tutorialTexts.any { it.name==name }) return // currently showing
var texts: ArrayList<String>
try {
texts = getTutorials(name, UncivGame.Current.settings.language)
} catch (ex: Exception) {
texts = ArrayList<String>().apply { add("Could not find matching tutorial!") }
texts = ArrayList<String>().apply { add("Could not find matching tutorial: $name") }
}
if(tutorialTexts.any { it.name==name }) return // currently showing
tutorialTexts.add(Tutorial(name, texts))
if (!isTutorialShowing) displayTutorial(screen)
}

View File

@ -104,7 +104,6 @@ class TileMapHolder(internal val worldScreen: WorldScreen, internal val tileMap:
}
private fun onTileClicked(tileInfo: TileInfo) {
worldScreen.displayTutorials("Tile_Clicked")
unitActionOverlay?.remove()
selectedTile = tileInfo
@ -205,7 +204,7 @@ class TileMapHolder(internal val worldScreen: WorldScreen, internal val tileMap:
if (dto.unit.currentMovement > 0)
moveHereButton.onClick(""){
UncivGame.Current.settings.addMissionCompleted("Move unit")
UncivGame.Current.settings.addCompletedTutorialTask("Move unit")
UnitContextMenu(this, dto.unit, dto.tileInfo).onMoveButtonClick()
}

View File

@ -51,7 +51,7 @@ class WorldScreen(val viewingCiv:CivilizationInfo) : CameraStageBaseScreen() {
private val techButtonHolder = Table()
private val diplomacyButtonWrapper = Table()
private val nextTurnButton = createNextTurnButton()
private val missionTable=Table().apply { background=ImageGetter.getBackground(ImageGetter.getBlue().lerp(Color.BLACK, 0.5f)) }
private val tutorialTaskTable=Table().apply { background=ImageGetter.getBackground(ImageGetter.getBlue().lerp(Color.BLACK, 0.5f)) }
private val notificationsScroll: NotificationsScroll
var alertPopupIsOpen = false // if we have an alert popup and then we changed screens, the old one shouldn't affect us
@ -89,7 +89,7 @@ class WorldScreen(val viewingCiv:CivilizationInfo) : CameraStageBaseScreen() {
stage.addActor(nextTurnButton)
stage.addActor(techPolicyandVictoryHolder)
stage.addActor(notificationsScroll)
stage.addActor(missionTable)
stage.addActor(tutorialTaskTable)
diplomacyButtonWrapper.defaults().pad(5f)
@ -164,19 +164,20 @@ class WorldScreen(val viewingCiv:CivilizationInfo) : CameraStageBaseScreen() {
bottomUnitTable.update()
bottomTileInfoTable.updateTileTable(tileMapHolder.selectedTile!!)
bottomTileInfoTable.x=stage.width-bottomTileInfoTable.width
bottomTileInfoTable.y=if(UncivGame.Current.settings.showMinimap)minimapWrapper.height else 0f
bottomTileInfoTable.x = stage.width - bottomTileInfoTable.width
bottomTileInfoTable.y = if (UncivGame.Current.settings.showMinimap) minimapWrapper.height else 0f
battleTable.update()
missionTable.clear()
val mission =getCurrentMission()
if(mission==""){missionTable.isVisible=false}
else {
missionTable.add(mission.toLabel()
tutorialTaskTable.clear()
val tutorialTask = getCurrentTutorialTask()
if (tutorialTask == "") {
tutorialTaskTable.isVisible = false
} else {
tutorialTaskTable.add(tutorialTask.toLabel()
.apply { setAlignment(Align.center) }).pad(10f)
missionTable.pack()
missionTable.centerX(stage)
missionTable.y = topBar.y - missionTable.height
tutorialTaskTable.pack()
tutorialTaskTable.centerX(stage)
tutorialTaskTable.y = topBar.y - tutorialTaskTable.height
}
minimapWrapper.update(viewingCiv)
@ -198,7 +199,7 @@ class WorldScreen(val viewingCiv:CivilizationInfo) : CameraStageBaseScreen() {
val isSomethingOpen = tutorials.isTutorialShowing || stage.actors.any { it is TradePopup }
|| alertPopupIsOpen
if(!isSomethingOpen && isPlayersTurn) {
if (!isSomethingOpen && isPlayersTurn) {
when {
!gameInfo.oneMoreTurnMode && gameInfo.civilizations.any { it.victoryManager.hasWon() } -> game.setScreen(VictoryScreen())
viewingCiv.policies.freePolicies > 0 && viewingCiv.policies.canAdoptPolicy() -> game.setScreen(PolicyPickerScreen(this))
@ -211,31 +212,30 @@ class WorldScreen(val viewingCiv:CivilizationInfo) : CameraStageBaseScreen() {
notificationsScroll.update(viewingCiv.notifications)
notificationsScroll.setPosition(stage.width - notificationsScroll.width - 5f,
nextTurnButton.y - notificationsScroll.height - 5f)
}
private fun getCurrentMission(): String {
val completedMissions = game.settings.missionsCompleted
if(!completedMissions.contains("Move unit"))
private fun getCurrentTutorialTask(): String {
val completedTasks = game.settings.tutorialTasksCompleted
if(!completedTasks.contains("Move unit"))
return "Move a unit!\nClick on a unit > Click on a destination > Click the arrow popup"
if(!completedMissions.contains("Found city"))
if(!completedTasks.contains("Found city"))
return "Found a city!\nSelect the Settler (flag unit) > Click on 'Found city' (bottom-left corner)"
if(!completedMissions.contains("Enter city screen"))
if(!completedTasks.contains("Enter city screen"))
return "Enter the city screen!\nClick the city button twice"
if(!completedMissions.contains("Pick technology"))
if(!completedTasks.contains("Pick technology"))
return "Pick a technology to research!\nClick on the tech button (greenish, top left) > \n select technology > click 'Research' (bottom right)"
if(!completedMissions.contains("Pick construction"))
if(!completedTasks.contains("Pick construction"))
return "Pick a construction!\nEnter city screen > Click on a unit or building (left side)"
if(!completedMissions.contains("Pass a turn"))
if(!completedTasks.contains("Pass a turn"))
return "Pass a turn!\nCycle through units with 'Next unit' > Click 'Next turn'"
if(!completedMissions.contains("Reassign worked tiles"))
if(!completedTasks.contains("Reassign worked tiles"))
return "Reassign worked tiles!\nEnter city screen > click the assigned (green) tile to unassign > " +
"\n click an unassigned tile to assign population"
if(!completedMissions.contains("Meet another civilization"))
if(!completedTasks.contains("Meet another civilization"))
return "Meet another civilization!\nExplore the map until you encounter another civilization!"
if(!completedMissions.contains("Open the options table"))
if(!completedTasks.contains("Open the options table"))
return "Open the options table!\nClick the menu button (top left) > click 'Options'"
if(!completedMissions.contains("Construct an improvement"))
if(!completedTasks.contains("Construct an improvement"))
return "Construct an improvement!\nConstruct a Worker unit > Move to a Plains or Grassland tile > " +
"\n Choose 'Create improvement' > Choose the farm > " +
"\n Leave the worker there until it's finished"
@ -251,7 +251,7 @@ class WorldScreen(val viewingCiv:CivilizationInfo) : CameraStageBaseScreen() {
UncivGame.Current.settings.save()
}
displayTutorials("Introduction")
if (!UncivGame.Current.settings.tutorialsShown.contains("_EnemyCityNeedsConqueringWithMeleeUnit")) {
for (enemyCity in viewingCiv.diplomacy.values.filter { it.diplomaticStatus == DiplomaticStatus.War }
.map { it.otherCiv() }.flatMap { it.cities }) {
@ -348,7 +348,7 @@ class WorldScreen(val viewingCiv:CivilizationInfo) : CameraStageBaseScreen() {
return@onClick
}
game.settings.addMissionCompleted("Pass a turn")
game.settings.addCompletedTutorialTask("Pass a turn")
nextTurn() // If none of the above
}
@ -480,7 +480,7 @@ class WorldScreen(val viewingCiv:CivilizationInfo) : CameraStageBaseScreen() {
if(resources.any { it.resource.resourceType==ResourceType.Luxury }) displayTutorials("Luxury_Resource")
if(resources.any { it.resource.resourceType==ResourceType.Strategic}) displayTutorials("Strategic_Resource")
if("Enemy_City" !in shownTutorials
&& gameInfo.civilizations.filter { it!=viewingCiv }
&& viewingCiv.getKnownCivs().filter { viewingCiv.isAtWarWith(it) }
.flatMap { it.cities }.any { viewingCiv.exploredTiles.contains(it.location) })
displayTutorials("Enemy_City")
if(viewingCiv.containsBuildingUnique("Enables construction of Spaceship parts"))

View File

@ -30,7 +30,7 @@ class WorldScreenOptionsTable(val worldScreen:WorldScreen) : PopupTable(worldScr
var selectedLanguage: String = "English"
init {
UncivGame.Current.settings.addMissionCompleted("Open the options table")
UncivGame.Current.settings.addCompletedTutorialTask("Open the options table")
update()
open()
}

View File

@ -132,7 +132,7 @@ class UnitActions {
unit.currentMovement >0 &&
!tile.getTilesInDistance(3).any { it.isCityCenter() })
{
UncivGame.Current.settings.addMissionCompleted("Found city")
UncivGame.Current.settings.addCompletedTutorialTask("Found city")
unit.civInfo.addCity(tile.position)
tile.improvement = null
unit.destroy()