Revert "New Citizen Focus Options (#10745)" (#10793)

This reverts commit 07c6728123.
This commit is contained in:
Yair Morgenstern
2023-12-22 09:45:45 +02:00
committed by GitHub
parent 07c6728123
commit 746918b1d3
5 changed files with 21 additions and 48 deletions

View File

@ -1255,9 +1255,9 @@ Unlock =
Move to city = Move to city =
Reset Citizens = Reset Citizens =
Citizen Management = Citizen Management =
Citizen Focus =
Avoid Growth = Avoid Growth =
Manual = Default Focus =
[stat] Focus =
Please enter a new name for your city = Please enter a new name for your city =
Please select a tile for this building's [improvement] = Please select a tile for this building's [improvement] =
Move to the top of the queue = Move to the top of the queue =

View File

@ -91,7 +91,7 @@ class GameInfo : IsPartOfGameInfoSerialization, HasGameInfoSerializationVersion
companion object { companion object {
/** The current compatibility version of [GameInfo]. This number is incremented whenever changes are made to the save file structure that guarantee that /** The current compatibility version of [GameInfo]. This number is incremented whenever changes are made to the save file structure that guarantee that
* previous versions of the game will not be able to load or play a game normally. */ * previous versions of the game will not be able to load or play a game normally. */
const val CURRENT_COMPATIBILITY_NUMBER = 4 const val CURRENT_COMPATIBILITY_NUMBER = 3
val CURRENT_COMPATIBILITY_VERSION = CompatibilityVersion(CURRENT_COMPATIBILITY_NUMBER, UncivGame.VERSION) val CURRENT_COMPATIBILITY_VERSION = CompatibilityVersion(CURRENT_COMPATIBILITY_NUMBER, UncivGame.VERSION)

View File

@ -358,7 +358,7 @@ class City : IsPartOfGameInfoSerialization {
if (resetLocked) { if (resetLocked) {
workedTiles = hashSetOf() workedTiles = hashSetOf()
lockedTiles = hashSetOf() lockedTiles = hashSetOf()
} else if(cityAIFocus != CityFocus.Manual){ } else {
workedTiles = lockedTiles workedTiles = lockedTiles
} }
if (!manualSpecialists) if (!manualSpecialists)

View File

@ -7,7 +7,6 @@ import com.unciv.models.stats.Stat
import com.unciv.models.stats.Stats import com.unciv.models.stats.Stats
import com.unciv.ui.components.input.KeyboardBinding import com.unciv.ui.components.input.KeyboardBinding
import com.unciv.ui.screens.cityscreen.CitizenManagementTable import com.unciv.ui.screens.cityscreen.CitizenManagementTable
import com.unciv.ui.images.ImageGetter
/** /**
* Controls automatic worker-to-tile assignment * Controls automatic worker-to-tile assignment
@ -17,7 +16,6 @@ import com.unciv.ui.images.ImageGetter
* @param binding Bindable keyboard key in UI - this is an override, by default matching enum names in [KeyboardBinding] are assigned automatically * @param binding Bindable keyboard key in UI - this is an override, by default matching enum names in [KeyboardBinding] are assigned automatically
* @see CityPopulationManager.autoAssignPopulation * @see CityPopulationManager.autoAssignPopulation
* @see Automation.rankStatsForCityWork * @see Automation.rankStatsForCityWork
* Order matters for building the [CitizenManagementTable]
*/ */
enum class CityFocus( enum class CityFocus(
val label: String, val label: String,
@ -26,31 +24,28 @@ enum class CityFocus(
binding: KeyboardBinding? = null binding: KeyboardBinding? = null
) : IsPartOfGameInfoSerialization { ) : IsPartOfGameInfoSerialization {
// region Enum values // region Enum values
NoFocus("Default", true, null) { NoFocus("Default Focus", true, null) {
override fun getStatMultiplier(stat: Stat) = 1f // actually redundant, but that's two steps to see override fun getStatMultiplier(stat: Stat) = 1f // actually redundant, but that's two steps to see
}, },
Manual("Manual", true, null) { FoodFocus("[${Stat.Food.name}] Focus", true, Stat.Food),
override fun getStatMultiplier(stat: Stat) = 1f ProductionFocus("[${Stat.Production.name}] Focus", true, Stat.Production),
}, GoldFocus("[${Stat.Gold.name}] Focus", true, Stat.Gold),
FoodFocus("${Stat.Food.character}", true, Stat.Food), ScienceFocus("[${Stat.Science.name}] Focus", true, Stat.Science),
ProductionFocus("${Stat.Production.character}", true, Stat.Production), CultureFocus("[${Stat.Culture.name}] Focus", true, Stat.Culture),
GoldFocus("${Stat.Gold.character}", true, Stat.Gold), GoldGrowthFocus("Gold Growth Focus", false) {
ScienceFocus("${Stat.Science.character}", true, Stat.Science),
CultureFocus("${Stat.Culture.character}", true, Stat.Culture),
HappinessFocus("${Stat.Happiness.character}", false, Stat.Happiness),
FaithFocus("${Stat.Faith.character}", true, Stat.Faith),
GoldGrowthFocus("${Stat.Gold.character} ${Stat.Food.character}", true) {
override fun getStatMultiplier(stat: Stat) = when (stat) { override fun getStatMultiplier(stat: Stat) = when (stat) {
Stat.Gold, Stat.Food -> 2f Stat.Gold, Stat.Food -> 2f
else -> 1f else -> 1f
} }
}, },
ProductionGrowthFocus("${Stat.Production.character} ${Stat.Food.character}", true) { ProductionGrowthFocus("Production Growth Focus", false) {
override fun getStatMultiplier(stat: Stat) = when (stat) { override fun getStatMultiplier(stat: Stat) = when (stat) {
Stat.Production, Stat.Food -> 2f Stat.Production, Stat.Food -> 2f
else -> 1f else -> 1f
} }
}, },
FaithFocus("[${Stat.Faith.name}] Focus", true, Stat.Faith),
HappinessFocus("[${Stat.Happiness.name}] Focus", false, Stat.Happiness),
//GreatPersonFocus //GreatPersonFocus
; ;

View File

@ -12,15 +12,12 @@ import com.unciv.ui.screens.basescreen.BaseScreen
class CitizenManagementTable(val cityScreen: CityScreen) : Table(BaseScreen.skin) { class CitizenManagementTable(val cityScreen: CityScreen) : Table(BaseScreen.skin) {
val city = cityScreen.city val city = cityScreen.city
private val numCol = 4
fun update() { fun update() {
clear() clear()
val colorSelected = BaseScreen.skin.getColor("selection") val colorSelected = BaseScreen.skin.getColor("selection")
val colorButton = BaseScreen.skin.getColor("color") val colorButton = BaseScreen.skin.getColor("color")
val topTable = Table() // holds 2 buttons
// effectively a button, but didn't want to rewrite TextButton style // effectively a button, but didn't want to rewrite TextButton style
// and much more compact and can control backgrounds easily based on settings // and much more compact and can control backgrounds easily based on settings
val resetLabel = "Reset Citizens".toLabel() val resetLabel = "Reset Citizens".toLabel()
@ -37,7 +34,8 @@ class CitizenManagementTable(val cityScreen: CityScreen) : Table(BaseScreen.skin
"CityScreen/CitizenManagementTable/ResetCell", "CityScreen/CitizenManagementTable/ResetCell",
tintColor = colorButton tintColor = colorButton
) )
topTable.add(resetCell).pad(3f) add(resetCell).colspan(2).growX().pad(3f)
row()
val avoidLabel = "Avoid Growth".toLabel() val avoidLabel = "Avoid Growth".toLabel()
val avoidCell = Table() val avoidCell = Table()
@ -54,18 +52,10 @@ class CitizenManagementTable(val cityScreen: CityScreen) : Table(BaseScreen.skin
"CityScreen/CitizenManagementTable/AvoidCell", "CityScreen/CitizenManagementTable/AvoidCell",
tintColor = if (city.avoidGrowth) colorSelected else colorButton tintColor = if (city.avoidGrowth) colorSelected else colorButton
) )
topTable.add(avoidCell).pad(3f) add(avoidCell).colspan(2).growX().pad(3f)
add(topTable).colspan(numCol).growX()
row() row()
val focusLabel = "Citizen Focus".toLabel() var newRow = false
val focusCell = Table()
focusCell.add(focusLabel).pad(5f)
add(focusCell).colspan(numCol).growX().pad(3f)
row()
var currCol = numCol
val defaultTable = Table()
for (focus in CityFocus.values()) { for (focus in CityFocus.values()) {
if (!focus.tableEnabled) continue if (!focus.tableEnabled) continue
if (focus == CityFocus.FaithFocus && !city.civ.gameInfo.isReligionEnabled()) continue if (focus == CityFocus.FaithFocus && !city.civ.gameInfo.isReligionEnabled()) continue
@ -87,22 +77,10 @@ class CitizenManagementTable(val cityScreen: CityScreen) : Table(BaseScreen.skin
"CityScreen/CitizenManagementTable/FocusCell", "CityScreen/CitizenManagementTable/FocusCell",
tintColor = if (city.cityAIFocus == focus) colorSelected else colorButton tintColor = if (city.cityAIFocus == focus) colorSelected else colorButton
) )
// make NoFocus and Manual their own special row add(cell).growX().pad(3f)
if(focus == CityFocus.NoFocus) { if (newRow) // every 2 make new row
defaultTable.add(cell).growX().pad(3f)
} else if (focus == CityFocus.Manual) {
defaultTable.add(cell).growX().pad(3f)
add(defaultTable).colspan(numCol).growX()
row() row()
} else { newRow = !newRow
cell.padTop(5f) // Stat symbols need extra padding on top
add(cell).growX().pad(3f)
--currCol
if (currCol == 0) { // make new row
row()
currCol = numCol
}
}
} }
pack() pack()