Multiselect applies to civilian units and from city overlays

This commit is contained in:
Yair Morgenstern 2020-09-14 21:48:46 +03:00
parent 76741b446b
commit 1f4d5f5573
2 changed files with 3 additions and 4 deletions

View file

@ -223,7 +223,7 @@ class WorldMapHolder(internal val worldScreen: WorldScreen, internal val tileMap
if (unit.currentMovement == 0f) unitGroup.color.a = 0.5f
unitGroup.touchable = Touchable.enabled
unitGroup.onClick {
worldScreen.bottomUnitTable.selectUnit(unit)
worldScreen.bottomUnitTable.selectUnit(unit, Gdx.input.isKeyPressed(Input.Keys.SHIFT_LEFT))
worldScreen.shouldUpdate = true
unitActionOverlay?.remove()
}

View file

@ -226,12 +226,11 @@ class UnitTable(val worldScreen: WorldScreen) : Table(){
&& (selectedTile.militaryUnit!!.civInfo == worldScreen.viewingCiv || worldScreen.viewingCiv.isSpectator())
&& selectedTile.militaryUnit!! !in selectedUnits
&& (selectedTile.civilianUnit == null || selectedUnit != selectedTile.civilianUnit)) {
if (Gdx.input.isKeyPressed(Input.Keys.SHIFT_LEFT)) selectUnit(selectedTile.militaryUnit!!, true)
else selectUnit(selectedTile.militaryUnit!!)
selectUnit(selectedTile.militaryUnit!!, Gdx.input.isKeyPressed(Input.Keys.SHIFT_LEFT))
} else if (selectedTile.civilianUnit != null
&& (selectedTile.civilianUnit!!.civInfo == worldScreen.viewingCiv || worldScreen.viewingCiv.isSpectator())
&& selectedUnit != selectedTile.civilianUnit) {
selectUnit(selectedTile.civilianUnit!!)
selectUnit(selectedTile.civilianUnit!!, Gdx.input.isKeyPressed(Input.Keys.SHIFT_LEFT))
} else if (selectedTile == previouslySelectedUnit?.currentTile) {
// tapping the same tile again will deselect a unit.
// important for single-tap-move to abort moving easily