mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-28 14:24:43 -04:00
adding MapUnitAction.name(), a user-readable name for actions. Eg "Moving" instead of "moveTo x,y"
This commit is contained in:
parent
4330508d2e
commit
d676c18aec
@ -262,7 +262,7 @@
|
|||||||
Romanian:"Dormi"
|
Romanian:"Dormi"
|
||||||
Simplified_Chinese:"休眠"
|
Simplified_Chinese:"休眠"
|
||||||
Portuguese:"Dormir"
|
Portuguese:"Dormir"
|
||||||
German:"Schlafen legen"
|
German:"Schlafen"
|
||||||
French:"Dormir"
|
French:"Dormir"
|
||||||
Japanese:"睡眠"
|
Japanese:"睡眠"
|
||||||
Russian:"Спать"
|
Russian:"Спать"
|
||||||
@ -270,6 +270,10 @@
|
|||||||
Spanish:"Dormir"
|
Spanish:"Dormir"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
"Moving": {
|
||||||
|
"German": "Bewegen"
|
||||||
|
}
|
||||||
|
|
||||||
"Set up":{ // For siege units
|
"Set up":{ // For siege units
|
||||||
Italian:"Monta"
|
Italian:"Monta"
|
||||||
Russian:"Подготовится"
|
Russian:"Подготовится"
|
||||||
|
@ -7,7 +7,9 @@ import com.unciv.logic.map.TileInfo
|
|||||||
class BuildLongRoadAction(
|
class BuildLongRoadAction(
|
||||||
mapUnit: MapUnit = MapUnit(),
|
mapUnit: MapUnit = MapUnit(),
|
||||||
val target: TileInfo = TileInfo()
|
val target: TileInfo = TileInfo()
|
||||||
) : MapUnitAction(mapUnit, "Build Long Road") {
|
) : MapUnitAction(mapUnit) {
|
||||||
|
|
||||||
|
override fun name(): String = "Build Long Road"
|
||||||
|
|
||||||
override fun shouldStopOnEnemyInSight(): Boolean = true
|
override fun shouldStopOnEnemyInSight(): Boolean = true
|
||||||
|
|
||||||
|
@ -5,6 +5,7 @@ import com.unciv.logic.map.MapUnit
|
|||||||
open class MapUnitAction(
|
open class MapUnitAction(
|
||||||
@Transient var unit: MapUnit = MapUnit()
|
@Transient var unit: MapUnit = MapUnit()
|
||||||
) {
|
) {
|
||||||
|
open fun name(): String = ""
|
||||||
/** return true if this action is possible in the given conditions */
|
/** return true if this action is possible in the given conditions */
|
||||||
open fun isAvailable(): Boolean = true
|
open fun isAvailable(): Boolean = true
|
||||||
open fun doPreTurnAction() {}
|
open fun doPreTurnAction() {}
|
||||||
|
@ -15,4 +15,13 @@ class StringAction(
|
|||||||
|
|
||||||
override fun shouldStopOnEnemyInSight(): Boolean = action.startsWith("moveTo")
|
override fun shouldStopOnEnemyInSight(): Boolean = action.startsWith("moveTo")
|
||||||
|
|
||||||
|
override fun name(): String {
|
||||||
|
return when {
|
||||||
|
// translate string-encoded actions to user-readable names
|
||||||
|
action.startsWith("moveTo") -> "Moving"
|
||||||
|
else -> action
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
@ -256,6 +256,7 @@ class EmpireOverviewScreen : CameraStageBaseScreen(){
|
|||||||
fun getUnitTable(): Table {
|
fun getUnitTable(): Table {
|
||||||
val table=Table(skin).apply { defaults().pad(5f) }
|
val table=Table(skin).apply { defaults().pad(5f) }
|
||||||
table.add("Name".tr())
|
table.add("Name".tr())
|
||||||
|
table.add("Action".tr())
|
||||||
table.add("Strength".tr())
|
table.add("Strength".tr())
|
||||||
table.add("Ranged strength".tr())
|
table.add("Ranged strength".tr())
|
||||||
table.add("Movement".tr())
|
table.add("Movement".tr())
|
||||||
@ -267,6 +268,7 @@ class EmpireOverviewScreen : CameraStageBaseScreen(){
|
|||||||
for(unit in currentPlayerCivInfo.getCivUnits()){
|
for(unit in currentPlayerCivInfo.getCivUnits()){
|
||||||
val baseUnit = unit.baseUnit()
|
val baseUnit = unit.baseUnit()
|
||||||
table.add(unit.name.tr())
|
table.add(unit.name.tr())
|
||||||
|
unit.mapUnitAction?.let { table.add(it.name().tr()) } ?: table.add()
|
||||||
if(baseUnit.strength>0) table.add(baseUnit.strength.toString()) else table.add()
|
if(baseUnit.strength>0) table.add(baseUnit.strength.toString()) else table.add()
|
||||||
if(baseUnit.rangedStrength>0) table.add(baseUnit.rangedStrength.toString()) else table.add()
|
if(baseUnit.rangedStrength>0) table.add(baseUnit.rangedStrength.toString()) else table.add()
|
||||||
table.add(DecimalFormat("0.#").format(unit.currentMovement)+"/"+unit.getMaxMovement())
|
table.add(DecimalFormat("0.#").format(unit.currentMovement)+"/"+unit.getMaxMovement())
|
||||||
|
Loading…
x
Reference in New Issue
Block a user