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 if (unit.currentMovement == 0f) unitGroup.color.a = 0.5f
unitGroup.touchable = Touchable.enabled unitGroup.touchable = Touchable.enabled
unitGroup.onClick { unitGroup.onClick {
worldScreen.bottomUnitTable.selectUnit(unit) worldScreen.bottomUnitTable.selectUnit(unit, Gdx.input.isKeyPressed(Input.Keys.SHIFT_LEFT))
worldScreen.shouldUpdate = true worldScreen.shouldUpdate = true
unitActionOverlay?.remove() unitActionOverlay?.remove()
} }

View file

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