Added list of units to empire overview

This commit is contained in:
Yair Morgenstern 2018-07-19 13:29:52 +03:00
parent d8ac537535
commit 0d261e88bf
3 changed files with 37 additions and 9 deletions

View File

@ -21,8 +21,8 @@ android {
applicationId "com.unciv.game"
minSdkVersion 14
targetSdkVersion 26
versionCode 103
versionName "2.6.5"
versionCode 104
versionName "2.6.6"
}
buildTypes {
release {

View File

@ -53,6 +53,15 @@ class EmpireOverviewScreen : CameraStageBaseScreen(){
}
topTable.add(setCurrentTradesButton)
val setUnitsButton = TextButton("Units",skin)
setUnitsButton .addClickListener {
centerTable.clear()
centerTable.add(getUnitTable())
centerTable.pack()
centerTable.center(stage)
}
topTable.add(setUnitsButton )
topTable.pack()
topTable.width = stage.width
topTable.y = stage.height-topTable.height
@ -188,4 +197,26 @@ class EmpireOverviewScreen : CameraStageBaseScreen(){
return table
}
fun getUnitTable(): Table {
val table=Table(skin).apply { defaults().pad(5f) }
table.add("Name")
table.add("Combat strength")
table.add("Ranged strength")
table.add("Movement")
table.add("Closest city")
table.row()
for(unit in civInfo.getCivUnits()){
val baseUnit = unit.getBaseUnit()
table.add(unit.name)
if(baseUnit.strength>0) table.add(baseUnit.strength.toString()) else table.add()
if(baseUnit.rangedStrength>0) table.add(baseUnit.rangedStrength.toString()) else table.add()
table.add(unit.currentMovement.toString()+"/"+unit.maxMovement)
val closestCity = unit.getTile().getTilesInDistance(3).firstOrNull{it.isCityCenter()}
if (closestCity!=null) table.add(closestCity.getCity()!!.name) else table.add()
table.row()
}
table.pack()
return table
}
}

View File

@ -194,18 +194,15 @@ class TradeScreen(val otherCivilization: CivilizationInfo) : CameraStageBaseScre
TradeType.Gold -> return offer.amount
TradeType.Gold_Per_Turn -> return offer.amount*offer.duration
TradeType.Luxury_Resource -> {
var value = 100*offer.amount
if(!theirAvailableOffers.any { it.name==offer.name }) // We want to take away their last luxury or give them one they don't have
value += 250
else if(!otherCivIsRecieving && !ourAvailableOffers.any { it.name==offer.name })
value += 250 // they're giving us a luxury we don't have yet
return value // this is useful only as a barter trade to other civs
var value = 350*offer.amount
if(!theirAvailableOffers.any { it.name==offer.name } && otherCivIsRecieving) // We want to take away their last luxury or give them one they don't have
value += 400
return value
}
TradeType.Strategic_Resource -> return 50 * offer.amount
// Dunno what this is?
else -> return 1000
}
}
}