mirror of
https://github.com/yairm210/Unciv.git
synced 2025-03-03 22:22:51 +07:00
Next turn button had a dead color assignment statement (#2403)
Color goes to Label instead of container String comparison special casing eliminated Clearer code structure Chose different colors - from standard palette but close to associated stat Co-authored-by: Yair Morgenstern <yairm210@hotmail.com>
This commit is contained in:
parent
71f339eb26
commit
5033cca9c2
@ -496,14 +496,14 @@ class WorldScreen(val viewingCiv:CivilizationInfo) : CameraStageBaseScreen() {
|
||||
}
|
||||
}
|
||||
|
||||
class NextTurnAction(val text:String,val action:()->Unit)
|
||||
private class NextTurnAction(val text:String, val color:Color, val action:()->Unit)
|
||||
|
||||
private fun updateNextTurnButton(isSomethingOpen: Boolean) {
|
||||
val action:NextTurnAction = getNextTurnAction()
|
||||
nextTurnAction = action.action
|
||||
|
||||
nextTurnButton.setText(action.text.tr())
|
||||
nextTurnButton.color = if (action.text == "Next turn") Color.WHITE else Color.GRAY
|
||||
nextTurnButton.label.color = action.color
|
||||
nextTurnButton.pack()
|
||||
nextTurnButton.isEnabled = !isSomethingOpen && isPlayersTurn && !waitingForAutosave
|
||||
nextTurnButton.setPosition(stage.width - nextTurnButton.width - 10f, topBar.y - nextTurnButton.height - 10f)
|
||||
@ -514,9 +514,10 @@ class WorldScreen(val viewingCiv:CivilizationInfo) : CameraStageBaseScreen() {
|
||||
|
||||
private fun getNextTurnAction(): NextTurnAction {
|
||||
return when {
|
||||
!isPlayersTurn -> NextTurnAction("Waiting for other players...") {}
|
||||
!isPlayersTurn -> NextTurnAction("Waiting for other players...", Color.GRAY) {}
|
||||
|
||||
viewingCiv.shouldGoToDueUnit() -> NextTurnAction("Next unit") {
|
||||
viewingCiv.shouldGoToDueUnit() ->
|
||||
NextTurnAction("Next unit", Color.LIGHT_GRAY) {
|
||||
val nextDueUnit = viewingCiv.getNextDueUnit()
|
||||
if (nextDueUnit != null) {
|
||||
mapHolder.setCenterPosition(nextDueUnit.currentTile.position, false, false)
|
||||
@ -527,23 +528,25 @@ class WorldScreen(val viewingCiv:CivilizationInfo) : CameraStageBaseScreen() {
|
||||
}
|
||||
|
||||
viewingCiv.cities.any { it.cityConstructions.currentConstruction == "" } ->
|
||||
NextTurnAction("Pick construction") {
|
||||
NextTurnAction("Pick construction", Color.CORAL) {
|
||||
val cityWithNoProductionSet = viewingCiv.cities
|
||||
.firstOrNull { it.cityConstructions.currentConstruction == "" }
|
||||
if (cityWithNoProductionSet != null) game.setScreen(CityScreen(cityWithNoProductionSet))
|
||||
}
|
||||
|
||||
viewingCiv.shouldOpenTechPicker() -> NextTurnAction("Pick a tech") {
|
||||
viewingCiv.shouldOpenTechPicker() ->
|
||||
NextTurnAction("Pick a tech", Color.SKY) {
|
||||
game.setScreen(TechPickerScreen(viewingCiv.tech.freeTechs != 0, viewingCiv))
|
||||
}
|
||||
|
||||
viewingCiv.policies.shouldOpenPolicyPicker || (viewingCiv.policies.freePolicies > 0 && viewingCiv.policies.canAdoptPolicy()) ->
|
||||
NextTurnAction("Pick a policy") {
|
||||
NextTurnAction("Pick a policy", Color.VIOLET) {
|
||||
game.setScreen(PolicyPickerScreen(this))
|
||||
viewingCiv.policies.shouldOpenPolicyPicker = false
|
||||
}
|
||||
|
||||
else -> NextTurnAction("Next turn") {
|
||||
else ->
|
||||
NextTurnAction("Next turn", Color.WHITE) {
|
||||
game.settings.addCompletedTutorialTask("Pass a turn")
|
||||
nextTurn()
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user