mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-26 15:49:14 +07:00
Added trade translation texts
Added duration to trade screen buttons
This commit is contained in:
@ -2361,4 +2361,17 @@
|
|||||||
Dutch:" Het/De [policyBranch] beleid is ontgrendeld!" // depends on what brach it is
|
Dutch:" Het/De [policyBranch] beleid is ontgrendeld!" // depends on what brach it is
|
||||||
} // EG Rationalism policy branch unlocked!
|
} // EG Rationalism policy branch unlocked!
|
||||||
|
|
||||||
|
// Trade
|
||||||
|
"Trade with [otherCiv]":{}
|
||||||
|
"Offer trade":{}
|
||||||
|
"What do you have in mind?":{}
|
||||||
|
"Our items":{}
|
||||||
|
"Our trade offer":{}
|
||||||
|
"[otherCiv]'s trade offer":{}
|
||||||
|
"[otherCiv]'s items":{}
|
||||||
|
"Pleasure doing business with you!":{}
|
||||||
|
"I think not.":{}
|
||||||
|
"That is acceptable.":{}
|
||||||
|
"Accept":{}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -21,8 +21,8 @@ android {
|
|||||||
applicationId "com.unciv.game"
|
applicationId "com.unciv.game"
|
||||||
minSdkVersion 14
|
minSdkVersion 14
|
||||||
targetSdkVersion 26
|
targetSdkVersion 26
|
||||||
versionCode 97
|
versionCode 98
|
||||||
versionName "2.6.0"
|
versionName "2.6.1"
|
||||||
}
|
}
|
||||||
buildTypes {
|
buildTypes {
|
||||||
release {
|
release {
|
||||||
|
@ -22,12 +22,6 @@ enum class TradeType{
|
|||||||
data class TradeOffer(var name:String, var type:TradeType, var duration:Int, var amount:Int) {
|
data class TradeOffer(var name:String, var type:TradeType, var duration:Int, var amount:Int) {
|
||||||
|
|
||||||
constructor() : this("",TradeType.Gold,0,0) // so that the json deserializer can work
|
constructor() : this("",TradeType.Gold,0,0) // so that the json deserializer can work
|
||||||
|
|
||||||
fun getText(): String {
|
|
||||||
var text = "{$name}"
|
|
||||||
if(duration>0) text += " ($duration {turns})"
|
|
||||||
return text.tr()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class TradeOffersList:ArrayList<TradeOffer>(){
|
class TradeOffersList:ArrayList<TradeOffer>(){
|
||||||
@ -64,8 +58,8 @@ class TradeScreen(val otherCivilization: CivilizationInfo) : CameraStageBaseScre
|
|||||||
val currentTrade = Trade()
|
val currentTrade = Trade()
|
||||||
|
|
||||||
val table = Table(skin)
|
val table = Table(skin)
|
||||||
val tradeText = Label("What do you have in mind?",skin)
|
val tradeText = Label("What do you have in mind?".tr(),skin)
|
||||||
val offerButton = TextButton("Offer trade",skin)
|
val offerButton = TextButton("Offer trade".tr(),skin)
|
||||||
|
|
||||||
init {
|
init {
|
||||||
val closeButton = TextButton("Close".tr(), skin)
|
val closeButton = TextButton("Close".tr(), skin)
|
||||||
@ -79,14 +73,14 @@ class TradeScreen(val otherCivilization: CivilizationInfo) : CameraStageBaseScre
|
|||||||
lowerTable.add(tradeText).colspan(2).row()
|
lowerTable.add(tradeText).colspan(2).row()
|
||||||
|
|
||||||
offerButton.addClickListener {
|
offerButton.addClickListener {
|
||||||
if(offerButton.text.toString() == "Offer trade") {
|
if(offerButton.text.toString() == "Offer trade".tr()) {
|
||||||
if (isTradeAcceptable(currentTrade)){
|
if (isTradeAcceptable(currentTrade)){
|
||||||
tradeText.setText("That is acceptable.")
|
tradeText.setText("That is acceptable.".tr())
|
||||||
offerButton.setText("Accept")
|
offerButton.setText("Accept".tr())
|
||||||
}
|
}
|
||||||
else tradeText.setText("I think not.")
|
else tradeText.setText("I think not.".tr())
|
||||||
}
|
}
|
||||||
else if(offerButton.text.toString() == "Accept"){
|
else if(offerButton.text.toString() == "Accept".tr()){
|
||||||
civInfo.diplomacy[otherCivilization.civName]!!.trades.add(currentTrade)
|
civInfo.diplomacy[otherCivilization.civName]!!.trades.add(currentTrade)
|
||||||
otherCivilization.diplomacy[civInfo.civName]!!.trades.add(currentTrade.reverse())
|
otherCivilization.diplomacy[civInfo.civName]!!.trades.add(currentTrade.reverse())
|
||||||
|
|
||||||
@ -106,7 +100,7 @@ class TradeScreen(val otherCivilization: CivilizationInfo) : CameraStageBaseScre
|
|||||||
|
|
||||||
val newTradeScreen = TradeScreen(otherCivilization)
|
val newTradeScreen = TradeScreen(otherCivilization)
|
||||||
UnCivGame.Current.screen = newTradeScreen
|
UnCivGame.Current.screen = newTradeScreen
|
||||||
newTradeScreen.tradeText.setText("Pleasure doing business with you!")
|
newTradeScreen.tradeText.setText("Pleasure doing business with you!".tr())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -127,10 +121,10 @@ class TradeScreen(val otherCivilization: CivilizationInfo) : CameraStageBaseScre
|
|||||||
val ourOffersTable = getTableOfOffers(currentTrade.ourOffers, ourAvailableOffers)
|
val ourOffersTable = getTableOfOffers(currentTrade.ourOffers, ourAvailableOffers)
|
||||||
val theirOffersTable = getTableOfOffers(currentTrade.theirOffers, theirAvailableOffers)
|
val theirOffersTable = getTableOfOffers(currentTrade.theirOffers, theirAvailableOffers)
|
||||||
val theirAvailableOffersTable = getTableOfOffers(theirAvailableOffers, currentTrade.theirOffers)
|
val theirAvailableOffersTable = getTableOfOffers(theirAvailableOffers, currentTrade.theirOffers)
|
||||||
table.add("Our items")
|
table.add("Our items".tr())
|
||||||
table.add("Our trade offer")
|
table.add("Our trade offer".tr())
|
||||||
table.add(otherCivilization.civName+"'s trade offer")
|
table.add("[${otherCivilization.civName}]'s trade offer".tr())
|
||||||
table.add(otherCivilization.civName+"'s items").row()
|
table.add("[${otherCivilization.civName}]'s items".tr()).row()
|
||||||
table.add(ourAvailableOffersTable).size(stage.width/4,stage.width/2)
|
table.add(ourAvailableOffersTable).size(stage.width/4,stage.width/2)
|
||||||
table.add(ourOffersTable).size(stage.width/4,stage.width/2)
|
table.add(ourOffersTable).size(stage.width/4,stage.width/2)
|
||||||
table.add(theirOffersTable).size(stage.width/4,stage.width/2)
|
table.add(theirOffersTable).size(stage.width/4,stage.width/2)
|
||||||
@ -142,7 +136,9 @@ class TradeScreen(val otherCivilization: CivilizationInfo) : CameraStageBaseScre
|
|||||||
fun getTableOfOffers(offers: TradeOffersList, correspondingOffers: TradeOffersList): ScrollPane {
|
fun getTableOfOffers(offers: TradeOffersList, correspondingOffers: TradeOffersList): ScrollPane {
|
||||||
val table= Table(skin).apply { defaults().pad(5f) }
|
val table= Table(skin).apply { defaults().pad(5f) }
|
||||||
for(offer in offers) {
|
for(offer in offers) {
|
||||||
val tb = TextButton(offer.name+" ("+offer.amount+")",skin)
|
var buttonText = offer.name+" ("+offer.amount+")"
|
||||||
|
if(offer.duration>1) buttonText+="\n"+offer.duration+" {turns}".tr()
|
||||||
|
val tb = TextButton(buttonText,skin)
|
||||||
val amountPerClick =
|
val amountPerClick =
|
||||||
if(offer.type==TradeType.Gold) 50
|
if(offer.type==TradeType.Gold) 50
|
||||||
else 1
|
else 1
|
||||||
@ -151,8 +147,8 @@ class TradeScreen(val otherCivilization: CivilizationInfo) : CameraStageBaseScre
|
|||||||
val amountTransferred = min(amountPerClick, offer.amount)
|
val amountTransferred = min(amountPerClick, offer.amount)
|
||||||
offers += offer.copy(amount = -amountTransferred)
|
offers += offer.copy(amount = -amountTransferred)
|
||||||
correspondingOffers += offer.copy(amount = amountTransferred)
|
correspondingOffers += offer.copy(amount = amountTransferred)
|
||||||
offerButton.setText("Offer trade")
|
offerButton.setText("Offer trade".tr())
|
||||||
tradeText.setText("What do you have in mind?")
|
tradeText.setText("What do you have in mind?".tr())
|
||||||
update()
|
update()
|
||||||
}
|
}
|
||||||
else tb.disable() // for instance we have negative gold
|
else tb.disable() // for instance we have negative gold
|
||||||
@ -168,7 +164,7 @@ class TradeScreen(val otherCivilization: CivilizationInfo) : CameraStageBaseScre
|
|||||||
else TradeType.Strategic_Resource
|
else TradeType.Strategic_Resource
|
||||||
offers.add(TradeOffer(entry.key.name, resourceTradeType, 30, entry.value))
|
offers.add(TradeOffer(entry.key.name, resourceTradeType, 30, entry.value))
|
||||||
}
|
}
|
||||||
offers.add(TradeOffer("Gold",TradeType.Gold,0,civInfo.gold))
|
offers.add(TradeOffer("Gold".tr(),TradeType.Gold,0,civInfo.gold))
|
||||||
return offers
|
return offers
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user