mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-30 07:21:34 -04:00
TileInfoTable translation and padding (#4061)
This commit is contained in:
parent
52b7999c48
commit
11cbe1c84a
@ -157,7 +157,7 @@ class CityConstructions {
|
|||||||
CivilopediaCategories.Unit.name
|
CivilopediaCategories.Unit.name
|
||||||
else -> ""
|
else -> ""
|
||||||
}
|
}
|
||||||
var label = currentConstructionSnapshot
|
var label = "{$currentConstructionSnapshot}"
|
||||||
if (!PerpetualConstruction.perpetualConstructionsMap.containsKey(currentConstructionSnapshot)) {
|
if (!PerpetualConstruction.perpetualConstructionsMap.containsKey(currentConstructionSnapshot)) {
|
||||||
val turnsLeft = turnsToConstruction(currentConstructionSnapshot)
|
val turnsLeft = turnsToConstruction(currentConstructionSnapshot)
|
||||||
label += " - $turnsLeft${Fonts.turn}"
|
label += " - $turnsLeft${Fonts.turn}"
|
||||||
|
@ -37,7 +37,7 @@ class CityScreenTileTable(private val cityScreen: CityScreen): Table() {
|
|||||||
innerTable.add( MarkupRenderer.render(selectedTile.toMarkup(city.civInfo)) {
|
innerTable.add( MarkupRenderer.render(selectedTile.toMarkup(city.civInfo)) {
|
||||||
// Sorry, this will leave the city screen
|
// Sorry, this will leave the city screen
|
||||||
UncivGame.Current.setScreen(CivilopediaScreen(city.civInfo.gameInfo.ruleSet, link = it))
|
UncivGame.Current.setScreen(CivilopediaScreen(city.civInfo.gameInfo.ruleSet, link = it))
|
||||||
} ).colspan(2)
|
} )
|
||||||
innerTable.row()
|
innerTable.row()
|
||||||
innerTable.add(getTileStatsTable(stats)).row()
|
innerTable.add(getTileStatsTable(stats)).row()
|
||||||
|
|
||||||
@ -57,7 +57,7 @@ class CityScreenTileTable(private val cityScreen: CityScreen): Table() {
|
|||||||
|| !cityScreen.canChangeState)
|
|| !cityScreen.canChangeState)
|
||||||
buyTileButton.disable()
|
buyTileButton.disable()
|
||||||
|
|
||||||
innerTable.add(buyTileButton).row()
|
innerTable.add(buyTileButton).padTop(5f).row()
|
||||||
}
|
}
|
||||||
|
|
||||||
if (city.civInfo.cities.filterNot { it == city }.any { it.isWorked(selectedTile) })
|
if (city.civInfo.cities.filterNot { it == city }.any { it.isWorked(selectedTile) })
|
||||||
@ -72,7 +72,7 @@ class CityScreenTileTable(private val cityScreen: CityScreen): Table() {
|
|||||||
cityScreen.update()
|
cityScreen.update()
|
||||||
}
|
}
|
||||||
if (!cityScreen.canChangeState) unlockButton.disable()
|
if (!cityScreen.canChangeState) unlockButton.disable()
|
||||||
innerTable.add(unlockButton).row()
|
innerTable.add(unlockButton).padTop(5f).row()
|
||||||
} else {
|
} else {
|
||||||
val lockButton = "Lock".toTextButton()
|
val lockButton = "Lock".toTextButton()
|
||||||
lockButton.onClick {
|
lockButton.onClick {
|
||||||
@ -81,7 +81,7 @@ class CityScreenTileTable(private val cityScreen: CityScreen): Table() {
|
|||||||
cityScreen.update()
|
cityScreen.update()
|
||||||
}
|
}
|
||||||
if (!cityScreen.canChangeState) lockButton.disable()
|
if (!cityScreen.canChangeState) lockButton.disable()
|
||||||
innerTable.add(lockButton).row()
|
innerTable.add(lockButton).padTop(5f).row()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (selectedTile.isCityCenter() && selectedTile.getCity() != city && selectedTile.getCity()!!.civInfo == city.civInfo)
|
if (selectedTile.isCityCenter() && selectedTile.getCity() != city && selectedTile.getCity()!!.civInfo == city.civInfo)
|
||||||
|
@ -84,10 +84,11 @@ object MarkupRenderer {
|
|||||||
fun render(
|
fun render(
|
||||||
lines: Collection<FormattedLine>,
|
lines: Collection<FormattedLine>,
|
||||||
labelWidth: Float = 0f,
|
labelWidth: Float = 0f,
|
||||||
|
padding: Float = defaultPadding,
|
||||||
linkAction: ((id: String) -> Unit)? = null
|
linkAction: ((id: String) -> Unit)? = null
|
||||||
): Table {
|
): Table {
|
||||||
val skin = CameraStageBaseScreen.skin
|
val skin = CameraStageBaseScreen.skin
|
||||||
val table = Table(skin).apply { defaults().pad(defaultPadding).align(Align.left) }
|
val table = Table(skin).apply { defaults().pad(padding).align(Align.left) }
|
||||||
for (line in lines) {
|
for (line in lines) {
|
||||||
if (line.isEmpty()) {
|
if (line.isEmpty()) {
|
||||||
table.add().padTop(emptyLineHeight).row()
|
table.add().padTop(emptyLineHeight).row()
|
||||||
|
@ -22,9 +22,9 @@ class TileInfoTable(private val viewingCiv :CivilizationInfo) : Table(CameraStag
|
|||||||
|
|
||||||
if (tile != null && (UncivGame.Current.viewEntireMapForDebug || viewingCiv.exploredTiles.contains(tile.position)) ) {
|
if (tile != null && (UncivGame.Current.viewEntireMapForDebug || viewingCiv.exploredTiles.contains(tile.position)) ) {
|
||||||
add(getStatsTable(tile))
|
add(getStatsTable(tile))
|
||||||
add( MarkupRenderer.render(tile.toMarkup(viewingCiv) ) {
|
add( MarkupRenderer.render(tile.toMarkup(viewingCiv), padding = 0f) {
|
||||||
UncivGame.Current.setScreen(CivilopediaScreen(viewingCiv.gameInfo.ruleSet, link = it))
|
UncivGame.Current.setScreen(CivilopediaScreen(viewingCiv.gameInfo.ruleSet, link = it))
|
||||||
} ).pad(10f)
|
} ).pad(5f)
|
||||||
// For debug only!
|
// For debug only!
|
||||||
// add(tile.position.toString().toLabel()).colspan(2).pad(10f)
|
// add(tile.position.toString().toLabel()).colspan(2).pad(10f)
|
||||||
}
|
}
|
||||||
@ -36,10 +36,14 @@ class TileInfoTable(private val viewingCiv :CivilizationInfo) : Table(CameraStag
|
|||||||
val table = Table()
|
val table = Table()
|
||||||
table.defaults().pad(2f)
|
table.defaults().pad(2f)
|
||||||
|
|
||||||
|
// padLeft = padRight + 5: for symmetry. An extra 5 for the distance yield number to
|
||||||
|
// tile text comes from the pad up there in updateTileTable
|
||||||
for (entry in tile.getTileStats(viewingCiv).toHashMap()
|
for (entry in tile.getTileStats(viewingCiv).toHashMap()
|
||||||
.filterNot { it.value == 0f || it.key.toString() == "" }) {
|
.filterNot { it.value == 0f || it.key.toString() == "" }) {
|
||||||
table.add(ImageGetter.getStatIcon(entry.key.toString())).size(20f).align(Align.right)
|
table.add(ImageGetter.getStatIcon(entry.key.toString()))
|
||||||
table.add(entry.value.toInt().toString().toLabel()).align(Align.left).padRight(10f)
|
.size(20f).align(Align.right).padLeft(10f)
|
||||||
|
table.add(entry.value.toInt().toLabel())
|
||||||
|
.align(Align.left).padRight(5f)
|
||||||
table.row()
|
table.row()
|
||||||
}
|
}
|
||||||
return table
|
return table
|
||||||
|
Loading…
x
Reference in New Issue
Block a user