Resolved #2979 - Display countdown to negotiate peace in diplomacy screen
This commit is contained in:
parent
6d7903eb93
commit
0c1e318334
3 changed files with 10 additions and 3 deletions
|
@ -489,6 +489,7 @@ class DiplomacyManager() {
|
|||
|
||||
fun hasFlag(flag:DiplomacyFlags) = flagsCountdown.containsKey(flag.name)
|
||||
fun setFlag(flag: DiplomacyFlags, amount: Int){ flagsCountdown[flag.name]=amount}
|
||||
fun getFlag(flag: DiplomacyFlags) = flagsCountdown[flag.name]!!
|
||||
fun removeFlag(flag: DiplomacyFlags){ flagsCountdown.remove(flag.name)}
|
||||
|
||||
fun addModifier(modifier: DiplomaticModifiers, amount:Float){
|
||||
|
|
|
@ -4,6 +4,7 @@ import com.unciv.Constants
|
|||
import com.unciv.UncivGame
|
||||
import com.unciv.models.metadata.GameSpeed
|
||||
import com.unciv.models.translations.tr
|
||||
import com.unciv.ui.utils.Fonts
|
||||
|
||||
data class TradeOffer(var name:String, var type: TradeType, var amount:Int=1, var duration:Int=-1) {
|
||||
|
||||
|
@ -33,7 +34,7 @@ data class TradeOffer(var name:String, var type: TradeType, var amount:Int=1, va
|
|||
else -> name
|
||||
}.tr()
|
||||
if (type !in tradesToNotHaveNumbers || name=="Research Agreement") offerText += " ($amount)"
|
||||
if (duration > 0) offerText += "\n" + duration + " {turns}".tr()
|
||||
if (duration > 0) offerText += "\n" + duration + Fonts.turn
|
||||
return offerText
|
||||
}
|
||||
|
||||
|
|
|
@ -209,8 +209,13 @@ class DiplomacyScreen(val viewingCiv:CivilizationInfo):CameraStageBaseScreen() {
|
|||
tradeTable.tradeLogic.currentTrade.ourOffers.add(peaceTreaty)
|
||||
tradeTable.offerColumnsTable.update()
|
||||
}
|
||||
if (isNotPlayersTurn() || otherCivDiplomacyManager.hasFlag(DiplomacyFlags.DeclaredWar))
|
||||
if (isNotPlayersTurn() || otherCivDiplomacyManager.hasFlag(DiplomacyFlags.DeclaredWar)) {
|
||||
negotiatePeaceButton.disable() // Can't trade for 10 turns after war was declared
|
||||
if (otherCivDiplomacyManager.hasFlag(DiplomacyFlags.DeclaredWar)) {
|
||||
val turnsLeft = otherCivDiplomacyManager.getFlag(DiplomacyFlags.DeclaredWar)
|
||||
negotiatePeaceButton.setText(negotiatePeaceButton.text.toString() + "\n$turnsLeft" + Fonts.turn)
|
||||
}
|
||||
}
|
||||
|
||||
diplomacyTable.add(negotiatePeaceButton).row()
|
||||
}
|
||||
|
@ -365,7 +370,7 @@ class DiplomacyScreen(val viewingCiv:CivilizationInfo):CameraStageBaseScreen() {
|
|||
val turnsToPeaceTreaty = diplomacyManager.turnsToPeaceTreaty()
|
||||
if (turnsToPeaceTreaty > 0) {
|
||||
declareWarButton.disable()
|
||||
declareWarButton.setText(declareWarButton.text.toString() + " ($turnsToPeaceTreaty)")
|
||||
declareWarButton.setText(declareWarButton.text.toString() + " ($turnsToPeaceTreaty${Fonts.turn})")
|
||||
}
|
||||
declareWarButton.onClick {
|
||||
YesNoPopup("Declare war on [${otherCiv.civName}]?".tr(), {
|
||||
|
|
Loading…
Reference in a new issue