mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-24 20:31:51 -04:00
Making SpecialistAllocationTable an ExpanderTab (#6614)
* Make SpecialistAllocationTable an ExpanderTab * Make Specialist ExpanderTab translatable
This commit is contained in:
parent
cf761f4a2c
commit
d2f0e32229
@ -46,10 +46,8 @@ class CityStatsTable(val cityScreen: CityScreen): Table() {
|
||||
innerTable.addSeparator()
|
||||
addText()
|
||||
if (!cityInfo.population.getMaxSpecialists().isEmpty()) {
|
||||
innerTable.addSeparator()
|
||||
innerTable.add(SpecialistAllocationTable(cityScreen).apply { update() }).row()
|
||||
addSpecialistInfo()
|
||||
}
|
||||
|
||||
if (cityInfo.religion.getNumberOfFollowers().isNotEmpty() && cityInfo.civInfo.gameInfo.isReligionEnabled())
|
||||
addReligionInfo()
|
||||
|
||||
@ -113,6 +111,18 @@ class CityStatsTable(val cityScreen: CityScreen): Table() {
|
||||
innerTable.add(tableWithIcons).row()
|
||||
}
|
||||
|
||||
private fun addSpecialistInfo() {
|
||||
val expanderTab = SpecialistAllocationTable(cityScreen).asExpander {
|
||||
pack()
|
||||
setPosition(
|
||||
stage.width - CityScreen.posFromEdge,
|
||||
stage.height - CityScreen.posFromEdge,
|
||||
Align.topRight
|
||||
)
|
||||
}
|
||||
innerTable.add(expanderTab).growX().row()
|
||||
}
|
||||
|
||||
private fun addReligionInfo() {
|
||||
val expanderTab = CityReligionInfoTable(cityInfo.religion).asExpander {
|
||||
pack()
|
||||
|
@ -86,4 +86,19 @@ class SpecialistAllocationTable(val cityScreen: CityScreen): Table(BaseScreen.sk
|
||||
}
|
||||
return specialistStatTable
|
||||
}
|
||||
|
||||
|
||||
fun asExpander(onChange: (()->Unit)?): ExpanderTab {
|
||||
return ExpanderTab(
|
||||
title = "{Specialists}:",
|
||||
fontSize = Constants.defaultFontSize,
|
||||
persistenceID = "CityStatsTable.Specialists",
|
||||
startsOutOpened = true,
|
||||
onChange = onChange
|
||||
) {
|
||||
it.add(this)
|
||||
update()
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user