Changed the basic stat icons to not use the original Civ's

This commit is contained in:
Yair Morgenstern 2018-08-10 18:31:18 +03:00
parent 3515b0f6bd
commit 847bf9650d
30 changed files with 283 additions and 240 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1001 B

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 6.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 8.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 892 KiB

After

Width:  |  Height:  |  Size: 849 KiB

View File

@ -21,8 +21,8 @@ android {
applicationId "com.unciv.game"
minSdkVersion 14
targetSdkVersion 26
versionCode 117
versionName "2.7.5"
versionCode 118
versionName "2.7.6"
}
buildTypes {
release {

View File

@ -259,7 +259,7 @@ class CityScreen(internal val city: CityInfo) : CameraStageBaseScreen() {
tileTable.row()
for (entry in stats.toHashMap().filterNot { it.value==0f }) {
tileTable.add<Image>(ImageGetter.getStatIcon(entry.key.toString())).align(Align.right)
tileTable.add(ImageGetter.getStatIcon(entry.key.toString())).size(20f).align(Align.right)
tileTable.add(Label(Math.round(entry.value).toString() + "", CameraStageBaseScreen.skin)).align(Align.left)
tileTable.row()
}

View File

@ -38,7 +38,7 @@ class CityStatsTable(val cityScreen: CityScreen) : Table(){
cityStatsValues["Happiness"] = city.cityStats.getCityHappiness().values.sum().toInt().toString()
for (key in cityStatsValues.keys) {
add(ImageGetter.getStatIcon(key)).align(Align.right)
add(ImageGetter.getStatIcon(key)).size(20f).align(Align.right)
add(Label(cityStatsValues[key], CameraStageBaseScreen.skin)).align(Align.left)
row()
}

View File

@ -25,6 +25,8 @@ class CityTileGroup(private val city: CityInfo, tileInfo: TileInfo) : TileGroup(
updatePopulationImage()
if (improvementImage != null) improvementImage!!.setColor(1f, 1f, 1f, 0.5f)
if (resourceImage != null) resourceImage!!.setColor(1f, 1f, 1f, 0.5f)
if (cityImage != null) cityImage!!.setColor(1f, 1f, 1f, 0.5f)
if (terrainFeatureImage!= null) terrainFeatureImage!!.setColor(1f, 1f, 1f, 0.5f)
updateYieldGroup()
}
@ -43,9 +45,13 @@ class CityTileGroup(private val city: CityInfo, tileInfo: TileInfo) : TileGroup(
populationImage!!.setPosition(width / 2 - populationImage!!.width / 2,
height * 0.85f - populationImage!!.height / 2)
if (tileInfo.isWorked()|| tileInfo.isCityCenter())
if (tileInfo.isWorked()) {
populationImage!!.color = Color.WHITE
else populationImage!!.color = Color.GRAY
}
else if(!tileInfo.isCityCenter()){
populationImage!!.color = Color.GRAY.cpy().apply { a=0.5f }
}
populationImage!!.toFront()
}
}

View File

@ -18,21 +18,21 @@ class YieldGroup : HorizontalGroup() {
private fun getStatIconsTable(statName: String, number: Int): Table {
val table = Table()
when (number) {
1 -> table.add(ImageGetter.getStatIcon(statName))
1 -> table.add(ImageGetter.getStatIcon(statName)).size(20f)
2 -> {
table.add(ImageGetter.getStatIcon(statName)).row()
table.add(ImageGetter.getStatIcon(statName))
table.add(ImageGetter.getStatIcon(statName)).size(20f).row()
table.add(ImageGetter.getStatIcon(statName)).size(20f)
}
3 -> {
table.add(ImageGetter.getStatIcon(statName)).colspan(2).row()
table.add(ImageGetter.getStatIcon(statName))
table.add(ImageGetter.getStatIcon(statName))
table.add(ImageGetter.getStatIcon(statName)).size(20f).colspan(2).row()
table.add(ImageGetter.getStatIcon(statName)).size(20f)
table.add(ImageGetter.getStatIcon(statName)).size(20f)
}
4 -> {
table.add(ImageGetter.getStatIcon(statName))
table.add(ImageGetter.getStatIcon(statName)).row()
table.add(ImageGetter.getStatIcon(statName))
table.add(ImageGetter.getStatIcon(statName))
table.add(ImageGetter.getStatIcon(statName)).size(20f)
table.add(ImageGetter.getStatIcon(statName)).size(20f).row()
table.add(ImageGetter.getStatIcon(statName)).size(20f)
table.add(ImageGetter.getStatIcon(statName)).size(20f)
}
else -> {
val largeImage = ImageGetter.getStatIcon(statName)

View File

@ -86,8 +86,9 @@ open class TileGroup(var tileInfo: TileInfo) : Group() {
}
fun addPopulationIcon() {
populationImage = ImageGetter.getImage("StatIcons/populationGreen.png")
populationImage = ImageGetter.getImage("StatIcons/20xPopulation5")
populationImage!!.run {
color= Color.GREEN.cpy().lerp(Color.BLACK,0.5f)
setSize(20f, 20f)
center(this@TileGroup)
x += 20 // right

View File

@ -3,13 +3,12 @@ package com.unciv.ui.utils
import com.badlogic.gdx.graphics.Color
import com.badlogic.gdx.graphics.g2d.TextureAtlas
import com.badlogic.gdx.graphics.g2d.TextureRegion
import com.badlogic.gdx.scenes.scene2d.Group
import com.badlogic.gdx.scenes.scene2d.ui.Image
import com.badlogic.gdx.scenes.scene2d.utils.Drawable
import com.badlogic.gdx.scenes.scene2d.utils.TextureRegionDrawable
import java.util.*
object ImageGetter {
private var textureRegionByFileName = HashMap<String, TextureRegion>()
const val WhiteDot = "OtherIcons/whiteDot.png"
// When we used to load images directly from different files, without using a texture atlas,
@ -42,16 +41,29 @@ object ImageGetter {
return region
} catch (ex: Exception) {
return getTextureRegion(WhiteDot)
throw Exception("File $fileName not found!",ex)
}
return textureRegionByFileName[fileName]!!
}
class IconGroup(statName:String): Group() {
init{
val circleSize = 20f
val statSize = 17f
setSize(circleSize ,circleSize)
// addActor(ImageGetter.getImage("OtherIcons/Circle")
// .apply { setSize(circleSize,circleSize )} )
val iconImage = ImageGetter.getImage("StatIcons/20x" + statName + "5.png")
.apply { setSize(statSize,statSize); center(this@IconGroup)}
if(statName=="Population") iconImage.color= Color.GREEN.cpy().lerp(Color.BLACK,0.5f)
addActor(iconImage)
}
}
fun getStatIcon(name: String): Image {
return getImage("StatIcons/20x" + name + "5.png")
fun getStatIcon(statName: String): Image {
return ImageGetter.getImage("StatIcons/20x" + statName + "5.png")
.apply { setSize(20f,20f)}
// return IconGroup(name)
}
fun getUnitIcon(unitName:String):Image{
return getImage("UnitIcons/$unitName.png")
}

View File

@ -1,6 +1,7 @@
package com.unciv.ui.worldscreen
import com.badlogic.gdx.graphics.Color
import com.badlogic.gdx.scenes.scene2d.Group
import com.badlogic.gdx.scenes.scene2d.ui.Image
import com.badlogic.gdx.scenes.scene2d.ui.Label
import com.badlogic.gdx.scenes.scene2d.ui.Table
@ -27,12 +28,12 @@ class WorldScreenTopBar(val screen: WorldScreen) : Table() {
private val cultureLabel = Label("Culture:", labelSkin).setFontColor(colorFromRGB(210, 94, 210) )
private val resourceLabels = HashMap<String, Label>()
private val resourceImages = HashMap<String, Image>()
private val happinessImage = ImageGetter.getStatIcon("Happiness")
private val happinessImage = Group()
// These are all to improve performance IE recude update time (was 150 ms on my phone, which is a lot!)
private val malcontentColor = Color.valueOf("ef5350")
val happinessColor = colorFromRGB(92, 194, 77)
val malcontentDrawable = ImageGetter.getStatIcon("Malcontent").drawable
val happinessDrawable = ImageGetter.getStatIcon("Happiness").drawable
val malcontentGroup = ImageGetter.getStatIcon("Malcontent")
val happinessGroup = ImageGetter.getStatIcon("Happiness")
init {
background = ImageGetter.getBackground(ImageGetter.getBlue().lerp(Color.BLACK, 0.5f))
@ -74,15 +75,15 @@ class WorldScreenTopBar(val screen: WorldScreen) : Table() {
statsTable.defaults().pad(3f)//.align(Align.top)
statsTable.add(turnsLabel).padRight(20f)
statsTable.add(goldLabel)
statsTable.add(ImageGetter.getStatIcon("Gold")).padRight(20f)
statsTable.add(ImageGetter.getStatIcon("Gold")).padRight(20f).size(20f)
statsTable.add(scienceLabel) //.apply { setAlignment(Align.center) }).align(Align.top)
statsTable.add(ImageGetter.getStatIcon("Science")).padRight(20f)
statsTable.add(ImageGetter.getStatIcon("Science")).padRight(20f).size(20f)
statsTable.add(happinessImage)
statsTable.add(happinessImage).size(20f)
statsTable.add(happinessLabel).padRight(20f)//.apply { setAlignment(Align.center) }).align(Align.top)
statsTable.add(cultureLabel)//.apply { setAlignment(Align.center) }).align(Align.top)
statsTable.add(ImageGetter.getStatIcon("Culture"))
statsTable.add(ImageGetter.getStatIcon("Culture")).size(20f)
statsTable.pack()
statsTable.width = screen.stage.width - 20
return statsTable
@ -140,10 +141,12 @@ class WorldScreenTopBar(val screen: WorldScreen) : Table() {
if (civInfo.happiness < 0) {
happinessLabel.setFontColor(malcontentColor)
happinessImage.drawable = malcontentDrawable
happinessImage.clearChildren()
happinessImage.addActor(malcontentGroup)
} else {
happinessLabel.setFontColor(happinessColor)
happinessImage.drawable = happinessDrawable
happinessImage.clearChildren()
happinessImage.addActor(happinessGroup)
}
cultureLabel.setText(getCultureText(civInfo, nextTurnStats))

View File

@ -31,10 +31,10 @@ class TileInfoTable(private val worldScreen: WorldScreen) : Table() {
fun getStatsTable(tile: TileInfo):Table{
val table=Table()
table.pad(10f)
for (entry in tile.getTileStats(worldScreen.civInfo).toHashMap().filterNot { it.value == 0f }) {
table.add(ImageGetter.getStatIcon(entry.key.toString())).align(Align.right)
table.add(ImageGetter.getStatIcon(entry.key.toString())).size(20f).align(Align.right)
table.add(Label(entry.value.toInt().toString(), skin)).align(Align.left)
table.row()
}

View File

@ -18,8 +18,8 @@ class UnitActionsTable(val worldScreen: WorldScreen) : Table(){
return ImageGetter.getUnitIcon(unitToUpgradeTo)
}
when(unitAction){
"Move unit" -> return ImageGetter.getStatIcon("Movement")
"Stop movement"-> return ImageGetter.getStatIcon("Movement").apply { color= Color.RED }
"Move unit" -> return ImageGetter.getImage("StatIcons/20xMovement5")
"Stop movement"-> return ImageGetter.getImage("StatIcons/20xMovement5").apply { color= Color.RED }
"Fortify" -> return ImageGetter.getImage("OtherIcons/Shield.png").apply { color= Color.BLACK }
"Promote" -> return ImageGetter.getImage("OtherIcons/Star.png").apply { color= Color.GOLD }
"Construct improvement" -> return ImageGetter.getUnitIcon("Worker")