Fixed images of Burial Tomb and Paper Maker

Techs now display little icons of their effects
This commit is contained in:
Yair Morgenstern 2018-11-03 19:19:30 +02:00
parent 5e9b62162c
commit 8b12b80f34
7 changed files with 2372 additions and 44 deletions

View file

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 2.9 KiB

2330
android/assets/game.atlas Normal file

File diff suppressed because it is too large Load diff

View file

@ -21,8 +21,8 @@ android {
applicationId "com.unciv.game"
minSdkVersion 14
targetSdkVersion 26
versionCode 154
versionName "2.9.7"
versionCode 155
versionName "2.9.8"
}
buildTypes {
release {

View file

@ -49,7 +49,7 @@ class CityStatsTable(val cityScreen: CityScreen) : Table(){
val buildingPickButton = Button(CameraStageBaseScreen.skin)
val buildingText = city.cityConstructions.getCityProductionTextForCityButton()
buildingPickButton.add(ImageGetter.getConstructionImage(city.cityConstructions.currentConstruction))
.size(40f).padRight(5f)
.size(30f).pad(5f)
buildingPickButton.add(Label(buildingText , CameraStageBaseScreen.skin).setFontColor(Color.WHITE))
buildingPickButton.onClick {
UnCivGame.Current.screen = ConstructionPickerScreen(city)

View file

@ -56,22 +56,25 @@ class TechPickerScreen(internal val civInfo: CivilizationInfo) : PickerScreen()
// here we add little images of what the tech gives you
val techEnabledIcons = Table()
techEnabledIcons.defaults().pad(2.5f)
for(unit in GameBasics.Units.values.filter { it.requiredTech==techName
&& (it.uniqueTo==null || it.uniqueTo==techManager.civInfo.civName) })
techEnabledIcons.add(ImageGetter.getConstructionImage(unit.name)).size(25f).pad(2.5f)
techEnabledIcons.add(ImageGetter.IconCircleGroup(30f,ImageGetter.getConstructionImage(unit.name)))
for(building in GameBasics.Buildings.values.filter { it.requiredTech==techName
&& (it.uniqueTo==null || it.uniqueTo==techManager.civInfo.civName)})
techEnabledIcons.add(ImageGetter.getConstructionImage(building.name)).size(25f).pad(2.5f)
techEnabledIcons.add(ImageGetter.IconCircleGroup(30f,ImageGetter.getConstructionImage(building.name)))
for(improvement in GameBasics.TileImprovements.values.filter { it.techRequired==techName }) {
for(improvement in GameBasics.TileImprovements.values.filter { it.techRequired==techName || it.improvingTech==techName }) {
if(improvement.name.startsWith("Remove"))
techEnabledIcons.add(ImageGetter.getImage("OtherIcons/Stop")).size(25f).pad(2.5f)
else techEnabledIcons.add(ImageGetter.getImprovementIcon(improvement.name, 25f)).pad(2.5f)
techEnabledIcons.add(ImageGetter.getImage("OtherIcons/Stop")).size(30f)
else techEnabledIcons.add(ImageGetter.getImprovementIcon(improvement.name, 30f))
}
for(resource in GameBasics.TileResources.values.filter { it.revealedBy==techName })
techEnabledIcons.add(ImageGetter.getResourceImage(resource.name,30f))
rightSide.add(techEnabledIcons)
add(rightSide)

View file

@ -138,7 +138,7 @@ class WorldTileGroup(tileInfo: TileInfo) : TileGroup(tileInfo) {
val circle = ImageGetter.getImage("OtherIcons/Circle")
circle.setSize(25f,25f)
val image = ImageGetter.getConstructionImage(cityConstructions.currentConstruction)
image.setSize(20f,20f)
image.setSize(18f,18f)
image.centerY(group)
image.x = group.width-image.width

View file

@ -67,24 +67,18 @@ object ImageGetter {
}
fun getImprovementIcon(improvementName:String, size:Float=20f):Actor{
val group= Group()
val circle = getImage("OtherIcons/Circle").apply { setSize(size,size) }
val iconGroup = IconCircleGroup(size, getImage("ImprovementIcons/$improvementName"))
val improvement = GameBasics.TileImprovements[improvementName]!!
when {
improvement.food>0 -> circle.color= Color.GREEN.cpy().lerp(Color.WHITE,0.5f)
improvement.production>0 -> circle.color= Color.BROWN.cpy().lerp(Color.WHITE,0.5f)
improvement.gold>0 -> circle.color= Color.GOLD.cpy().lerp(Color.WHITE,0.5f)
improvement.science>0 -> circle.color= Color.GOLD.cpy().lerp(Color.BLUE,0.5f)
improvement.culture>0 -> circle.color= Color.GOLD.cpy().lerp(Color.PURPLE,0.5f)
improvement.food>0 -> iconGroup.circle.color= Color.GREEN.cpy().lerp(Color.WHITE,0.5f)
improvement.production>0 -> iconGroup.circle.color= Color.BROWN.cpy().lerp(Color.WHITE,0.5f)
improvement.gold>0 -> iconGroup.circle.color= Color.GOLD.cpy().lerp(Color.WHITE,0.5f)
improvement.science>0 -> iconGroup.circle.color= Color.GOLD.cpy().lerp(Color.BLUE,0.5f)
improvement.culture>0 -> iconGroup.circle.color= Color.GOLD.cpy().lerp(Color.PURPLE,0.5f)
}
group.setSize(size,size)
group.addActor(circle)
group.addActor(getImage("ImprovementIcons/$improvementName")
.apply { setSize(size*0.8f,size*0.8f); center(group) })
return group
return iconGroup
}
fun getConstructionImage(construction: String): Image {
@ -109,40 +103,29 @@ object ImageGetter {
}
fun getResourceImage(resourceName: String, size:Float): Actor {
val group= Group()
val iconGroup = IconCircleGroup(size,getImage("ResourceIcons/$resourceName"))
val resource = GameBasics.TileResources[resourceName]!!
val circle = getImage("OtherIcons/Circle").apply { setSize(size,size) }
if(resource.food>0) circle.color= Color.GREEN.cpy().lerp(Color.WHITE,0.5f)
else if(resource.production>0) circle.color= Color.BROWN.cpy().lerp(Color.WHITE,0.5f)
else if(resource.gold>0) circle.color= Color.GOLD.cpy().lerp(Color.WHITE,0.5f)
if(resource.food>0) iconGroup.circle.color= Color.GREEN.cpy().lerp(Color.WHITE,0.5f)
else if(resource.production>0) iconGroup.circle.color= Color.BROWN.cpy().lerp(Color.WHITE,0.5f)
else if(resource.gold>0) iconGroup.circle.color= Color.GOLD.cpy().lerp(Color.WHITE,0.5f)
group.setSize(size,size)
group.addActor(circle)
group.addActor(getImage("ResourceIcons/${resourceName}")
.apply { setSize(size*0.8f,size*0.8f); center(group) })
if(resource.resourceType==ResourceType.Luxury){
val happiness = getStatIcon("Happiness")
happiness.setSize(size/2,size/2)
happiness.x = group.width-happiness.width
group.addActor(happiness)
happiness.x = iconGroup.width-happiness.width
iconGroup.addActor(happiness)
}
if(resource.resourceType==ResourceType.Strategic){
val production = getStatIcon("Production")
production.setSize(size/2,size/2)
production.x = group.width-production.width
group.addActor(production)
production.x = iconGroup.width-production.width
iconGroup.addActor(production)
}
return group
return iconGroup
}
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
return IconCircleGroup(60f,getImage("TechIcons/$techName"))
}
fun getProgressBarVertical(width:Float,height:Float,percentComplete:Float,progressColor:Color,backgroundColor:Color): Table {
@ -153,4 +136,16 @@ object ImageGetter {
advancementGroup.pack()
return advancementGroup
}
class IconCircleGroup(size:Float, val image:Image):Group(){
val circle = getImage("OtherIcons/Circle").apply { setSize(size, size) }
init {
setSize(size, size)
addActor(circle)
image.setSize(size * 0.75f, size * 0.75f)
image.center(this)
addActor(image)
}
}
}