mirror of
https://github.com/yairm210/Unciv.git
synced 2025-03-12 19:10:12 +07:00
All specialist colors come from the json now :)
This commit is contained in:
parent
5677fb494a
commit
e39d3e89da
@ -150,15 +150,15 @@ class CityInfoTable(private val cityScreen: CityScreen) : Table(CameraStageBaseS
|
||||
addBuildingInfo(building, specialistBuildingsTable)
|
||||
val specialistIcons = Table()
|
||||
specialistIcons.row().size(20f).pad(5f)
|
||||
for (stat in building.specialistSlots!!.toHashMap())
|
||||
for (stat in building.specialistSlots!!.toHashMap()) {
|
||||
if (stat.value == 0f) continue
|
||||
val specialist = cityInfo.getRuleset().specialists[cityInfo.population.specialistNameByStat(stat.key)]!!
|
||||
for (i in 0 until stat.value.toInt())
|
||||
specialistIcons.add(ImageGetter.getSpecialistIcon(stat.key)).size(20f)
|
||||
specialistIcons.add(ImageGetter.getSpecialistIcon(specialist.colorObject)).size(20f)
|
||||
}
|
||||
|
||||
specialistBuildingsTable.add(specialistIcons).pad(0f).row()
|
||||
}
|
||||
|
||||
// specialist allocation
|
||||
// addCategory("Specialist Allocation", SpecialistAllocationTable(cityScreen)) todo
|
||||
}
|
||||
|
||||
if (!otherBuildings.isEmpty()) {
|
||||
|
@ -25,7 +25,7 @@ class SpecialistAllocationTable(val cityScreen: CityScreen): Table(CameraStageBa
|
||||
val maxSpecialists = cityInfo.population.getMaxSpecialistsNew()[specialistName]!!
|
||||
|
||||
if (cityScreen.canChangeState) add(getUnassignButton(assignedSpecialists, stat))
|
||||
add(getAllocationTable(assignedSpecialists, maxSpecialists, stat)).pad(10f)
|
||||
add(getAllocationTable(assignedSpecialists, maxSpecialists, specialistName)).pad(10f)
|
||||
if (cityScreen.canChangeState) add(getAssignButton(assignedSpecialists, maxSpecialists, stat))
|
||||
addSeparatorVertical().pad(10f)
|
||||
add(getSpecialistStatsTable(specialistName)).row()
|
||||
@ -34,11 +34,14 @@ class SpecialistAllocationTable(val cityScreen: CityScreen): Table(CameraStageBa
|
||||
}
|
||||
|
||||
|
||||
fun getAllocationTable(assignedSpecialists: Int, maxSpecialists: Int, stat: Stat):Table{
|
||||
fun getAllocationTable(assignedSpecialists: Int, maxSpecialists: Int, specialistName: String):Table{
|
||||
|
||||
val specialistIconTable = Table()
|
||||
val specialistObject = cityInfo.getRuleset().specialists[specialistName]!!
|
||||
for (i in 1..maxSpecialists) {
|
||||
val icon = ImageGetter.getSpecialistIcon(stat, i <= assignedSpecialists)
|
||||
val color = if (i <= assignedSpecialists) specialistObject.colorObject
|
||||
else Color.GRAY // unassigned
|
||||
val icon = ImageGetter.getSpecialistIcon(color)
|
||||
specialistIconTable.add(icon).size(30f)
|
||||
}
|
||||
return specialistIconTable
|
||||
|
@ -303,17 +303,9 @@ object ImageGetter {
|
||||
return line
|
||||
}
|
||||
|
||||
fun getSpecialistIcon(stat: Stat, isFilled: Boolean =true): Image {
|
||||
fun getSpecialistIcon(color:Color): Image {
|
||||
val specialist = getImage("StatIcons/Specialist")
|
||||
if (!isFilled) specialist.color = Color.GRAY
|
||||
else specialist.color = when (stat) {
|
||||
Stat.Production -> Color.BROWN
|
||||
Stat.Gold -> Color.GOLD
|
||||
Stat.Science -> Color.BLUE
|
||||
Stat.Culture -> Color.PURPLE
|
||||
else -> Color.WHITE
|
||||
}
|
||||
|
||||
specialist.color = color
|
||||
return specialist
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user