mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-27 13:55:54 -04:00
Resolved #429 - display era names only once in tech picker screen
This commit is contained in:
parent
a4175438a3
commit
478a9e6996
@ -21,8 +21,8 @@ android {
|
|||||||
applicationId "com.unciv.app"
|
applicationId "com.unciv.app"
|
||||||
minSdkVersion 14
|
minSdkVersion 14
|
||||||
targetSdkVersion 28
|
targetSdkVersion 28
|
||||||
versionCode 194
|
versionCode 195
|
||||||
versionName "2.12.3"
|
versionName "2.12.4"
|
||||||
}
|
}
|
||||||
|
|
||||||
// Had to add this crap for Travis to build, it wanted to sign the app
|
// Had to add this crap for Travis to build, it wanted to sign the app
|
||||||
|
@ -58,11 +58,6 @@ class GameInfo {
|
|||||||
|
|
||||||
while(thisPlayer.playerType==PlayerType.AI){
|
while(thisPlayer.playerType==PlayerType.AI){
|
||||||
NextTurnAutomation().automateCivMoves(thisPlayer)
|
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()
|
switchTurn()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10,6 +10,7 @@ import com.unciv.models.gamebasics.tech.Technology
|
|||||||
import com.unciv.models.gamebasics.tr
|
import com.unciv.models.gamebasics.tr
|
||||||
import com.unciv.ui.utils.*
|
import com.unciv.ui.utils.*
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
import kotlin.collections.HashSet
|
||||||
|
|
||||||
|
|
||||||
class TechPickerScreen(internal val civInfo: CivilizationInfo) : PickerScreen() {
|
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
|
techMatrix[technology.column!!.columnNumber][technology.row - 1] = technology
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val alreadyDisplayedEras = HashSet<String>()
|
||||||
val eras = ArrayList<Label>()
|
val eras = ArrayList<Label>()
|
||||||
for(i in techMatrix.indices) eras.add(Label("",CameraStageBaseScreen.skin).apply { setFontColor(Color.WHITE) })
|
for(i in techMatrix.indices) eras.add(Label("",CameraStageBaseScreen.skin).apply { setFontColor(Color.WHITE) })
|
||||||
eras.forEach { topTable.add(it) }
|
eras.forEach { topTable.add(it) }
|
||||||
|
|
||||||
|
// Create tech table (row by row)
|
||||||
for (i in 0..9) {
|
for (i in 0..9) {
|
||||||
topTable.row().pad(5f)
|
topTable.row().pad(5f)
|
||||||
|
|
||||||
@ -69,12 +72,23 @@ class TechPickerScreen(internal val civInfo: CivilizationInfo) : PickerScreen()
|
|||||||
selectTechnology(tech)
|
selectTechnology(tech)
|
||||||
}
|
}
|
||||||
topTable.add(techButton)
|
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()
|
setButtonsInfo()
|
||||||
|
|
||||||
rightSideButton.setText("Pick a tech".tr())
|
rightSideButton.setText("Pick a tech".tr())
|
||||||
|
Loading…
x
Reference in New Issue
Block a user