Better "close unit table" button - see #12591
Some checks failed
Conflict marking / main (push) Failing after 14s
Detekt / detekt (ubuntu-latest) (push) Failing after 1m2s
Generate mkdocs from docs folder / deploy (push) Failing after 54s
Build and test / Check code and run unit tests (push) Failing after 5m38s
Close stale issues and PRs / stale (push) Successful in 9s
Docker / build (push) Failing after 1m0s

This commit is contained in:
yairm210 2024-12-14 19:19:53 +02:00
parent 6f535f5c15
commit 0f4f690893

View File

@ -33,6 +33,7 @@ class UnitTable(val worldScreen: WorldScreen) : Table() {
private val unitIconNameGroup = Table()
private val promotionsTable = Table().apply { defaults().padRight(5f) }
private val unitDescriptionTable = Table(BaseScreen.skin)
private val deselectUnitButton: Actor
val selectedUnit : MapUnit?
get() = selectedUnits.firstOrNull()
@ -91,13 +92,13 @@ class UnitTable(val worldScreen: WorldScreen) : Table() {
promotionsTable.touchable = Touchable.enabled
val deselectUnitButton = getCloseButton(50f, 20f, Color.CLEAR, Color.RED) {
deselectUnitButton = getCloseButton(30f, 15f, Color.CLEAR, Color.RED) {
selectUnit()
worldScreen.shouldUpdate = true
this@UnitTable.isVisible = false
}
}.surroundWithCircle(30f, resizeActor = false, color = BaseScreen.clearColor).surroundWithThinCircle(Color.WHITE)
deselectUnitButton.keyShortcuts.clear() // This is the only place we don't want the BACK keyshortcut getCloseButton assigns
add(deselectUnitButton).left()
addActor(deselectUnitButton)
add(Table().apply {
val moveBetweenUnitsTable = Table().apply {
@ -302,6 +303,7 @@ class UnitTable(val worldScreen: WorldScreen) : Table() {
}
pack()
deselectUnitButton.setPosition(width - deselectUnitButton.width*3/4, height - deselectUnitButton.height*3/4)
bg.setSize(width-3f, height-3f)
bg.center(this)
selectedUnitHasChanged = false