Added city-state icon to diplomacy screen, so you know who's a city state and who's a major civ at a glance

This commit is contained in:
Yair Morgenstern 2019-05-17 13:03:59 +03:00
parent 2e16a96c4d
commit 862c714b47

View File

@ -48,10 +48,17 @@ class DiplomacyScreen:CameraStageBaseScreen() {
val currentPlayerCiv = UnCivGame.Current.gameInfo.getCurrentPlayerCivilization()
for (civ in UnCivGame.Current.gameInfo.civilizations
.filterNot { it.isDefeated() || it.isPlayerCivilization() || it.isBarbarianCivilization() }) {
if (!currentPlayerCiv.diplomacy.containsKey(civ.civName)) continue
if (!currentPlayerCiv.knows(civ.civName)) continue
val civIndicator = ImageGetter.getCircle().apply { color = civ.getNation().getSecondaryColor() }
.surroundWithCircle(100f).apply { circle.color = civ.getNation().getColor() }
if(civ.isCityState()){
val cityStateIcon = ImageGetter.getImage("OtherIcons/CityState.png")
cityStateIcon.setSize(70f,70f)
cityStateIcon.center(civIndicator)
civIndicator.addActor(cityStateIcon)
}
val relationship = ImageGetter.getCircle()
if(currentPlayerCiv.isAtWarWith(civ)) relationship.color = Color.RED
else relationship.color = Color.GREEN
@ -94,16 +101,16 @@ class DiplomacyScreen:CameraStageBaseScreen() {
diplomacyTable.defaults().pad(10f)
if (otherCiv.isCityState()) {
diplomacyTable.add(otherCiv.getNation().getLeaderDisplayName().toLabel()).row()
diplomacyTable.add(("Type : " + otherCiv.getCityStateType().toString()).toLabel()).row()
diplomacyTable.add(("Influence : " + otherCiv.getDiplomacyManager(currentPlayerCiv).influence.toInt().toString()).toLabel()).row()
diplomacyTable.add(("Type: " + otherCiv.getCityStateType().toString()).toLabel()).row()
diplomacyTable.add(("Influence: " + otherCiv.getDiplomacyManager(currentPlayerCiv).influence.toInt()+"/60").toLabel()).row()
if (otherCiv.getDiplomacyManager(currentPlayerCiv).influence >= 60) {
when(otherCiv.getCityStateType()) {
CityStateType.Cultured -> diplomacyTable.add(
("Providing " + (5.0f * currentPlayerCiv.getEra().ordinal).toString() + " culture each turn").toLabel())
CityStateType.Maritime -> diplomacyTable.add(
("Providing 3 food in capital and 1 food in other cities.").toLabel())
"Providing 3 food in capital and 1 food in other cities".toLabel())
CityStateType.Mercantile -> diplomacyTable.add(
("Providing 3 happiness.").toLabel())
"Providing 3 happiness".toLabel())
}
}
} else {
@ -111,8 +118,8 @@ class DiplomacyScreen:CameraStageBaseScreen() {
}
diplomacyTable.addSeparator()
val giftButton = TextButton("Give 100 gold".tr(), skin)
val giftAmount = 100
val giftButton = TextButton("Give [$giftAmount] gold".tr(), skin)
giftButton.onClick{ giveGoldGift(otherCiv,giftAmount ) }
diplomacyTable.add(giftButton).row()
if (currentPlayerCiv.gold < giftAmount ) giftButton.disable()