Added GetImprovementIcon funciton to ImageGetter

This commit is contained in:
Yair Morgenstern 2018-05-25 11:24:59 +03:00
parent 2570c4fd3d
commit c40ebb3942
3 changed files with 9 additions and 5 deletions

View file

@ -197,7 +197,7 @@ open class TileGroup(var tileInfo: TileInfo) : Group() {
private fun updateImprovementImage(viewable: Boolean) { private fun updateImprovementImage(viewable: Boolean) {
if (tileInfo.improvement != null && tileInfo.improvement != improvementType) { if (tileInfo.improvement != null && tileInfo.improvement != improvementType) {
improvementImage = ImageGetter.getImage("ImprovementIcons/" + tileInfo.improvement!!.replace(' ', '_') + "_(Civ5).png") improvementImage = ImageGetter.getImprovementIcon(tileInfo.improvement!!)
addActor(improvementImage) addActor(improvementImage)
improvementImage!!.run { improvementImage!!.run {
setSize(20f, 20f) setSize(20f, 20f)

View file

@ -45,5 +45,9 @@ object ImageGetter {
return getImage("UnitIcons/$unitName.png") return getImage("UnitIcons/$unitName.png")
} }
fun getImprovementIcon(improvementName:String):Image{
return getImage("ImprovementIcons/" + improvementName.replace(' ', '_') + "_(Civ5).png")
}
fun getBlue() = Color(0x004085bf) fun getBlue() = Color(0x004085bf)
} }

View file

@ -25,13 +25,13 @@ class UnitActionsTable(val worldScreen: WorldScreen) : Table(){
"Stop automation" -> return ImageGetter.getImage("OtherIcons/Stop.png") "Stop automation" -> return ImageGetter.getImage("OtherIcons/Stop.png")
"Found city" -> return ImageGetter.getUnitIcon("Settler") "Found city" -> return ImageGetter.getUnitIcon("Settler")
"Discover Technology" -> return ImageGetter.getUnitIcon("Great Scientist") "Discover Technology" -> return ImageGetter.getUnitIcon("Great Scientist")
"Construct Academy" -> return ImageGetter.getImage("ImprovementIcons/Academy_(Civ5).png") "Construct Academy" -> return ImageGetter.getImprovementIcon("Academy")
"Start Golden Age" -> return ImageGetter.getUnitIcon("Great Artist") "Start Golden Age" -> return ImageGetter.getUnitIcon("Great Artist")
"Construct Landmark" -> return ImageGetter.getImage("ImprovementIcons/Landmark_(Civ5).png") "Construct Landmark" -> return ImageGetter.getImprovementIcon("Landmark")
"Hurry Wonder" -> return ImageGetter.getUnitIcon("Great Engineer") "Hurry Wonder" -> return ImageGetter.getUnitIcon("Great Engineer")
"Construct Manufactory" -> return ImageGetter.getImage("ImprovementIcons/Manufactory_(Civ5).png") "Construct Manufactory" -> return ImageGetter.getImprovementIcon("Manufactory")
"Conduct Trade Mission" -> return ImageGetter.getUnitIcon("Great Merchant") "Conduct Trade Mission" -> return ImageGetter.getUnitIcon("Great Merchant")
"Construct Customs House" -> return ImageGetter.getImage("ImprovementIcons/Customs_house_(Civ5).png") "Construct Customs House" -> return ImageGetter.getImprovementIcon("Customs house")
else -> return ImageGetter.getImage("OtherIcons/Star.png") else -> return ImageGetter.getImage("OtherIcons/Star.png")
} }
} }