mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-24 03:53:12 -04:00
Espionage button cancels moving spy (#11631)
* Pressing the espionage button while moving a spy on the map now deselects the spy * Minor UnitTable whitespace removeal
This commit is contained in:
parent
0412d4f143
commit
3d222ecd81
@ -90,6 +90,11 @@ class TechPolicyDiplomacyButtons(val worldScreen: WorldScreen) : Table(BaseScree
|
||||
if (game.gameInfo!!.isEspionageEnabled()) {
|
||||
espionageButton.add(ImageGetter.getImage("OtherIcons/Espionage")).size(30f).pad(15f)
|
||||
espionageButtonHolder.onActivation(binding = KeyboardBinding.Espionage) {
|
||||
// We want to make sure to deselect a spy in the case that the player wants to cancel moving
|
||||
// the spy on the map screen by pressing this button
|
||||
if (worldScreen.bottomUnitTable.selectedSpy != null) {
|
||||
worldScreen.bottomUnitTable.selectSpy(null)
|
||||
}
|
||||
game.pushScreen(EspionageOverviewScreen(worldScreen.selectedCiv, worldScreen))
|
||||
}
|
||||
}
|
||||
|
@ -67,9 +67,9 @@ class UnitTable(val worldScreen: WorldScreen) : Table() {
|
||||
// Most of the time it's the same unit with the same stats so why waste precious time?
|
||||
private var selectedUnitHasChanged = false
|
||||
val separator: Actor
|
||||
|
||||
|
||||
var selectedSpy: Spy? = null
|
||||
|
||||
|
||||
fun selectSpy(spy: Spy?) {
|
||||
selectedSpy = spy
|
||||
selectedCity = null
|
||||
@ -252,12 +252,12 @@ class UnitTable(val worldScreen: WorldScreen) : Table() {
|
||||
unitNameLabel.clearListeners()
|
||||
unitNameLabel.setText(spy.name)
|
||||
unitDescriptionTable.clear()
|
||||
|
||||
|
||||
unitIconHolder.clear()
|
||||
unitIconHolder.add (ImageGetter.getImage("OtherIcons/Spy_White").apply {
|
||||
color = Color.WHITE
|
||||
}).size(30f)
|
||||
|
||||
|
||||
separator.isVisible = true
|
||||
val color = when(spy.rank) {
|
||||
1 -> Color.BROWN
|
||||
|
Loading…
x
Reference in New Issue
Block a user