Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tweak UI city screen #12755

Merged
merged 4 commits into from
Jan 7, 2025
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions android/assets/jsons/translations/template.properties
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ Disables: =

Current construction =
Construction queue =
Queue =
Pick a construction =
Queue empty =
Add to queue =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ class CityConstructionsTable(private val cityScreen: CityScreen) {
tintColor = ImageGetter.CHARCOAL
)
queueExpander = ExpanderTab(
"Queue",
"Construction queue",
onChange = { cityScreen.update() },
startsOutOpened = false,
defaultPad = 0f
Expand Down Expand Up @@ -210,7 +210,7 @@ class CityConstructionsTable(private val cityScreen: CityScreen) {
queueExpander.innerTable.clear()
queueExpander.headerContent.clear()
queueExpander.header.pad(0f)
queueExpander.setText("Queue".tr())
queueExpander.setText("Construction queue".tr())
queue.forEachIndexed { i, constructionName ->
// The first entry is already displayed as "Current construction"
if (i != 0) {
Expand Down Expand Up @@ -441,6 +441,7 @@ class CityConstructionsTable(private val cityScreen: CityScreen) {
cityScreen.selectConstructionFromQueue(constructionQueueIndex)
selectedQueueEntry = constructionQueueIndex
} else {
cityScreen.clearSelection()
selectedQueueEntry = -1
}
onBeforeUpdate()
Expand Down Expand Up @@ -696,8 +697,9 @@ class CityConstructionsTable(private val cityScreen: CityScreen) {
city.cityConstructions.removeFromQueue(constructionQueueIndex, false)
cityScreen.clearSelection()
cityScreen.city.reassignPopulation()
// select next entry in list if available
selectQueueEntry(constructionQueueIndex)
// Select next entry in list if available.
// If the last one was deleted, select the new last one.
selectQueueEntry(constructionQueueIndex.coerceAtMost(city.cityConstructions.constructionQueue.lastIndex)) { }
}
return tab
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class CityScreenCityPickerTable(private val cityScreen: CityScreen) : Table() {
cityNameTable.add(starImage).size(20f).padRight(5f)
}

val currentCityLabel = city.run { "{$name} (${population.population})" }
val currentCityLabel = city.name
.toLabel(fontSize = 30, fontColor = civInfo.nation.getInnerColor(), hideIcons = true)
if (cityScreen.canChangeState) currentCityLabel.onClick {
CityRenamePopup(
Expand All @@ -65,7 +65,12 @@ class CityScreenCityPickerTable(private val cityScreen: CityScreen) : Table() {
)
}

cityNameTable.add(currentCityLabel)
currentCityLabel.setEllipsis(true)
cityNameTable.add(currentCityLabel).minWidth(0f).padTop(6f)

val currentCityPop = city.run { " (${population.population})" }
.toLabel(fontSize = 30, fontColor = civInfo.nation.getInnerColor(), hideIcons = true)
cityNameTable.add(currentCityPop).padTop(6f)

val garrison = city.getGarrison()
if (garrison != null) {
Expand Down
Loading