mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-14 01:39:40 +07:00
some UI update. (#2069)
This commit is contained in:
@ -26,7 +26,8 @@ class EmpireOverviewScreen(private val viewingPlayer:CivilizationInfo) : CameraS
|
|||||||
init {
|
init {
|
||||||
onBackButtonClicked { UncivGame.Current.setWorldScreen() }
|
onBackButtonClicked { UncivGame.Current.setWorldScreen() }
|
||||||
|
|
||||||
val closeButton = TextButton("Close".tr(), skin)
|
val closeButton = "×".toLabel(Color.BLACK,30).apply { this.setAlignment(Align.center) }
|
||||||
|
.surroundWithCircle(30f).apply { circle.color=Color.RED }
|
||||||
closeButton.onClick { UncivGame.Current.setWorldScreen() }
|
closeButton.onClick { UncivGame.Current.setWorldScreen() }
|
||||||
closeButton.y = stage.height - closeButton.height - 5
|
closeButton.y = stage.height - closeButton.height - 5
|
||||||
topTable.add(closeButton)
|
topTable.add(closeButton)
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
package com.unciv.ui.cityscreen
|
package com.unciv.ui.cityscreen
|
||||||
|
|
||||||
|
import com.badlogic.gdx.graphics.Color
|
||||||
import com.badlogic.gdx.scenes.scene2d.Actor
|
import com.badlogic.gdx.scenes.scene2d.Actor
|
||||||
import com.badlogic.gdx.scenes.scene2d.ui.Table
|
import com.badlogic.gdx.scenes.scene2d.ui.Table
|
||||||
import com.badlogic.gdx.scenes.scene2d.ui.TextButton
|
import com.badlogic.gdx.utils.Align
|
||||||
import com.unciv.UncivGame
|
import com.unciv.UncivGame
|
||||||
import com.unciv.models.stats.Stat
|
import com.unciv.models.stats.Stat
|
||||||
import com.unciv.ui.utils.*
|
import com.unciv.ui.utils.*
|
||||||
@ -47,29 +48,29 @@ class SpecialistAllocationTable(val cityScreen: CityScreen): Table(CameraStageBa
|
|||||||
|
|
||||||
private fun getAssignButton(assignedSpecialists: Int, maxSpecialists: Int, stat: Stat):Actor {
|
private fun getAssignButton(assignedSpecialists: Int, maxSpecialists: Int, stat: Stat):Actor {
|
||||||
if (assignedSpecialists >= maxSpecialists || cityInfo.isPuppet) return Table()
|
if (assignedSpecialists >= maxSpecialists || cityInfo.isPuppet) return Table()
|
||||||
val assignButton = TextButton("+", skin)
|
val assignButton = "+".toLabel(Color.BLACK,24).apply { this.setAlignment(Align.center) }
|
||||||
assignButton.label.setFontSize(24)
|
.surroundWithCircle(30f).apply { circle.color= Color.GREEN }
|
||||||
assignButton.onClick {
|
assignButton.onClick {
|
||||||
cityInfo.population.specialists.add(stat, 1f)
|
cityInfo.population.specialists.add(stat, 1f)
|
||||||
cityInfo.cityStats.update()
|
cityInfo.cityStats.update()
|
||||||
cityScreen.update()
|
cityScreen.update()
|
||||||
}
|
}
|
||||||
if (cityInfo.population.getFreePopulation() == 0 || !UncivGame.Current.worldScreen.isPlayersTurn)
|
if (cityInfo.population.getFreePopulation() == 0 || !UncivGame.Current.worldScreen.isPlayersTurn)
|
||||||
assignButton.disable()
|
assignButton.clear()
|
||||||
return assignButton
|
return assignButton
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun getUnassignButton(assignedSpecialists: Int, stat: Stat):Actor {
|
private fun getUnassignButton(assignedSpecialists: Int, stat: Stat):Actor {
|
||||||
if (assignedSpecialists <= 0 || cityInfo.isPuppet) return Table()
|
if (assignedSpecialists <= 0 || cityInfo.isPuppet) return Table()
|
||||||
|
|
||||||
val unassignButton = TextButton("-", skin)
|
val unassignButton = "-".toLabel(Color.BLACK,24).apply { this.setAlignment(Align.center) }
|
||||||
unassignButton.label.setFontSize(24)
|
.surroundWithCircle(30f).apply { circle.color= Color.RED }
|
||||||
unassignButton.onClick {
|
unassignButton.onClick {
|
||||||
cityInfo.population.specialists.add(stat, -1f)
|
cityInfo.population.specialists.add(stat, -1f)
|
||||||
cityInfo.cityStats.update()
|
cityInfo.cityStats.update()
|
||||||
cityScreen.update()
|
cityScreen.update()
|
||||||
}
|
}
|
||||||
if (!UncivGame.Current.worldScreen.isPlayersTurn) unassignButton.disable()
|
if (!UncivGame.Current.worldScreen.isPlayersTurn) unassignButton.clear()
|
||||||
return unassignButton
|
return unassignButton
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,6 +5,7 @@ import com.badlogic.gdx.scenes.scene2d.ui.ScrollPane
|
|||||||
import com.badlogic.gdx.scenes.scene2d.ui.SplitPane
|
import com.badlogic.gdx.scenes.scene2d.ui.SplitPane
|
||||||
import com.badlogic.gdx.scenes.scene2d.ui.Table
|
import com.badlogic.gdx.scenes.scene2d.ui.Table
|
||||||
import com.badlogic.gdx.scenes.scene2d.ui.TextButton
|
import com.badlogic.gdx.scenes.scene2d.ui.TextButton
|
||||||
|
import com.badlogic.gdx.utils.Align
|
||||||
import com.unciv.Constants
|
import com.unciv.Constants
|
||||||
import com.unciv.UncivGame
|
import com.unciv.UncivGame
|
||||||
import com.unciv.logic.civilization.AlertType
|
import com.unciv.logic.civilization.AlertType
|
||||||
@ -41,11 +42,9 @@ class DiplomacyScreen(val viewingCiv:CivilizationInfo):CameraStageBaseScreen() {
|
|||||||
stage.addActor(splitPane)
|
stage.addActor(splitPane)
|
||||||
|
|
||||||
|
|
||||||
val closeButton = TextButton("Close".tr(), skin)
|
val closeButton = "×".toLabel(Color.BLACK,24).apply { this.setAlignment(Align.center) }
|
||||||
|
.surroundWithCircle(24f).apply { circle.color=Color.RED }
|
||||||
closeButton.onClick { UncivGame.Current.setWorldScreen() }
|
closeButton.onClick { UncivGame.Current.setWorldScreen() }
|
||||||
closeButton.label.setFontSize(24)
|
|
||||||
closeButton.labelCell.pad(10f)
|
|
||||||
closeButton.pack()
|
|
||||||
closeButton.y = stage.height - closeButton.height - 10
|
closeButton.y = stage.height - closeButton.height - 10
|
||||||
closeButton.x = 10f
|
closeButton.x = 10f
|
||||||
stage.addActor(closeButton) // This must come after the split pane so it will be above, that the button will be clickable
|
stage.addActor(closeButton) // This must come after the split pane so it will be above, that the button will be clickable
|
||||||
|
Reference in New Issue
Block a user