mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-28 22:37:02 -04:00
Worldscreen unit supply deficit icon now updates properly (#6362)
This commit is contained in:
parent
365cf0dc19
commit
c117860d6f
@ -432,6 +432,8 @@ class WorldScreen(val gameInfo: GameInfo, val viewingCiv:CivilizationInfo) : Bas
|
|||||||
techPolicyAndVictoryHolder.setPosition(10f, topBar.y - techPolicyAndVictoryHolder.height - 5f)
|
techPolicyAndVictoryHolder.setPosition(10f, topBar.y - techPolicyAndVictoryHolder.height - 5f)
|
||||||
updateDiplomacyButton(viewingCiv)
|
updateDiplomacyButton(viewingCiv)
|
||||||
|
|
||||||
|
topBar.unitSupplyImage.isVisible = selectedCiv.stats().getUnitSupplyDeficit() > 0
|
||||||
|
|
||||||
if (!hasOpenPopups() && isPlayersTurn) {
|
if (!hasOpenPopups() && isPlayersTurn) {
|
||||||
when {
|
when {
|
||||||
viewingCiv.shouldShowDiplomaticVotingResults() ->
|
viewingCiv.shouldShowDiplomaticVotingResults() ->
|
||||||
|
@ -46,6 +46,9 @@ class WorldScreenTopBar(val worldScreen: WorldScreen) : Table() {
|
|||||||
private val malcontentGroup = ImageGetter.getStatIcon("Malcontent")
|
private val malcontentGroup = ImageGetter.getStatIcon("Malcontent")
|
||||||
private val happinessGroup = ImageGetter.getStatIcon("Happiness")
|
private val happinessGroup = ImageGetter.getStatIcon("Happiness")
|
||||||
|
|
||||||
|
val unitSupplyImage = ImageGetter.getImage("OtherIcons/ExclamationMark")
|
||||||
|
.apply { color = Color.FIREBRICK }
|
||||||
|
|
||||||
init {
|
init {
|
||||||
background = ImageGetter.getBackground(ImageGetter.getBlue().darken(0.5f))
|
background = ImageGetter.getBackground(ImageGetter.getBlue().darken(0.5f))
|
||||||
|
|
||||||
@ -58,7 +61,7 @@ class WorldScreenTopBar(val worldScreen: WorldScreen) : Table() {
|
|||||||
|
|
||||||
addActor(getSelectedCivilizationTable())
|
addActor(getSelectedCivilizationTable())
|
||||||
|
|
||||||
addActor(getOverviewButton())
|
addActor(getOverviewAndSupplyButton())
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun getResourceTable(): Table {
|
private fun getResourceTable(): Table {
|
||||||
@ -167,19 +170,19 @@ class WorldScreenTopBar(val worldScreen: WorldScreen) : Table() {
|
|||||||
return menuButton
|
return menuButton
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun getOverviewButton(): Table {
|
private fun getOverviewAndSupplyButton(): Table {
|
||||||
val rightTable = Table(BaseScreen.skin).apply{ defaults().pad(10f) }
|
val rightTable = Table(BaseScreen.skin).apply{ defaults().pad(10f) }
|
||||||
|
|
||||||
val unitSupplyImage = ImageGetter.getImage("OtherIcons/ExclamationMark")
|
unitSupplyImage.onClick {
|
||||||
.apply { color = Color.FIREBRICK }
|
worldScreen.game.setScreen(EmpireOverviewScreen(worldScreen.selectedCiv, "Units"))
|
||||||
.onClick { worldScreen.game.setScreen(EmpireOverviewScreen(worldScreen.selectedCiv, "Units")) }
|
}
|
||||||
|
unitSupplyImage.isVisible = worldScreen.selectedCiv.stats().getUnitSupplyDeficit() > 0
|
||||||
|
|
||||||
val overviewButton = "Overview".toTextButton()
|
val overviewButton = "Overview".toTextButton()
|
||||||
overviewButton.addTooltip('e')
|
overviewButton.addTooltip('e')
|
||||||
overviewButton.onClick { worldScreen.game.setScreen(EmpireOverviewScreen(worldScreen.selectedCiv)) }
|
overviewButton.onClick { worldScreen.game.setScreen(EmpireOverviewScreen(worldScreen.selectedCiv)) }
|
||||||
|
|
||||||
if (worldScreen.selectedCiv.stats().getUnitSupplyDeficit() > 0)
|
rightTable.add(unitSupplyImage).size(50f)
|
||||||
rightTable.add(unitSupplyImage).size(50f)
|
|
||||||
rightTable.add(overviewButton)
|
rightTable.add(overviewButton)
|
||||||
|
|
||||||
rightTable.pack()
|
rightTable.pack()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user