* moving close button to end of the list and setting color to red

* aligning text/icon in main screen top bar
This commit is contained in:
Mojtaba Rahimy
2020-10-06 10:58:13 +03:30
committed by GitHub
parent 93bf69f3d5
commit 8e53be616d
2 changed files with 13 additions and 11 deletions

View File

@ -9,7 +9,6 @@ import com.badlogic.gdx.scenes.scene2d.ui.Slider
import com.badlogic.gdx.scenes.scene2d.ui.Table
import com.badlogic.gdx.utils.Align
import com.unciv.Constants
import com.unciv.UncivGame
import com.unciv.logic.HexMath
import com.unciv.logic.civilization.CivilizationInfo
import com.unciv.logic.civilization.diplomacy.DiplomaticStatus
@ -20,7 +19,8 @@ import com.unciv.models.translations.tr
import com.unciv.ui.pickerscreens.PromotionPickerScreen
import com.unciv.ui.utils.*
import java.text.DecimalFormat
import kotlin.math.*
import kotlin.math.abs
import kotlin.math.roundToInt
import com.unciv.ui.utils.AutoScrollPane as ScrollPane
class EmpireOverviewScreen(private var viewingPlayer:CivilizationInfo, defaultPage: String = "Cities") : CameraStageBaseScreen(){
@ -32,11 +32,6 @@ class EmpireOverviewScreen(private var viewingPlayer:CivilizationInfo, defaultPa
onBackButtonClicked { game.setWorldScreen() }
val clicks = HashMap<String,() -> Unit>()
val closeButton = Constants.close.toTextButton()
closeButton.onClick { game.setWorldScreen() }
closeButton.y = stage.height - closeButton.height - 5
topTable.add(closeButton)
val setCityInfoButton = "Cities".toTextButton()
val setCities = {
centerTable.clear()
@ -89,6 +84,13 @@ class EmpireOverviewScreen(private var viewingPlayer:CivilizationInfo, defaultPa
if (viewingPlayer.detailedCivResources.isEmpty())
setResourcesButton.disable()
val closeButton = Constants.close.toTextButton().apply {
setColor(0.75f, 0.1f, 0.1f, 1f)
}
closeButton.onClick { game.setWorldScreen() }
closeButton.y = stage.height - closeButton.height - 5
topTable.add(closeButton)
topTable.pack()
clicks[defaultPage]?.invoke()

View File

@ -84,7 +84,7 @@ class WorldScreenTopBar(val worldScreen: WorldScreen) : Table() {
statsTable.add(goldLabel)
val goldImage = ImageGetter.getStatIcon("Gold")
statsTable.add(goldImage).padRight(20f).size(20f)
statsTable.add(goldImage).padRight(20f).padBottom(6f).size(20f)
val invokeStatsPage = {
worldScreen.game.setScreen(EmpireOverviewScreen(worldScreen.selectedCiv, "Stats"))
}
@ -93,14 +93,14 @@ class WorldScreenTopBar(val worldScreen: WorldScreen) : Table() {
statsTable.add(scienceLabel) //.apply { setAlignment(Align.center) }).align(Align.top)
val scienceImage = ImageGetter.getStatIcon("Science")
statsTable.add(scienceImage).padRight(20f).size(20f)
statsTable.add(scienceImage).padRight(20f).padBottom(6f).size(20f)
val invokeTechScreen = {
worldScreen.game.setScreen(TechPickerScreen(worldScreen.selectedCiv))
}
scienceLabel.onClick(invokeTechScreen)
scienceImage.onClick(invokeTechScreen)
statsTable.add(happinessImage).size(20f)
statsTable.add(happinessImage).padBottom(6f).size(20f)
statsTable.add(happinessLabel).padRight(20f)//.apply { setAlignment(Align.center) }).align(Align.top)
val invokeResourcesPage = {
worldScreen.game.setScreen(EmpireOverviewScreen(worldScreen.selectedCiv, "Resources"))
@ -110,7 +110,7 @@ class WorldScreenTopBar(val worldScreen: WorldScreen) : Table() {
statsTable.add(cultureLabel)//.apply { setAlignment(Align.center) }).align(Align.top)
val cultureImage = ImageGetter.getStatIcon("Culture")
statsTable.add(cultureImage).size(20f)
statsTable.add(cultureImage).padBottom(6f).size(20f)
val invokePoliciesPage = {
worldScreen.game.setScreen(PolicyPickerScreen(worldScreen, worldScreen.selectedCiv))
}