Added Missions, to replace wall-of-text tutorials in bite-sized pieces! Very pleased with this =D

This commit is contained in:
Yair Morgenstern
2019-12-11 22:48:18 +02:00
parent cfccf54f9a
commit 5812f2026f
20 changed files with 84 additions and 98 deletions

View File

@ -2,11 +2,9 @@
// Each entry s a tutorial, but the tutorial may be spread over separate paragraphs.
// Entries starting with a _ will NOT be shown in Civilopedia.
// Civilopedia only, because players said this was too wall-of-text
New_Game: [
[
"Hello, and welcome to Unciv!",
"Civilization games can be complex, so we'll be guiding you step-by-step.",
"Your first mission is to found your capital city.",
"This is actually an important task because your capital city will probably be your most prosperous.",
"Many game bonuses apply only to your capital city and it will probably be the center of your empire."
@ -26,27 +24,6 @@
"You only need to settle right next to resources if you need them immediately ",
" which might be the case now and then, but youll usually have the luxury of time."
],
],
_City_Founded : [
[
"You have founded a city!",
"Cities are the lifeblood of your empire, providing gold and science empire-wide,",
" which are displayed on the top bar.",
"You can click the city name to enter the city screen to assign population,",
" choose production, and see information on the city"
],
]
First_Steps : [
[
"Once you have your first city up and running youll be able to start production of a new unit",
" and youll be able to begin your research.",
"Im not going to delve too deeply into the research element of the game yet that will be handled later in the guide ",
" so lets just talk about production."
],
[
"The first thing coming out of your city should be either a Scout or Warrior."
"I generally prefer the Warrior because it can be used for defense and because it can be upgraded",
@ -56,21 +33,10 @@
"If youre a veteran of the 4x strategy genre your first Warrior or Scout will be followed by a Settler.",
"Fast expanding is absolutely critical in most games of this type.",
],
],
Next_Turn : [
[
"Once you've done everything you can in this turn, ",
" click the next turn button on the top right to continue."
],
[
"Each turn, science, culture and gold are added",
" to your civilization, your cities' construction",
" continues, and they may grow in population or area."
]
],
Slow_Start: [
[
"In your first couple of turns,",
@ -117,19 +83,6 @@
],
],
Technology: [
[
"Technology is central to your civilization,",
" as technological progress brings with it",
" more construction options, improvements, and abilities"
],
[
"Most technologies are dependent on other technologies being researched - ",
" but you can choose a technology to aspire to,",
" and your civilization will research the necessary technologies to get there"
]
],
@ -155,32 +108,6 @@
]
World_Map: [
[
"The world map is made up of multiple tiles.",
"Each tile can contain units, resources and improvements, which we'll get to later.",
"The position of the icon tells you what it signifies.",
"For more details, you can click on the tile and see the tile information."
]
],
Tile_Clicked : [
[
"Clicking on a tile selects that tile,",
" and displays information on that tile on the bottom-right.",
"If the tile contains a unit, that will become the selected unit,"
" and its info and actions will be displayed on the bottom left."
]
],
Unit_Selected : [
[
"When a unit is selected, its information will be displayed on the bottom-left corner.",
"The available actions of that unit will appear above the tile information."
]
],
Unhappiness: [
[

View File

@ -21,8 +21,8 @@ android {
applicationId "com.unciv.app"
minSdkVersion 14
targetSdkVersion 29
versionCode 339
versionName "3.3.7"
versionCode 340
versionName "3.3.7-patch1"
archivesBaseName = "Unciv"
}

View File

@ -123,7 +123,8 @@ class UncivGame(val version: String) : Game() {
}
override fun dispose() {
GameSaver().autoSave(gameInfo)
if(::gameInfo.isInitialized)
GameSaver().autoSave(gameInfo)
}
companion object {

View File

@ -254,6 +254,8 @@ class CivilizationInfo {
.apply { diplomaticStatus = DiplomaticStatus.Peace }
popupAlerts.add(PopupAlert(AlertType.FirstContact,otherCiv.civName))
if(isCurrentPlayer() || otherCiv.isCurrentPlayer())
UncivGame.Current.settings.addMissionCompleted("Meet another civilization")
}
override fun toString(): String {return civName} // for debug

View File

@ -3,6 +3,7 @@ package com.unciv.logic.map
import com.badlogic.gdx.graphics.Color
import com.badlogic.gdx.math.Vector2
import com.unciv.Constants
import com.unciv.UncivGame
import com.unciv.logic.automation.UnitAutomation
import com.unciv.logic.automation.WorkerAutomation
import com.unciv.logic.civilization.CivilizationInfo
@ -324,6 +325,9 @@ class MapUnit {
val tile=getTile()
tile.turnsToImprovement -= 1
if (tile.turnsToImprovement != 0) return
if(civInfo.isCurrentPlayer())
UncivGame.Current.settings.addMissionCompleted("Construct an improvement")
when {
tile.improvementInProgress!!.startsWith("Remove") -> {
val tileImprovement = tile.getTileImprovement()

View File

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

View File

@ -423,7 +423,7 @@ class EmpireOverviewScreen : CameraStageBaseScreen(){
labelText = "???"
}
civGroup.background = ImageGetter.getTableBackground(backgroundColor)
civGroup.background = ImageGetter.getRoundedEdgeTableBackground(backgroundColor)
val label = labelText.toLabel(labelColor)
label.setAlignment(Align.center)

View File

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

View File

@ -55,6 +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")
}
}

View File

@ -1,6 +1,7 @@
package com.unciv.ui.newgamescreen
import com.badlogic.gdx.Gdx
import com.badlogic.gdx.scenes.scene2d.ui.ScrollPane
import com.badlogic.gdx.scenes.scene2d.ui.SelectBox
import com.badlogic.gdx.scenes.scene2d.ui.Skin
import com.badlogic.gdx.utils.Array
@ -31,7 +32,8 @@ class NewGameScreen: PickerScreen(){
setDefaultCloseAction()
val playerPickerTable = PlayerPickerTable(this, newGameParameters)
topTable.add(NewGameScreenOptionsTable(this) { playerPickerTable.update() })
val newGameScreenOptionsTable = NewGameScreenOptionsTable(this) { playerPickerTable.update() }
topTable.add(ScrollPane(newGameScreenOptionsTable)).height(topTable.parent.height)
topTable.add(playerPickerTable).pad(10f)
topTable.pack()
topTable.setFillParent(true)

View File

@ -23,7 +23,7 @@ class NewGameScreenOptionsTable(val newGameScreen: NewGameScreen, val onMultipla
val ruleset = newGameScreen.ruleSet
init {
pad(10f)
add("Map options".toLabel(fontSize = 24)).colspan(2).row()
addMapTypeSelection()

View File

@ -16,7 +16,7 @@ class TechButton(techName:String, val techManager: TechManager, isWorldScreen: B
init {
touchable = Touchable.enabled
defaults().pad(10f)
background = ImageGetter.getTableBackground()
background = ImageGetter.getRoundedEdgeTableBackground()
if (ImageGetter.techIconExists(techName))
add(ImageGetter.getTechIconGroup(techName, 60f))

View File

@ -51,6 +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")
if (isFreeTechPick) civTech.getFreeTechnology(selectedTech!!.name)
else civTech.techsToResearch = tempTechsToResearch
@ -59,7 +60,6 @@ class TechPickerScreen(internal val civInfo: CivilizationInfo, centerOnTech: Tec
dispose()
}
displayTutorials("Technology")
// per default show current/recent technology,
// and possibly select it to show description,

View File

@ -47,7 +47,7 @@ class CityButton(val city: CityInfo, internal val tileGroup: WorldTileGroup, ski
if (tileGroup.tileInfo.airUnits.isEmpty()) return
val secondarycolor = city.civInfo.nation.getInnerColor()
val airUnitTable = Table().apply { defaults().pad(5f) }
airUnitTable.background = ImageGetter.getTableBackground(city.civInfo.nation.getOuterColor())
airUnitTable.background = ImageGetter.getRoundedEdgeTableBackground(city.civInfo.nation.getOuterColor())
val aircraftImage = ImageGetter.getImage("OtherIcons/Aircraft")
aircraftImage.color = secondarycolor
airUnitTable.add(aircraftImage).size(15f)
@ -92,7 +92,7 @@ class CityButton(val city: CityInfo, internal val tileGroup: WorldTileGroup, ski
val secondaryColor = city.civInfo.nation.getInnerColor()
val iconTable = Table()
iconTable.touchable=Touchable.enabled
iconTable.background = ImageGetter.getTableBackground(city.civInfo.nation.getOuterColor())
iconTable.background = ImageGetter.getRoundedEdgeTableBackground(city.civInfo.nation.getOuterColor())
if (city.resistanceCounter > 0) {
val resistanceImage = ImageGetter.getImage("StatIcons/Resistance")

View File

@ -65,7 +65,7 @@ object ImageGetter {
else return textureRegionDrawables[whiteDotLocation]!!
}
fun getTableBackground(tintColor: Color?=null): Drawable? {
fun getRoundedEdgeTableBackground(tintColor: Color?=null): Drawable? {
val drawable = getDrawable("OtherIcons/civTableBackground")
drawable.minHeight=0f
drawable.minWidth=0f

View File

@ -35,7 +35,7 @@ class NotificationsScroll(internal val worldScreen: WorldScreen) : ScrollPane(nu
listItem.add(ImageGetter.getCircle()
.apply { color=notification.color }).size(10f).pad(5f)
listItem.background = ImageGetter.getTableBackground()
listItem.background = ImageGetter.getRoundedEdgeTableBackground()
listItem.add(label).pad(5f).padRight(10f)
// using a large click area with no gap in between each message item.

View File

@ -205,6 +205,7 @@ class TileMapHolder(internal val worldScreen: WorldScreen, internal val tileMap:
if (dto.unit.currentMovement > 0)
moveHereButton.onClick(""){
UncivGame.Current.settings.addMissionCompleted("Move unit")
UnitContextMenu(this, dto.unit, dto.tileInfo).onMoveButtonClick()
}

View File

@ -8,6 +8,7 @@ import com.badlogic.gdx.scenes.scene2d.actions.Actions
import com.badlogic.gdx.scenes.scene2d.ui.Button
import com.badlogic.gdx.scenes.scene2d.ui.Table
import com.badlogic.gdx.scenes.scene2d.ui.TextButton
import com.badlogic.gdx.utils.Align
import com.unciv.Constants
import com.unciv.UncivGame
import com.unciv.logic.GameSaver
@ -50,6 +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 notificationsScroll: NotificationsScroll
var alertPopupIsOpen = false // if we have an alert popup and then we changed screens, the old one shouldn't affect us
@ -87,6 +89,7 @@ class WorldScreen(val viewingCiv:CivilizationInfo) : CameraStageBaseScreen() {
stage.addActor(nextTurnButton)
stage.addActor(techPolicyandVictoryHolder)
stage.addActor(notificationsScroll)
stage.addActor(missionTable)
diplomacyButtonWrapper.defaults().pad(5f)
@ -99,8 +102,8 @@ class WorldScreen(val viewingCiv:CivilizationInfo) : CameraStageBaseScreen() {
stage.addActor(unitActionsTable)
displayTutorials("New_Game")
displayTutorials("World_Map")
// displayTutorials("New_Game")
// displayTutorials("World_Map")
createNextTurnButton() // needs civ table to be positioned
@ -165,6 +168,17 @@ class WorldScreen(val viewingCiv:CivilizationInfo) : CameraStageBaseScreen() {
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()
.apply { setAlignment(Align.center) }).pad(10f)
missionTable.pack()
missionTable.centerX(stage)
missionTable.y = topBar.y - missionTable.height
}
minimapWrapper.update(viewingCiv)
unitActionsTable.update(bottomUnitTable.selectedUnit)
unitActionsTable.y = bottomUnitTable.height
@ -200,6 +214,35 @@ class WorldScreen(val viewingCiv:CivilizationInfo) : CameraStageBaseScreen() {
}
private fun getCurrentMission(): String {
val completedMissions = game.settings.missionsCompleted
if(!completedMissions.contains("Move unit"))
return "Move a unit!\nClick on a unit > Click on a destination > Click the arrow popup"
if(!completedMissions.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"))
return "Enter the city screen!\nClick the city button twice"
if(!completedMissions.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"))
return "Pick a construction!\nEnter city screen > Click on a unit or building (left side)"
if(!completedMissions.contains("Pass a turn"))
return "Pass a turn!\nCycle through units with 'Next unit' > Click 'Next turn'"
if(!completedMissions.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"))
return "Meet another civilization!\nExplore the map until you encounter another civilization!"
if(!completedMissions.contains("Open the options table"))
return "Open the options table!\nClick the menu button (top left) > click 'Options'"
if(!completedMissions.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"
return ""
}
private fun displayTutorialsOnUpdate() {
if (UncivGame.Current.settings.hasCrashedRecently) {
displayTutorials("_GameCrashed")
@ -208,13 +251,6 @@ class WorldScreen(val viewingCiv:CivilizationInfo) : CameraStageBaseScreen() {
UncivGame.Current.settings.save()
}
if (bottomUnitTable.selectedUnit != null) displayTutorials("Unit_Selected")
if (viewingCiv.cities.isNotEmpty()){
displayTutorials("_City_Founded")
displayTutorials("First_Steps")
}
if (UncivGame.Current.settings.tutorialsShown.contains("Cities")) displayTutorials("Next_Turn")
if (!UncivGame.Current.settings.tutorialsShown.contains("_EnemyCityNeedsConqueringWithMeleeUnit")) {
for (enemyCity in viewingCiv.diplomacy.values.filter { it.diplomaticStatus == DiplomaticStatus.War }
@ -260,7 +296,7 @@ class WorldScreen(val viewingCiv:CivilizationInfo) : CameraStageBaseScreen() {
if (viewingCiv.tech.currentTechnology() == null) {
val buttonPic = Table()
buttonPic.background = ImageGetter.getTableBackground(colorFromRGB(7, 46, 43))
buttonPic.background = ImageGetter.getRoundedEdgeTableBackground(colorFromRGB(7, 46, 43))
buttonPic.defaults().pad(20f)
buttonPic.add("{Pick a tech}!".toLabel(Color.WHITE,30))
techButtonHolder.add(buttonPic)
@ -312,6 +348,7 @@ class WorldScreen(val viewingCiv:CivilizationInfo) : CameraStageBaseScreen() {
return@onClick
}
game.settings.addMissionCompleted("Pass a turn")
nextTurn() // If none of the above
}

View File

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

View File

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