diff --git a/core/src/com/unciv/ui/trade/OffersListScroll.kt b/core/src/com/unciv/ui/trade/OffersListScroll.kt index 3d87401450..753883e763 100644 --- a/core/src/com/unciv/ui/trade/OffersListScroll.kt +++ b/core/src/com/unciv/ui/trade/OffersListScroll.kt @@ -56,9 +56,10 @@ class OffersListScroll( for (offerType in values()) { val offersOfType = offersToDisplay.filter { it.type == offerType } - .sortedWith(compareBy({ - if (UncivGame.Current.settings.orderTradeOffersByAmount) -it.amount else 0}, - {if (it.type==City) it.getOfferText() else it.name.tr()})) + .sortedWith(compareBy( + { if (UncivGame.Current.settings.orderTradeOffersByAmount) -it.amount else 0 }, + { if (it.type==City) it.getOfferText() else it.name.tr() } + )) if (expanderTabs.containsKey(offerType)) { expanderTabs[offerType]!!.innerTable.clear() @@ -67,6 +68,15 @@ class OffersListScroll( for (offer in offersOfType) { val tradeButton = offer.getOfferText(untradableOffers.filter { it.resource.name == offer.name }.sumOf { it.amount }).toTextButton() + tradeButton.labelCell.pad(5f) + when (offer.type) { + Luxury_Resource, Strategic_Resource -> + tradeButton.add(ImageGetter.getResourceImage(offer.name, 30f)) + WarDeclaration -> + tradeButton.add(ImageGetter.getNationIndicator(UncivGame.Current.gameInfo.ruleSet.nations[offer.name]!!, 30f)) + else -> Unit // Remove warning + } + val amountPerClick = if (offer.type == Gold) 50 else 1 diff --git a/core/src/com/unciv/ui/trade/TradeTable.kt b/core/src/com/unciv/ui/trade/TradeTable.kt index 7535f6ede2..0f683e67d1 100644 --- a/core/src/com/unciv/ui/trade/TradeTable.kt +++ b/core/src/com/unciv/ui/trade/TradeTable.kt @@ -7,17 +7,18 @@ import com.unciv.logic.trade.TradeRequest import com.unciv.models.translations.tr import com.unciv.ui.utils.* -class TradeTable(val otherCivilization: CivilizationInfo, stage: DiplomacyScreen): Table(CameraStageBaseScreen.skin){ +class TradeTable(val otherCivilization: CivilizationInfo, stage: DiplomacyScreen): Table(CameraStageBaseScreen.skin) { val currentPlayerCiv = otherCivilization.gameInfo.getCurrentPlayerCivilization() var tradeLogic = TradeLogic(currentPlayerCiv,otherCivilization) var offerColumnsTable = OfferColumnsTable(tradeLogic, stage) { onChange() } - var offerColumnsTableWrapper = Table() // This is so that after a trade has been traded, we can switch out the offersToDisplay to start anew - this is the easiest way + // This is so that after a trade has been traded, we can switch out the offersToDisplay to start anew - this is the easiest way + var offerColumnsTableWrapper = Table() val offerButton = "Offer trade".toTextButton() - fun isTradeOffered() = otherCivilization.tradeRequests.any{it.requestingCiv==currentPlayerCiv.civName} + fun isTradeOffered() = otherCivilization.tradeRequests.any { it.requestingCiv == currentPlayerCiv.civName } fun retractOffer(){ - otherCivilization.tradeRequests.removeAll { it.requestingCiv==currentPlayerCiv.civName } + otherCivilization.tradeRequests.removeAll { it.requestingCiv == currentPlayerCiv.civName } currentPlayerCiv.updateDetailedCivResources() offerButton.setText("Offer trade".tr()) } @@ -28,7 +29,7 @@ class TradeTable(val otherCivilization: CivilizationInfo, stage: DiplomacyScreen val lowerTable = Table().apply { defaults().pad(10f) } - val existingOffer = otherCivilization.tradeRequests.firstOrNull{it.requestingCiv==currentPlayerCiv.civName} + val existingOffer = otherCivilization.tradeRequests.firstOrNull { it.requestingCiv == currentPlayerCiv.civName } if (existingOffer != null){ tradeLogic.currentTrade.set(existingOffer.trade.reverse()) offerColumnsTable.update()