Tutorials moved to a separate json file
This commit is contained in:
parent
b659e3b37d
commit
53e332e9e8
12 changed files with 169 additions and 100 deletions
|
@ -0,0 +1,150 @@
|
|||
|
||||
{
|
||||
PolicyPickerScreen: [
|
||||
[
|
||||
"Each turn, the culture you gain from all your ",
|
||||
" cities is added to your Civilization's culture.",
|
||||
"When you have enough culture, you may pick a ",
|
||||
" Social Policy, each one giving you a certain bonus."
|
||||
],
|
||||
[
|
||||
"The policies are organized into branches, with each",
|
||||
" branch providing a bonus ability when all policies ",
|
||||
" in the branch have been adopted."
|
||||
],
|
||||
[
|
||||
"With each policy adopted, and with each city built,",
|
||||
" the cost of adopting another policy rises - so choose wisely!"
|
||||
]
|
||||
],
|
||||
|
||||
CityEntered: [
|
||||
[
|
||||
"Welcome to your first city!",
|
||||
"As on now, you only have 1 population,",
|
||||
" but this will grow 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."
|
||||
],
|
||||
[
|
||||
"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 green population symbols on the tiles - ",
|
||||
" but of course, you can only assign population",
|
||||
" if you have idle population to spare!"
|
||||
],
|
||||
[
|
||||
"The center tile off 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"
|
||||
]
|
||||
],
|
||||
|
||||
ScienceVictoryScreenEntered : [
|
||||
[
|
||||
"This is the science victory screen, filter you",
|
||||
" can see your progress towards constructing a ",
|
||||
" spaceship to propel you towards the stars."
|
||||
],
|
||||
[
|
||||
"There are 6 spaceship parts you must build, ",
|
||||
" and they all require advanced technologies"
|
||||
],
|
||||
],
|
||||
|
||||
TechPickerScreen : [
|
||||
[
|
||||
"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"
|
||||
]
|
||||
],
|
||||
|
||||
TileClicked : [
|
||||
[
|
||||
"Clicking on a tile selects that tile,",
|
||||
" and displays information on that tile on the bottom-right,",
|
||||
" as well as unit actions, if the tile contains a unit"
|
||||
]
|
||||
],
|
||||
|
||||
CityFounded : [
|
||||
[
|
||||
"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."
|
||||
],
|
||||
[
|
||||
"Science is used to research technologies.",
|
||||
"You can enter the technology screen by clicking",
|
||||
" on the button on the top-left, underneath the bar",
|
||||
],
|
||||
[
|
||||
"You can click the city name to enter",
|
||||
" the city screen to assign population,",
|
||||
" choose production, and see information on the city"
|
||||
]
|
||||
],
|
||||
|
||||
NewGame: [
|
||||
[
|
||||
"Hello, and welcome to Unciv!",
|
||||
"Civilization games can be complex, so we'll",
|
||||
" be guiding you along your first journey.",
|
||||
"Before we begin, let's review some basic game concepts."
|
||||
],
|
||||
[
|
||||
"This is the world map, which is made up of multiple tiles.",
|
||||
"Each tile can contain units, as well as resources",
|
||||
" and improvements, which we'll get to later"
|
||||
],
|
||||
[
|
||||
"You start out with two units -",
|
||||
" a Settler - who can found a city,",
|
||||
" and a scout, for exploring the area.",
|
||||
" Click on a tile to assign orders the unit!"
|
||||
]
|
||||
],
|
||||
|
||||
AfterCityEntered : [
|
||||
[
|
||||
"Once you've done everything you can, ",
|
||||
"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."
|
||||
]
|
||||
],
|
||||
|
||||
NextTurn: [
|
||||
[
|
||||
"In your first couple of turns,",
|
||||
" you will have very little options,",
|
||||
" but as your civilization grows, so do the ",
|
||||
" number of things requiring your attention"
|
||||
]
|
||||
]
|
||||
|
||||
}
|
|
@ -5,7 +5,6 @@ sourceCompatibility = 1.6
|
|||
|
||||
sourceSets.main.java.srcDirs = [ "src/" ]
|
||||
|
||||
|
||||
eclipse.project {
|
||||
name = appName + "-core"
|
||||
}
|
||||
|
|
|
@ -9,4 +9,5 @@ object GameBasics {
|
|||
val Helps = LinkedHashMap<String, BasicHelp>()
|
||||
val Units = LinkedHashMap<String, Unit>()
|
||||
val PolicyBranches = LinkedHashMap<String, PolicyBranch>()
|
||||
val Tutorials = LinkedHashMap<String, List<String>>()
|
||||
}
|
|
@ -25,15 +25,7 @@ class ScienceVictoryScreen(internal val civInfo: CivilizationInfo) : PickerScree
|
|||
descriptionLabel.setText("You must build the Apollo Program before you can build spaceship parts!")
|
||||
else
|
||||
descriptionLabel.setText("Apollo program is built - you may construct spaceship parts in your cities!")
|
||||
|
||||
val tutorial = ArrayList<String>()
|
||||
tutorial.add("This is the science victory screen, filter you" +
|
||||
"\r\n can see your progress towards constructing a " +
|
||||
"\r\n spaceship to propel you towards the stars.")
|
||||
tutorial.add("There are 6 spaceship parts you must build, " + "\r\n and they all require advanced technologies")
|
||||
if (!civInfo.buildingUniques.contains("ApolloProgram"))
|
||||
tutorial.add("You can start constructing spaceship parts" + "\r\n only after you have finished the Apollo Program")
|
||||
displayTutorials("ScienceVictoryScreenEntered", tutorial)
|
||||
displayTutorials("ScienceVictoryScreenEntered")
|
||||
}
|
||||
|
||||
private fun addPartButton(partName: String, parts: Counter<String>) {
|
||||
|
|
|
@ -72,6 +72,12 @@ class UnCivGame : Game() {
|
|||
GameBasics.Units += createHashmap(getFromJson(Array<Unit>::class.java, "Units"))
|
||||
GameBasics.PolicyBranches += createHashmap(getFromJson(Array<PolicyBranch>::class.java, "Policies"))
|
||||
|
||||
// ...Yes. Total Voodoo. I wish I didn't have to do this.
|
||||
val x = LinkedHashMap<String,com.badlogic.gdx.utils.Array<com.badlogic.gdx.utils.Array<String>>>()
|
||||
val tutorials = getFromJson(x.javaClass, "Tutorials")
|
||||
for (tut in tutorials)
|
||||
GameBasics.Tutorials.put(tut.key,tut.value.map{it.joinToString("\r\n")})
|
||||
|
||||
val techColumns = getFromJson(Array<TechColumn>::class.java, "Techs")
|
||||
for (techColumn in techColumns) {
|
||||
for (tech in techColumn.techs) {
|
||||
|
|
|
@ -57,28 +57,7 @@ class CityScreen(internal val city: CityInfo) : CameraStageBaseScreen() {
|
|||
stage.addActor(cityPickerTable)
|
||||
stage.addActor(buildingsTableContainer)
|
||||
update()
|
||||
|
||||
val tutorial = mutableListOf<String>()
|
||||
tutorial.add("Welcome to your first city!" +
|
||||
"\r\nAs on now, you only have 1 population," +
|
||||
"\r\n but this will grow when you amass enough surplus food")
|
||||
tutorial.add("Similarly, your city's borders grow when you" +
|
||||
"\r\n amass enough culture, which is not generated" +
|
||||
"\r\n by tiles but rather by buildings.")
|
||||
tutorial.add("Each population in your city can work" + "\r\n a single tile, providing the city with that tile's yields.")
|
||||
tutorial.add("Population can be assigned and unassigned" +
|
||||
"\r\n by clicking on the green population symbols on the tiles - " +
|
||||
"\r\n but of course, you can only assign population" +
|
||||
"\r\n if you have idle population to spare!")
|
||||
tutorial.add("The center tile off a city is always worked," +
|
||||
"\r\n and doesn't require population," +
|
||||
"\r\n but it cannot be improved by tile improvements.")
|
||||
tutorial.add("The city's production always goes towards the" +
|
||||
"\r\n current construction - you can pick the city's" +
|
||||
"\r\n construction by clicking on the construction" +
|
||||
"\r\n button on the bottom-left")
|
||||
|
||||
displayTutorials("CityEntered", tutorial)
|
||||
displayTutorials("CityEntered")
|
||||
}
|
||||
|
||||
internal fun update() {
|
||||
|
|
|
@ -18,18 +18,8 @@ class PolicyPickerScreen(internal val civInfo: CivilizationInfo) : PickerScreen(
|
|||
private var pickedPolicy: Policy? = null
|
||||
|
||||
init {
|
||||
|
||||
val policies = civInfo.policies
|
||||
val tutorial = mutableListOf<String>()
|
||||
tutorial.add("Each turn, the culture you gain from all your " +
|
||||
"\r\n cities is added to your Civilization's culture." +
|
||||
"\r\nWhen you have enough culture, you may pick a " +
|
||||
"\r\n Social Policy, each one giving you a certain bonus.")
|
||||
tutorial.add("The policies are organized into branches, with each" +
|
||||
"\r\n branch providing a bonus ability when all policies " +
|
||||
"\r\n in the branch have been adopted.")
|
||||
tutorial.add("With each policy adopted, and with each city built," + "\r\n the cost of adopting another policy rises - so choose wisely!")
|
||||
displayTutorials("PolicyPickerScreen", tutorial)
|
||||
displayTutorials("PolicyPickerScreen")
|
||||
|
||||
rightSideButton.setText("Adopt policy\r\n(" + policies.storedCulture + "/" + policies.getCultureNeededForNextPolicy() + ")")
|
||||
|
||||
|
|
|
@ -68,16 +68,7 @@ class TechPickerScreen(internal val civInfo: CivilizationInfo) : PickerScreen()
|
|||
dispose()
|
||||
}
|
||||
|
||||
val tutorial = mutableListOf<String>()
|
||||
tutorial.add("Technology is central to your civilization," +
|
||||
"\r\n as technological progress brings with it" +
|
||||
"\r\n more construction options, improvements, and abilities")
|
||||
tutorial.add("Most technologies are dependant on" +
|
||||
"\r\n other technologies being researched - " +
|
||||
"\r\n but you can choose a technology to aspire to," +
|
||||
"\r\n and your civilization will research the" +
|
||||
"\r\n necessary technologies to get there")
|
||||
displayTutorials("TechPickerScreen", tutorial)
|
||||
displayTutorials("TechPickerScreen")
|
||||
}
|
||||
|
||||
fun setButtonsInfo() {
|
||||
|
|
|
@ -13,6 +13,7 @@ import com.badlogic.gdx.scenes.scene2d.ui.Table
|
|||
import com.badlogic.gdx.scenes.scene2d.ui.TextButton
|
||||
import com.badlogic.gdx.utils.Align
|
||||
import com.badlogic.gdx.utils.viewport.ExtendViewport
|
||||
import com.unciv.models.gamebasics.GameBasics
|
||||
import com.unciv.ui.UnCivGame
|
||||
import com.unciv.ui.cityscreen.addClickListener
|
||||
|
||||
|
@ -54,9 +55,10 @@ open class CameraStageBaseScreen : Screen {
|
|||
|
||||
override fun dispose() {}
|
||||
|
||||
fun displayTutorials(name: String, texts: List<String>) {
|
||||
fun displayTutorials(name: String) {
|
||||
if (game.gameInfo.tutorial.contains(name)) return
|
||||
game.gameInfo.tutorial.add(name)
|
||||
val texts = GameBasics.Tutorials.get(name)!!
|
||||
tutorialTexts.addAll(texts)
|
||||
if (!isTutorialShowing) displayTutorial()
|
||||
}
|
||||
|
|
|
@ -29,11 +29,7 @@ class TileMapHolder(internal val worldScreen: WorldScreen, internal val tileMap:
|
|||
val group = WorldTileGroup(tileInfo)
|
||||
|
||||
group.addClickListener {
|
||||
val tutorial = mutableListOf<String>()
|
||||
tutorial.add("Clicking on a tile selects that tile," +
|
||||
"\r\n and displays information on that tile on the bottom-right," +
|
||||
"\r\n as well as unit actions, if the tile contains a unit")
|
||||
worldScreen.displayTutorials("TileClicked", tutorial)
|
||||
worldScreen.displayTutorials("TileClicked")
|
||||
|
||||
selectedTile = tileInfo
|
||||
worldScreen.unitTable.tileSelected(tileInfo)
|
||||
|
|
|
@ -47,32 +47,13 @@ class WorldScreen : CameraStageBaseScreen() {
|
|||
tileMapHolder.setCenterPosition(Vector2.Zero)
|
||||
createNextTurnButton() // needs civ table to be positioned
|
||||
stage.addActor(optionsTable)
|
||||
|
||||
val beginningTutorial = mutableListOf<String>()
|
||||
beginningTutorial.add("Hello, and welcome to Unciv!" +
|
||||
"\r\nCivilization games can be complex, so we'll" +
|
||||
"\r\n be guiding you along your first journey." +
|
||||
"\r\nBefore we begin, let's review some basic game concepts.")
|
||||
beginningTutorial.add("This is the world map, which is made up of multiple tiles." +
|
||||
"\r\nEach tile can contain units, as well as resources" +
|
||||
"\r\n and improvements, which we'll get to later")
|
||||
beginningTutorial.add("You start out with two units -" +
|
||||
"\r\n a Settler - who can found a city," +
|
||||
"\r\n and a scout, for exploring the area." +
|
||||
"\r\n Click on a tile to assign orders the unit!")
|
||||
|
||||
displayTutorials("NewGame", beginningTutorial)
|
||||
displayTutorials("NewGame")
|
||||
}
|
||||
|
||||
|
||||
fun update() {
|
||||
if (game.gameInfo.tutorial.contains("CityEntered")) {
|
||||
val tutorial = ArrayList<String>()
|
||||
tutorial.add("Once you've done everything you can, " + "\r\nclick the next turn button on the top right to continue.")
|
||||
tutorial.add("Each turn, science, culture and gold are added" +
|
||||
"\r\n to your civilization, your cities' construction" +
|
||||
"\r\n continues, and they may grow in population or area.")
|
||||
displayTutorials("NextTurn", tutorial)
|
||||
displayTutorials("AfterCityEntered")
|
||||
}
|
||||
|
||||
updateTechButton()
|
||||
|
@ -121,13 +102,7 @@ class WorldScreen : CameraStageBaseScreen() {
|
|||
unitTable.currentlyExecutingAction = null
|
||||
GameSaver.SaveGame(game, "Autosave")
|
||||
update()
|
||||
|
||||
val tutorial = ArrayList<String>()
|
||||
tutorial.add("In your first couple of turns," +
|
||||
"\r\n you will have very little options," +
|
||||
"\r\n but as your civilization grows, so do the " +
|
||||
"\r\n number of things requiring your attention")
|
||||
displayTutorials("NextTurn", tutorial)
|
||||
displayTutorials("NextTurn")
|
||||
}
|
||||
|
||||
nextTurnButton.setPosition(stage.width - nextTurnButton.width - 10f,
|
||||
|
|
|
@ -60,19 +60,7 @@ class UnitActions {
|
|||
actionList += getUnitActionButton(unit, "Found City",
|
||||
!tileMapHolder.tileMap.getTilesInDistance(tile.position, 2).any { it.isCityCenter },
|
||||
{
|
||||
val tutorial = mutableListOf<String>()
|
||||
tutorial.add("You have founded a city!" +
|
||||
"\r\nCities are the lifeblood of your empire," +
|
||||
"\r\n providing gold and science empire-wide," +
|
||||
"\r\n which are displayed on the top bar.")
|
||||
tutorial.add("Science is used to research technologies." +
|
||||
"\r\nYou can enter the technology screen by clicking" +
|
||||
"\r\n on the button on the top-left, underneath the bar")
|
||||
tutorial.add("You can click the city name to enter" +
|
||||
"\r\n the city screen to assign population," +
|
||||
"\r\n choose production, and see information on the city")
|
||||
|
||||
worldScreen.displayTutorials("CityFounded", tutorial)
|
||||
worldScreen.displayTutorials("CityFounded")
|
||||
|
||||
unit.civInfo.addCity(tile.position)
|
||||
unitTable.currentlyExecutingAction = null // In case the settler was in the middle of doing something and we then founded a city with it
|
||||
|
|
Loading…
Reference in a new issue