Fixed gold tile cost bug

This commit is contained in:
Yair Morgenstern 2018-10-05 00:00:50 +03:00
parent 50c2ad4573
commit 7e6fa0e895
6 changed files with 320 additions and 309 deletions

File diff suppressed because it is too large Load diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 873 KiB

After

Width:  |  Height:  |  Size: 885 KiB

View file

@ -248,5 +248,9 @@ open class TileInfo {
return city!=null && city.workedTiles.contains(position)
}
fun arialDistanceTo(otherTile:TileInfo): Int = (abs(position.x-otherTile.position.x) + abs(position.y-otherTile.position.y)).toInt()
fun arialDistanceTo(otherTile:TileInfo): Int {
val xDelta = position.x-otherTile.position.x
val yDelta = position.y-otherTile.position.y
return listOf(abs(xDelta),abs(yDelta), abs(xDelta-yDelta)).max()!!.toInt()
}
}

View file

@ -42,8 +42,9 @@ class TechPickerScreen(internal val civInfo: CivilizationInfo) : PickerScreen()
touchable = Touchable.enabled
defaults().pad(10f)
background = ImageGetter.getDrawable("OtherIcons/civTableBackground.png")
if(ImageGetter.techIconExists(techName))
add(ImageGetter.getTechIcon(techName)).size(40f)
if(ImageGetter.techIconExists(techName)) {
add(ImageGetter.getTechIconGroup(techName))
}
add(text)
pack()
}
@ -62,7 +63,7 @@ class TechPickerScreen(internal val civInfo: CivilizationInfo) : PickerScreen()
}
val eras = ArrayList<Label>()
for(i in techMatrix.indices) eras.add(Label("",CameraStageBaseScreen.skin))
for(i in techMatrix.indices) eras.add(Label("",CameraStageBaseScreen.skin).apply { setFontColor(Color.WHITE) })
eras.forEach { topTable.add(it) }
for (i in 0..9) {

View file

@ -56,10 +56,6 @@ object ImageGetter {
return atlas.findRegion("TechIcons/$techName")!=null
}
fun getTechIcon(techName: String): Image {
return getImage("TechIcons/$techName")
}
fun getStatIcon(statName: String): Image {
return ImageGetter.getImage("StatIcons/$statName")
.apply { setSize(20f,20f)}
@ -137,4 +133,14 @@ object ImageGetter {
}
return group
}
fun getTechIconGroup(techName: String): Group {
val techIconGroup = Group()
techIconGroup.setSize(60f,60f)
techIconGroup.addActor(ImageGetter.getImage("OtherIcons/Circle").apply { setSize(60f,60f) })
val techIcon = getImage("TechIcons/$techName").apply { setSize(40f,40f)}
techIcon.center(techIconGroup)
techIconGroup.addActor(techIcon)
return techIconGroup
}
}

View file

@ -168,7 +168,7 @@ class WorldScreen : CameraStageBaseScreen() {
val tech = civInfo.tech.currentTechnology()!!
val techHeight = 30f
if(ImageGetter.techIconExists(tech))
techButton.add(ImageGetter.getTechIcon(tech)).size(techHeight)
techButton.add(ImageGetter.getTechIconGroup(tech))
val advancementGroup = Table()
val percentIncomplete = civInfo.tech.remainingScienceToTech(tech) / civInfo.tech.costOfTech(tech).toFloat()
val incompletionHeight = techHeight * percentIncomplete