I don't think you should be able to see other tech's tech trees from the victory screen.

This commit is contained in:
Yair Morgenstern
2019-11-28 19:57:55 +02:00
parent cc5ba4412e
commit d0975ebc38
3 changed files with 24 additions and 32 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

View File

@ -12,7 +12,6 @@ import com.unciv.models.gamebasics.tr
import com.unciv.ui.newgamescreen.NewGameScreen
import com.unciv.ui.pickerscreens.PickerScreen
import com.unciv.ui.pickerscreens.PolicyPickerScreen
import com.unciv.ui.pickerscreens.TechPickerScreen
import com.unciv.ui.utils.addSeparator
import com.unciv.ui.utils.enable
import com.unciv.ui.utils.onClick
@ -228,11 +227,6 @@ class VictoryScreen : PickerScreen() {
for (entry in civsToPartsRemaining) {
val civToPartsBeRemaining=(EmpireOverviewScreen.getCivGroup(entry.civ, " - " + entry.partsRemaining, playerCivInfo))
scientificVictoryColumn.add(civToPartsBeRemaining).row()
civToPartsBeRemaining.touchable= Touchable.enabled
civToPartsBeRemaining.onClick {
game.setScreen(TechPickerScreen(entry.civ, false))
dispose()
}
}
return scientificVictoryColumn
}

View File

@ -15,7 +15,7 @@ import com.unciv.ui.utils.*
import java.util.*
class TechPickerScreen(internal val civInfo: CivilizationInfo, switchfromWorldScreen: Boolean = true, centerOnTech: Technology? = null) : PickerScreen() {
class TechPickerScreen(internal val civInfo: CivilizationInfo, centerOnTech: Technology? = null) : PickerScreen() {
private var techNameToButton = HashMap<String, TechButton>()
private var isFreeTechPick: Boolean = false
@ -61,32 +61,10 @@ class TechPickerScreen(internal val civInfo: CivilizationInfo, switchfromWorldSc
}
// Create tech table (row by row)
for (i in 0..9) {
topTable.row().pad(5f).padRight(40f)
for (j in techMatrix.indices) {
val tech = techMatrix[j][i]
if (tech == null)
topTable.add() // empty cell
else {
val techButton = TechButton(tech.name, civTech,false)
techNameToButton[tech.name] = techButton
techButton.onClick { selectTechnology(tech, false, switchfromWorldScreen) }
topTable.add(techButton)
}
}
}
createTechTable(techMatrix)
setButtonsInfo()
if (!switchfromWorldScreen){
rightSideButton.apply {
disable()
setText("Tech Tree Of [${civInfo.civName}]".tr())
}
}
else rightSideButton.setText("Pick a tech".tr())
rightSideButton.setText("Pick a tech".tr())
rightSideButton.onClick("paper") {
if (isFreeTechPick) civTech.getFreeTechnology(selectedTech!!.name)
else civTech.techsToResearch = tempTechsToResearch
@ -105,12 +83,32 @@ class TechPickerScreen(internal val civInfo: CivilizationInfo, switchfromWorldSc
if (tech != null) {
// select only if there it doesn't mess up tempTechsToResearch
if (civInfo.tech.isResearched(tech.name) || civInfo.tech.techsToResearch.size <= 1)
selectTechnology(tech, true, switchfromWorldScreen)
selectTechnology(tech, true)
else centerOnTechnology(tech)
}
}
private fun createTechTable(techMatrix: Array<Array<Technology?>>) {
for (i in 0..9) {
topTable.row().pad(5f).padRight(40f)
for (j in techMatrix.indices) {
val tech = techMatrix[j][i]
if (tech == null)
topTable.add() // empty cell
else {
val techButton = TechButton(tech.name, civTech, false)
techNameToButton[tech.name] = techButton
techButton.onClick { selectTechnology(tech, false) }
topTable.add(techButton)
}
}
}
}
private fun setButtonsInfo() {
for (techName in techNameToButton.keys) {
val techButton = techNameToButton[techName]!!