Resolved #429 - display era names only once in tech picker screen

This commit is contained in:
Yair Morgenstern 2019-01-23 20:52:26 +02:00
parent a4175438a3
commit 478a9e6996
3 changed files with 18 additions and 9 deletions

View File

@ -21,8 +21,8 @@ android {
applicationId "com.unciv.app"
minSdkVersion 14
targetSdkVersion 28
versionCode 194
versionName "2.12.3"
versionCode 195
versionName "2.12.4"
}
// Had to add this crap for Travis to build, it wanted to sign the app

View File

@ -58,11 +58,6 @@ class GameInfo {
while(thisPlayer.playerType==PlayerType.AI){
NextTurnAutomation().automateCivMoves(thisPlayer)
// if (thisPlayer.tech.techsToResearch.isEmpty()) { // should belong in automation? yes/no?
// val researchableTechs = GameBasics.Technologies.values
// .filter { !thisPlayer.tech.isResearched(it.name) && thisPlayer.tech.canBeResearched(it.name) }
// thisPlayer.tech.techsToResearch.add(researchableTechs.minBy { it.cost }!!.name)
// }
switchTurn()
}

View File

@ -10,6 +10,7 @@ import com.unciv.models.gamebasics.tech.Technology
import com.unciv.models.gamebasics.tr
import com.unciv.ui.utils.*
import java.util.*
import kotlin.collections.HashSet
class TechPickerScreen(internal val civInfo: CivilizationInfo) : PickerScreen() {
@ -49,10 +50,12 @@ class TechPickerScreen(internal val civInfo: CivilizationInfo) : PickerScreen()
techMatrix[technology.column!!.columnNumber][technology.row - 1] = technology
}
val alreadyDisplayedEras = HashSet<String>()
val eras = ArrayList<Label>()
for(i in techMatrix.indices) eras.add(Label("",CameraStageBaseScreen.skin).apply { setFontColor(Color.WHITE) })
eras.forEach { topTable.add(it) }
// Create tech table (row by row)
for (i in 0..9) {
topTable.row().pad(5f)
@ -69,12 +72,23 @@ class TechPickerScreen(internal val civInfo: CivilizationInfo) : PickerScreen()
selectTechnology(tech)
}
topTable.add(techButton)
if(eras[j].text.toString()=="") // name of era was not yet set
eras[j].setText((tech.era().toString()+" era").tr())
}
}
}
// Set era names (column by column)
for(j in techMatrix.indices)
for(i in 0..9)
{
val tech = techMatrix[j][i]
if(tech==null) continue
val eraName = tech.era().name
if(!alreadyDisplayedEras.contains(eraName)) { // name of era was not yet set
eras[j].setText("$eraName era".tr())
alreadyDisplayedEras.add(eraName)
}
}
setButtonsInfo()
rightSideButton.setText("Pick a tech".tr())