From 42ca98efd29db5cefa13389a31d0feb3401bac60 Mon Sep 17 00:00:00 2001 From: Yair Morgenstern Date: Sun, 10 Mar 2019 23:27:19 +0200 Subject: [PATCH] Gave up on the idea of the attack button - if the enemy moves we need to remove the button, and it's actually very difficult to determine this. --- android/build.gradle | 4 +-- .../com/unciv/ui/worldscreen/TileMapHolder.kt | 32 ------------------- 2 files changed, 2 insertions(+), 34 deletions(-) diff --git a/android/build.gradle b/android/build.gradle index 660784f894..bb58589ab9 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -21,8 +21,8 @@ android { applicationId "com.unciv.app" minSdkVersion 14 targetSdkVersion 28 - versionCode 213 - versionName "2.13.12" + versionCode 214 + versionName "2.13.13" } // Had to add this crap for Travis to build, it wanted to sign the app diff --git a/core/src/com/unciv/ui/worldscreen/TileMapHolder.kt b/core/src/com/unciv/ui/worldscreen/TileMapHolder.kt index 0a27d87ead..6053d8a575 100644 --- a/core/src/com/unciv/ui/worldscreen/TileMapHolder.kt +++ b/core/src/com/unciv/ui/worldscreen/TileMapHolder.kt @@ -10,8 +10,6 @@ import com.badlogic.gdx.scenes.scene2d.ui.ScrollPane import com.badlogic.gdx.scenes.scene2d.utils.ActorGestureListener import com.unciv.UnCivGame import com.unciv.logic.automation.UnitAutomation -import com.unciv.logic.battle.Battle -import com.unciv.logic.battle.MapUnitCombatant import com.unciv.logic.city.CityInfo import com.unciv.logic.civilization.CivilizationInfo import com.unciv.logic.map.MapUnit @@ -84,41 +82,11 @@ class TileMapHolder(internal val worldScreen: WorldScreen, internal val tileMap: // this can take a long time, because of the unit-to-tile calculation needed, so we put it in a different thread queueAddMoveHereButton(selectedUnit, tileInfo) } - if(selectedUnit!=null && selectedUnit.canAttack() - && UnitAutomation().getAttackableEnemies(selectedUnit, selectedUnit.getDistanceToTiles()) - .map { it.tileToAttack }.contains(tileInfo)) - addAttackButton(selectedUnit, tileInfo) worldScreen.bottomBar.unitTable.tileSelected(tileInfo) worldScreen.shouldUpdate = true } - private fun addAttackButton(attacker: MapUnit, tileInfo: TileInfo) { - val size = 60f - val attackButton = Group().apply { width = size;height = size; } - attackButton.addActor(ImageGetter.getCircle().apply { width = size; height = size }) - attackButton.addActor(ImageGetter.getUnitIcon("Swordsman") - .apply { width = size / 2; height = size / 2; center(attackButton) }) - - val unitIcon = UnitGroup(attacker, size / 2) - unitIcon.y = size - unitIcon.height - attackButton.addActor(unitIcon) - - val tileGroup = tileGroups[tileInfo]!! - addOverlayOnTileGroup(tileGroup, attackButton) - attackButton.y += tileGroup.height - - val battlePlan = UnitAutomation().getAttackableEnemies(attacker, attacker.getDistanceToTiles()) - .first { it.tileToAttack==tileInfo } - attackButton.onClick { - val battle = Battle(worldScreen.gameInfo) - battle.moveAndAttack(MapUnitCombatant(attacker), battlePlan) - worldScreen.shouldUpdate=true - removeUnitActionOverlay=true - } - unitActionOverlay = attackButton - } - private fun queueAddMoveHereButton(selectedUnit: MapUnit, tileInfo: TileInfo) { thread { /** LibGdx sometimes has these weird errors when you try to edit the UI layout from 2 separate threads.