mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-30 15:30:43 -04:00
Resolved #2112 - Show current resource amounts on incoming trade requests
This commit is contained in:
parent
5356e63249
commit
29e25747a8
@ -163,6 +163,7 @@ Introduction to [nation] =
|
|||||||
Declare war on [nation] =
|
Declare war on [nation] =
|
||||||
Luxury resources =
|
Luxury resources =
|
||||||
Strategic resources =
|
Strategic resources =
|
||||||
|
Owned: [amountOwned] =
|
||||||
|
|
||||||
# Nation picker
|
# Nation picker
|
||||||
|
|
||||||
|
@ -7,6 +7,7 @@ import com.unciv.Constants
|
|||||||
import com.unciv.logic.civilization.diplomacy.DiplomacyFlags
|
import com.unciv.logic.civilization.diplomacy.DiplomacyFlags
|
||||||
import com.unciv.logic.trade.TradeEvaluation
|
import com.unciv.logic.trade.TradeEvaluation
|
||||||
import com.unciv.logic.trade.TradeLogic
|
import com.unciv.logic.trade.TradeLogic
|
||||||
|
import com.unciv.logic.trade.TradeOffer
|
||||||
import com.unciv.logic.trade.TradeType
|
import com.unciv.logic.trade.TradeType
|
||||||
import com.unciv.models.translations.tr
|
import com.unciv.models.translations.tr
|
||||||
import com.unciv.ui.trade.DiplomacyScreen
|
import com.unciv.ui.trade.DiplomacyScreen
|
||||||
@ -34,10 +35,19 @@ class TradePopup(worldScreen: WorldScreen): Popup(worldScreen){
|
|||||||
tradeOffersTable.add("[${nation.name}]'s trade offer".toLabel())
|
tradeOffersTable.add("[${nation.name}]'s trade offer".toLabel())
|
||||||
tradeOffersTable.add("Our trade offer".toLabel())
|
tradeOffersTable.add("Our trade offer".toLabel())
|
||||||
tradeOffersTable.row()
|
tradeOffersTable.row()
|
||||||
|
val ourResources = viewingCiv.getCivResourcesByName()
|
||||||
|
|
||||||
|
fun getOfferText(offer:TradeOffer): String {
|
||||||
|
var tradeText = offer.getOfferText()
|
||||||
|
if (offer.type == TradeType.Luxury_Resource || offer.type == TradeType.Strategic_Resource)
|
||||||
|
tradeText += "\n" + "Owned: [${ourResources[offer.name]}]"
|
||||||
|
return tradeText
|
||||||
|
}
|
||||||
|
|
||||||
for(i in 0..max(trade.theirOffers.lastIndex, trade.ourOffers.lastIndex)){
|
for(i in 0..max(trade.theirOffers.lastIndex, trade.ourOffers.lastIndex)){
|
||||||
if(trade.theirOffers.lastIndex>=i) tradeOffersTable.add(trade.theirOffers[i].getOfferText().toLabel())
|
if(trade.theirOffers.lastIndex>=i) tradeOffersTable.add(getOfferText(trade.theirOffers[i]).toLabel())
|
||||||
else tradeOffersTable.add()
|
else tradeOffersTable.add()
|
||||||
if(trade.ourOffers.lastIndex>=i) tradeOffersTable.add(trade.ourOffers[i].getOfferText().toLabel())
|
if(trade.ourOffers.lastIndex>=i) tradeOffersTable.add(getOfferText(trade.ourOffers[i]).toLabel())
|
||||||
else tradeOffersTable.add()
|
else tradeOffersTable.add()
|
||||||
tradeOffersTable.row()
|
tradeOffersTable.row()
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user