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 =
Reset Citizens =
Citizen Management =
Citizen Focus =
Avoid Growth =
Manual =
Default Focus =
[stat] Focus =
Please enter a new name for your city =
Please select a tile for this building's [improvement] =
Move to the top of the queue =

View File

@ -91,7 +91,7 @@ class GameInfo : IsPartOfGameInfoSerialization, HasGameInfoSerializationVersion
companion object {
/** 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. */
const val CURRENT_COMPATIBILITY_NUMBER = 4
const val CURRENT_COMPATIBILITY_NUMBER = 3
val CURRENT_COMPATIBILITY_VERSION = CompatibilityVersion(CURRENT_COMPATIBILITY_NUMBER, UncivGame.VERSION)

View File

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

View File

@ -7,7 +7,6 @@ import com.unciv.models.stats.Stat
import com.unciv.models.stats.Stats
import com.unciv.ui.components.input.KeyboardBinding
import com.unciv.ui.screens.cityscreen.CitizenManagementTable
import com.unciv.ui.images.ImageGetter
/**
* 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
* @see CityPopulationManager.autoAssignPopulation
* @see Automation.rankStatsForCityWork
* Order matters for building the [CitizenManagementTable]
*/
enum class CityFocus(
val label: String,
@ -26,31 +24,28 @@ enum class CityFocus(
binding: KeyboardBinding? = null
) : IsPartOfGameInfoSerialization {
// 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
},
Manual("Manual", true, null) {
override fun getStatMultiplier(stat: Stat) = 1f
},
FoodFocus("${Stat.Food.character}", true, Stat.Food),
ProductionFocus("${Stat.Production.character}", true, Stat.Production),
GoldFocus("${Stat.Gold.character}", true, Stat.Gold),
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) {
FoodFocus("[${Stat.Food.name}] Focus", true, Stat.Food),
ProductionFocus("[${Stat.Production.name}] Focus", true, Stat.Production),
GoldFocus("[${Stat.Gold.name}] Focus", true, Stat.Gold),
ScienceFocus("[${Stat.Science.name}] Focus", true, Stat.Science),
CultureFocus("[${Stat.Culture.name}] Focus", true, Stat.Culture),
GoldGrowthFocus("Gold Growth Focus", false) {
override fun getStatMultiplier(stat: Stat) = when (stat) {
Stat.Gold, Stat.Food -> 2f
else -> 1f
}
},
ProductionGrowthFocus("${Stat.Production.character} ${Stat.Food.character}", true) {
ProductionGrowthFocus("Production Growth Focus", false) {
override fun getStatMultiplier(stat: Stat) = when (stat) {
Stat.Production, Stat.Food -> 2f
else -> 1f
}
},
FaithFocus("[${Stat.Faith.name}] Focus", true, Stat.Faith),
HappinessFocus("[${Stat.Happiness.name}] Focus", false, Stat.Happiness),
//GreatPersonFocus
;

View File

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