Can no longer enter diplomacy screen for self, defeated and spectator civs through diplomacy overview screen

This commit is contained in:
Yair Morgenstern 2021-04-20 22:18:11 +03:00
parent 9b4333a5b6
commit d674be2234
2 changed files with 9 additions and 6 deletions

View File

@ -8,6 +8,4 @@ object BuildConfig {
const val gdxVersion = "1.10.0" const val gdxVersion = "1.10.0"
const val roboVMVersion = "2.3.1" const val roboVMVersion = "2.3.1"
const val ashleyVersion = "1.7.0"
const val aiVersion = "1.8.0"
} }

View File

@ -98,7 +98,8 @@ class EmpireOverviewScreen(private var viewingPlayer:CivilizationInfo, defaultPa
fun update(){ fun update(){
clear() clear()
val relevantCivs = viewingPlayer.gameInfo.civilizations.filter { !it.isBarbarian() && (includeCityStates || !it.isCityState()) } val relevantCivs = viewingPlayer.gameInfo.civilizations
.filter { !it.isBarbarian() && (includeCityStates || !it.isCityState()) }
val diplomacyGroup = DiplomacyGroup(viewingPlayer, diplomacyGroupHeight, includeCityStates) val diplomacyGroup = DiplomacyGroup(viewingPlayer, diplomacyGroupHeight, includeCityStates)
val playerKnowsAndUndefeatedCivs = relevantCivs.filter { diplomacyGroup.playerKnows(it) && !it.isDefeated() } val playerKnowsAndUndefeatedCivs = relevantCivs.filter { diplomacyGroup.playerKnows(it) && !it.isDefeated() }
val playerKnowsAndDefeatedCivs = relevantCivs.filter { diplomacyGroup.playerKnows(it) && it.isDefeated() } val playerKnowsAndDefeatedCivs = relevantCivs.filter { diplomacyGroup.playerKnows(it) && it.isDefeated() }
@ -130,20 +131,23 @@ class EmpireOverviewScreen(private var viewingPlayer:CivilizationInfo, defaultPa
table.add(civInfo.civName.toLabel()).left() table.add(civInfo.civName.toLabel()).left()
table.touchable = Touchable.enabled table.touchable = Touchable.enabled
table.onClick { table.onClick {
if (civInfo.isDefeated() || viewingPlayer.isSpectator() || civInfo == viewingPlayer) return@onClick
UncivGame.Current.setScreen(DiplomacyScreen(viewingPlayer).apply { updateRightSide(civInfo) }) UncivGame.Current.setScreen(DiplomacyScreen(viewingPlayer).apply { updateRightSide(civInfo) })
} }
return table return table
} }
private fun getCivTableScroll(relevantCivs: List<CivilizationInfo>, titleTable: Table, private fun getCivTableScroll(relevantCivs: List<CivilizationInfo>, titleTable: Table,
playerKnowsAndUndefeatedCivs: List<CivilizationInfo>, playerKnowsAndDefeatedCivs: List<CivilizationInfo>): ScrollPane { playerKnowsAndUndefeatedCivs: List<CivilizationInfo>,
playerKnowsAndDefeatedCivs: List<CivilizationInfo>): ScrollPane {
val civTable = Table() val civTable = Table()
civTable.defaults().pad(5f) civTable.defaults().pad(5f)
civTable.background = ImageGetter.getBackground(Color.BLACK) civTable.background = ImageGetter.getBackground(Color.BLACK)
civTable.add("[${relevantCivs.size}] Civilizations in the game".toLabel()).pad(5f).colspan(2).row() civTable.add("[${relevantCivs.size}] Civilizations in the game".toLabel()).pad(5f).colspan(2).row()
civTable.add(titleTable).colspan(2).row() civTable.add(titleTable).colspan(2).row()
civTable.addSeparator() civTable.addSeparator()
civTable.add("Known and alive ([${playerKnowsAndUndefeatedCivs.size - 1}])".toLabel()).pad(5f).colspan(2).row() civTable.add("Known and alive ([${playerKnowsAndUndefeatedCivs.size - 1}])".toLabel())
.pad(5f).colspan(2).row()
if (playerKnowsAndUndefeatedCivs.size > 1) { if (playerKnowsAndUndefeatedCivs.size > 1) {
civTable.addSeparator() civTable.addSeparator()
playerKnowsAndUndefeatedCivs.filter { it != viewingPlayer }.forEach { playerKnowsAndUndefeatedCivs.filter { it != viewingPlayer }.forEach {
@ -152,7 +156,8 @@ class EmpireOverviewScreen(private var viewingPlayer:CivilizationInfo, defaultPa
} }
} }
civTable.addSeparator() civTable.addSeparator()
civTable.add("Known and defeated ([${playerKnowsAndDefeatedCivs.size}])".toLabel()).pad(5f).colspan(2).row() civTable.add("Known and defeated ([${playerKnowsAndDefeatedCivs.size}])".toLabel())
.pad(5f).colspan(2).row()
if (playerKnowsAndDefeatedCivs.isNotEmpty()) { if (playerKnowsAndDefeatedCivs.isNotEmpty()) {
civTable.addSeparator() civTable.addSeparator()
playerKnowsAndDefeatedCivs.forEach { playerKnowsAndDefeatedCivs.forEach {