Resolved #449 - added "go to unit" button in unit overview

This commit is contained in:
Yair Morgenstern 2019-02-11 22:07:34 +02:00
parent 0788141054
commit 748e84f265
6 changed files with 10 additions and 21 deletions

View file

@ -21,7 +21,7 @@ android {
applicationId "com.unciv.app"
minSdkVersion 14
targetSdkVersion 28
versionCode 201
versionCode 202
versionName "2.13.3"
}

View file

@ -16,7 +16,7 @@ buildscript {
}
dependencies {
classpath 'de.richsource.gradle.plugins:gwt-gradle-plugin:0.6'
classpath 'com.android.tools.build:gradle:3.3.0'
classpath 'com.android.tools.build:gradle:3.3.1'
classpath 'com.mobidevelop.robovm:robovm-gradle-plugin:2.3.1'
}
}

View file

@ -13,18 +13,4 @@ class ScienceVictoryManager {
requiredParts.add("SS Engine", 1)
requiredParts.add("SS Stasis Chamber", 1)
}
fun clone(): ScienceVictoryManager {
val toReturn = ScienceVictoryManager()
toReturn.currentParts.putAll(currentParts)
return toReturn
}
fun unconstructedParts(): Counter<String> {
val counter = requiredParts.clone()
counter.remove(currentParts)
return counter
}
fun hasWon() = requiredParts.equals(currentParts)
}

View file

@ -136,7 +136,7 @@ class TileMap {
}
fun setTransients() {
if(tiles.any()) //
if(tiles.any())
tileList.addAll(tiles.values)
val topY= tileList.asSequence().map { it.position.y.toInt() }.max()!!

View file

@ -262,6 +262,7 @@ class EmpireOverviewScreen : CameraStageBaseScreen(){
table.add("Ranged strength".tr())
table.add("Movement".tr())
table.add("Closest city".tr())
table.add("Go to unit".tr())
table.row()
table.addSeparator()
@ -273,6 +274,12 @@ class EmpireOverviewScreen : CameraStageBaseScreen(){
table.add(DecimalFormat("0.#").format(unit.currentMovement)+"/"+unit.getMaxMovement())
val closestCity = unit.getTile().getTilesInDistance(3).firstOrNull{it.isCityCenter()}
if (closestCity!=null) table.add(closestCity.getCity()!!.name) else table.add()
val goToUnitButton = TextButton("Go to unit".tr(),skin)
goToUnitButton.onClick {
UnCivGame.Current.setWorldScreen()
UnCivGame.Current.worldScreen.tileMapHolder.setCenterPosition(unit.currentTile.position)
}
table.add(goToUnitButton)
table.row()
}
table.pack()

View file

@ -34,10 +34,6 @@ class TechButton(techName:String, val techManager: TechManager) : Table(CameraSt
val techEnabledIcons = Table()
techEnabledIcons.defaults().pad(5f)
val units = GameBasics.Units.values.filter { it.requiredTech==techName }
.filter { it.uniqueTo==null || it.uniqueTo==techManager.civInfo.civName }
for(unit in GameBasics.Units.values.filter { it.requiredTech==techName
&& (it.uniqueTo==null || it.uniqueTo==techManager.civInfo.civName) })
techEnabledIcons.add(ImageGetter.getConstructionImage(unit.name).surroundWithCircle(30f))