mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-13 09:18:43 +07:00
Merge branch 'master' of https://github.com/yairm210/Unciv
This commit is contained in:
@ -26,7 +26,8 @@ class EmpireOverviewScreen(private val viewingPlayer:CivilizationInfo) : CameraS
|
||||
init {
|
||||
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.y = stage.height - closeButton.height - 5
|
||||
topTable.add(closeButton)
|
||||
|
@ -1,8 +1,9 @@
|
||||
package com.unciv.ui.cityscreen
|
||||
|
||||
import com.badlogic.gdx.graphics.Color
|
||||
import com.badlogic.gdx.scenes.scene2d.Actor
|
||||
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.models.stats.Stat
|
||||
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 {
|
||||
if (assignedSpecialists >= maxSpecialists || cityInfo.isPuppet) return Table()
|
||||
val assignButton = TextButton("+", skin)
|
||||
assignButton.label.setFontSize(24)
|
||||
val assignButton = "+".toLabel(Color.BLACK,24).apply { this.setAlignment(Align.center) }
|
||||
.surroundWithCircle(30f).apply { circle.color= Color.GREEN }
|
||||
assignButton.onClick {
|
||||
cityInfo.population.specialists.add(stat, 1f)
|
||||
cityInfo.cityStats.update()
|
||||
cityScreen.update()
|
||||
}
|
||||
if (cityInfo.population.getFreePopulation() == 0 || !UncivGame.Current.worldScreen.isPlayersTurn)
|
||||
assignButton.disable()
|
||||
assignButton.clear()
|
||||
return assignButton
|
||||
}
|
||||
|
||||
private fun getUnassignButton(assignedSpecialists: Int, stat: Stat):Actor {
|
||||
if (assignedSpecialists <= 0 || cityInfo.isPuppet) return Table()
|
||||
|
||||
val unassignButton = TextButton("-", skin)
|
||||
unassignButton.label.setFontSize(24)
|
||||
val unassignButton = "-".toLabel(Color.BLACK,24).apply { this.setAlignment(Align.center) }
|
||||
.surroundWithCircle(30f).apply { circle.color= Color.RED }
|
||||
unassignButton.onClick {
|
||||
cityInfo.population.specialists.add(stat, -1f)
|
||||
cityInfo.cityStats.update()
|
||||
cityScreen.update()
|
||||
}
|
||||
if (!UncivGame.Current.worldScreen.isPlayersTurn) unassignButton.disable()
|
||||
if (!UncivGame.Current.worldScreen.isPlayersTurn) unassignButton.clear()
|
||||
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.Table
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.TextButton
|
||||
import com.badlogic.gdx.utils.Align
|
||||
import com.unciv.Constants
|
||||
import com.unciv.UncivGame
|
||||
import com.unciv.logic.civilization.AlertType
|
||||
@ -41,11 +42,9 @@ class DiplomacyScreen(val viewingCiv:CivilizationInfo):CameraStageBaseScreen() {
|
||||
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.label.setFontSize(24)
|
||||
closeButton.labelCell.pad(10f)
|
||||
closeButton.pack()
|
||||
closeButton.y = stage.height - closeButton.height - 10
|
||||
closeButton.x = 10f
|
||||
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