Unified civ display in Overview and Victory screens
This commit is contained in:
parent
227f6627be
commit
a6d1cdc398
4 changed files with 35 additions and 29 deletions
Binary file not shown.
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 2.2 KiB |
Binary file not shown.
Before Width: | Height: | Size: 1,006 KiB After Width: | Height: | Size: 1,006 KiB |
|
@ -311,27 +311,8 @@ class EmpireOverviewScreen : CameraStageBaseScreen(){
|
|||
val civGroups = HashMap<String, Actor>()
|
||||
for(i in 0..relevantCivs.lastIndex){
|
||||
val civ = relevantCivs[i]
|
||||
val civGroup = Table()
|
||||
val civGroupBackground = ImageGetter.getDrawable("OtherIcons/civTableBackground.png")
|
||||
|
||||
var civNameText = civ.civName.tr()
|
||||
if(civ.isDefeated()) civNameText += "\n({Defeated})".tr()
|
||||
val label = civNameText.toLabel()
|
||||
label.setAlignment(Align.center)
|
||||
|
||||
if (civ.isDefeated()) {
|
||||
civGroup.background = civGroupBackground.tint(Color.LIGHT_GRAY)
|
||||
label.setFontColor(Color.BLACK)
|
||||
} else if (playerKnows(civ)) {
|
||||
civGroup.background = civGroupBackground.tint(civ.getNation().getColor())
|
||||
label.setFontColor(civ.getNation().getSecondaryColor())
|
||||
} else {
|
||||
civGroup.background = civGroupBackground.tint(Color.DARK_GRAY)
|
||||
label.setText("???")
|
||||
}
|
||||
|
||||
civGroup.add(label).pad(10f)
|
||||
civGroup.pack()
|
||||
val civGroup = getCivGroup(civ, "", currentPlayerCivInfo)
|
||||
|
||||
val vector = HexMath().getVectorForAngle(2 * Math.PI.toFloat() *i / relevantCivs.size)
|
||||
civGroup.center(group)
|
||||
|
@ -394,4 +375,32 @@ class EmpireOverviewScreen : CameraStageBaseScreen(){
|
|||
|
||||
return resourcesTable
|
||||
}
|
||||
|
||||
companion object {
|
||||
fun getCivGroup(civ: CivilizationInfo, afterCivNameText:String,currentPlayer:CivilizationInfo): Table {
|
||||
val civGroup = Table()
|
||||
val civGroupBackground = ImageGetter.getDrawable("OtherIcons/civTableBackground.png")
|
||||
|
||||
val civNameText = civ.civName.tr()+afterCivNameText
|
||||
val label = civNameText.toLabel()
|
||||
label.setAlignment(Align.center)
|
||||
|
||||
if (civ.isDefeated()) {
|
||||
civGroup.background = civGroupBackground.tint(Color.LIGHT_GRAY)
|
||||
civGroup.add(ImageGetter.getImage("OtherIcons/DisbandUnit")).size(30f)
|
||||
label.setFontColor(Color.BLACK)
|
||||
} else if (currentPlayer==civ || currentPlayer.knows(civ)) {
|
||||
civGroup.background = civGroupBackground.tint(civ.getNation().getColor())
|
||||
label.setFontColor(civ.getNation().getSecondaryColor())
|
||||
} else {
|
||||
civGroup.background = civGroupBackground.tint(Color.DARK_GRAY)
|
||||
label.setText("???")
|
||||
}
|
||||
|
||||
civGroup.add(ImageGetter.getNationIndicator(civ.getNation(), 30f))
|
||||
civGroup.add(label).pad(10f)
|
||||
civGroup.pack()
|
||||
return civGroup
|
||||
}
|
||||
}
|
||||
}
|
|
@ -167,13 +167,12 @@ class VictoryScreen : PickerScreen() {
|
|||
dominationVictoryColumn.add("Undefeated civs".toLabel()).row()
|
||||
dominationVictoryColumn.addSeparator()
|
||||
|
||||
for (civ in majorCivs.filter { !it.isDefeated() }) {
|
||||
val civName = if(playerCivInfo.knows(civ) || playerCivInfo==civ) civ.civName.tr() else "???"
|
||||
dominationVictoryColumn.add(TextButton(civName, skin).apply { color = Color.GREEN }).row()
|
||||
}
|
||||
for (civ in majorCivs.filter { !it.isDefeated() })
|
||||
dominationVictoryColumn.add(EmpireOverviewScreen.getCivGroup(civ, "", playerCivInfo)).row()
|
||||
|
||||
for (civ in majorCivs.filter { it.isDefeated() })
|
||||
dominationVictoryColumn.add(TextButton(civ.civName.tr(), skin).apply { color = Color.GRAY }).row()
|
||||
dominationVictoryColumn.add(EmpireOverviewScreen.getCivGroup(civ, "", playerCivInfo)).row()
|
||||
|
||||
return dominationVictoryColumn
|
||||
}
|
||||
|
||||
|
@ -189,8 +188,7 @@ class VictoryScreen : PickerScreen() {
|
|||
.sortedByDescending { it.branchesCompleted }
|
||||
|
||||
for (entry in civsToBranchesCompleted) {
|
||||
val civName = if(playerCivInfo.knows(entry.civ) || playerCivInfo==entry.civ) entry.civ.civName.tr() else "???"
|
||||
policyVictoryColumn.add(TextButton(civName + " - " + entry.branchesCompleted, skin)).row()
|
||||
policyVictoryColumn.add(EmpireOverviewScreen.getCivGroup(entry.civ, " - " + entry.branchesCompleted, playerCivInfo)).row()
|
||||
}
|
||||
return policyVictoryColumn
|
||||
}
|
||||
|
@ -208,8 +206,7 @@ class VictoryScreen : PickerScreen() {
|
|||
}
|
||||
|
||||
for (entry in civsToPartsRemaining) {
|
||||
val civName = if(playerCivInfo.knows(entry.civ) || playerCivInfo==entry.civ) entry.civ.civName.tr() else "???"
|
||||
scientificVictoryColumn.add(TextButton(civName + " - " + entry.partsRemaining, skin)).row()
|
||||
scientificVictoryColumn.add(EmpireOverviewScreen.getCivGroup(entry.civ, " - " + entry.partsRemaining, playerCivInfo)).row()
|
||||
}
|
||||
return scientificVictoryColumn
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue