ImprovementPicker screen displays tile owner civ and city (#9942)

* Added owner civ and city to the ImprovementPicker screen with translation

* Switched tileOwnerText from var to val

* Changed unowned tile message and city name link to city screen
This commit is contained in:
Brian
2023-08-21 15:41:15 -04:00
committed by GitHub
parent ff806b5f3c
commit 1ef883ecdd
2 changed files with 21 additions and 0 deletions

View File

@ -1170,6 +1170,9 @@ No space available to place [unit] near [city] =
Maintenance cost = Maintenance cost =
Pick construction = Pick construction =
Pick improvement = Pick improvement =
Tile owned by [civName] - [cityName] =
Tile owned by [civName] (You) =
Unowned tile =
Provides [resource] = Provides [resource] =
Provides [amount] [resource] = Provides [amount] [resource] =
Replaces [improvement] = Replaces [improvement] =

View File

@ -16,10 +16,12 @@ import com.unciv.ui.components.Fonts
import com.unciv.ui.components.UncivTooltip.Companion.addTooltip import com.unciv.ui.components.UncivTooltip.Companion.addTooltip
import com.unciv.ui.components.extensions.disable import com.unciv.ui.components.extensions.disable
import com.unciv.ui.components.extensions.toLabel import com.unciv.ui.components.extensions.toLabel
import com.unciv.ui.components.extensions.toTextButton
import com.unciv.ui.components.input.keyShortcuts import com.unciv.ui.components.input.keyShortcuts
import com.unciv.ui.components.input.onClick import com.unciv.ui.components.input.onClick
import com.unciv.ui.components.input.onDoubleClick import com.unciv.ui.components.input.onDoubleClick
import com.unciv.ui.images.ImageGetter import com.unciv.ui.images.ImageGetter
import com.unciv.ui.screens.cityscreen.CityScreen
import kotlin.math.roundToInt import kotlin.math.roundToInt
class ImprovementPickerScreen( class ImprovementPickerScreen(
@ -203,6 +205,22 @@ class ImprovementPickerScreen(
regularImprovements.row() regularImprovements.row()
} }
var ownerTable = Table()
if (tile.getOwner() == null) {
ownerTable.add("Unowned tile".tr().toLabel())
} else if (tile.getOwner()!!.isCurrentPlayer()) {
val button = tile.getCity()!!.name.toTextButton(hideIcons = true)
button.onClick {
this.game.pushScreen(CityScreen(tile.getCity()!!,null,tile))
}
ownerTable.add("Tile owned by [${tile.getOwner()!!.civName}] (You)".tr().toLabel()).padLeft(10f)
ownerTable.add(button).padLeft(20f)
} else {
ownerTable.add("Tile owned by [${tile.getOwner()!!.civName}] - [${tile.getCity()!!.name}]".tr().toLabel()).padLeft(10f)
}
topTable.add(ownerTable)
topTable.row()
topTable.add(regularImprovements) topTable.add(regularImprovements)
} }