mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-29 15:01:09 -04:00
Replaced city connection icon, luxury resources now have a smiley next to them and strategic resources have a production symbol
This commit is contained in:
parent
0d630abc14
commit
5d3c7a3a5e
@ -61,3 +61,4 @@ All the following are from [the Noun Project](https://thenounproject.com) licenc
|
|||||||
* [Leather](https://thenounproject.com/term/leather/16499/) By Alen Krummenacher
|
* [Leather](https://thenounproject.com/term/leather/16499/) By Alen Krummenacher
|
||||||
* [Gem](https://thenounproject.com/term/gem/948920/) By Lluisa Iborra
|
* [Gem](https://thenounproject.com/term/gem/948920/) By Lluisa Iborra
|
||||||
* [Joss Stick](https://thenounproject.com/search/?q=incense&i=583033) By Hea Poh Lin
|
* [Joss Stick](https://thenounproject.com/search/?q=incense&i=583033) By Hea Poh Lin
|
||||||
|
* [Connection](https://thenounproject.com/search/?q=connection&i=1521886) By Travis Avery
|
Before Width: | Height: | Size: 7.2 KiB After Width: | Height: | Size: 7.2 KiB |
Binary file not shown.
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 3.7 KiB |
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Before Width: | Height: | Size: 820 KiB After Width: | Height: | Size: 867 KiB |
@ -26,6 +26,8 @@ class CityTileGroup(private val city: CityInfo, tileInfo: TileInfo) : TileGroup(
|
|||||||
if (improvementImage != null) improvementImage!!.setColor(1f, 1f, 1f, 0.5f)
|
if (improvementImage != null) improvementImage!!.setColor(1f, 1f, 1f, 0.5f)
|
||||||
if (resourceImage != null) resourceImage!!.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 (cityImage != null) cityImage!!.setColor(1f, 1f, 1f, 0.5f)
|
||||||
|
if (civilianUnitImage != null) civilianUnitImage!!.setColor(1f, 1f, 1f, 0.5f)
|
||||||
|
if (militaryUnitImage!= null) militaryUnitImage!!.setColor(1f, 1f, 1f, 0.5f)
|
||||||
if (terrainFeatureImage!= null) terrainFeatureImage!!.setColor(1f, 1f, 1f, 0.5f)
|
if (terrainFeatureImage!= null) terrainFeatureImage!!.setColor(1f, 1f, 1f, 0.5f)
|
||||||
updateYieldGroup()
|
updateYieldGroup()
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package com.unciv.ui.tilegroups
|
package com.unciv.ui.tilegroups
|
||||||
|
|
||||||
import com.badlogic.gdx.graphics.Color
|
import com.badlogic.gdx.graphics.Color
|
||||||
|
import com.badlogic.gdx.scenes.scene2d.Actor
|
||||||
import com.badlogic.gdx.scenes.scene2d.Group
|
import com.badlogic.gdx.scenes.scene2d.Group
|
||||||
import com.badlogic.gdx.scenes.scene2d.ui.Image
|
import com.badlogic.gdx.scenes.scene2d.ui.Image
|
||||||
import com.badlogic.gdx.utils.Align
|
import com.badlogic.gdx.utils.Align
|
||||||
@ -20,7 +21,7 @@ open class TileGroup(var tileInfo: TileInfo) : Group() {
|
|||||||
protected var terrainFeatureImage:Image?=null
|
protected var terrainFeatureImage:Image?=null
|
||||||
protected var cityImage:Image?=null
|
protected var cityImage:Image?=null
|
||||||
|
|
||||||
protected var resourceImage: Image? = null
|
protected var resourceImage: Actor? = null
|
||||||
protected var improvementImage: Image? =null
|
protected var improvementImage: Image? =null
|
||||||
var populationImage: Image? = null
|
var populationImage: Image? = null
|
||||||
private val roadImages = HashMap<TileInfo, RoadImage>()
|
private val roadImages = HashMap<TileInfo, RoadImage>()
|
||||||
@ -301,17 +302,14 @@ open class TileGroup(var tileInfo: TileInfo) : Group() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(resourceImage==null && shouldDisplayResource) { // Need to add the resource image!
|
if(resourceImage==null && shouldDisplayResource) { // Need to add the resource image!
|
||||||
val fileName = "ResourceIcons/" + tileInfo.resource + "_(Civ5).png"
|
resourceImage = ImageGetter.getResourceImage(tileInfo.resource!!,20f)
|
||||||
resourceImage = ImageGetter.getImage(fileName)
|
|
||||||
resourceImage!!.setSize(20f, 20f)
|
|
||||||
resourceImage!!.center(this)
|
resourceImage!!.center(this)
|
||||||
resourceImage!!.x -= 22 // left
|
resourceImage!!.x = resourceImage!!.x - 22 // left
|
||||||
resourceImage!!.y += 10 // top
|
resourceImage!!.y = resourceImage!!.y + 10 // top
|
||||||
addActor(resourceImage!!)
|
addActor(resourceImage!!)
|
||||||
}
|
}
|
||||||
if(resourceImage!=null){
|
if(resourceImage!=null){
|
||||||
if(viewable) resourceImage!!.color= Color.WHITE
|
resourceImage!!.color= Color.WHITE.cpy().apply { a=0.7f }
|
||||||
else resourceImage!!.color= Color.WHITE.cpy().apply { a=0.7f }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -73,10 +73,10 @@ class WorldTileGroup(tileInfo: TileInfo) : TileGroup(tileInfo) {
|
|||||||
if (cityButton == null) {
|
if (cityButton == null) {
|
||||||
cityButton = Table()
|
cityButton = Table()
|
||||||
cityButton!!.background = ImageGetter.getDrawable("OtherIcons/civTableBackground.png")
|
cityButton!!.background = ImageGetter.getDrawable("OtherIcons/civTableBackground.png")
|
||||||
cityButton!!.isTransform = true
|
cityButton!!.isTransform = true // If this is not set then the city button won't scale!
|
||||||
|
|
||||||
addActor(cityButton)
|
addActor(cityButton)
|
||||||
zIndex = parent.children.size // so this tile is rendered over neighboring tiles
|
toFront() // so this tile is rendered over neighboring tiles
|
||||||
}
|
}
|
||||||
|
|
||||||
val cityButtonText = city.name + " (" + city.population.population + ")"
|
val cityButtonText = city.name + " (" + city.population.population + ")"
|
||||||
@ -89,7 +89,7 @@ class WorldTileGroup(tileInfo: TileInfo) : TileGroup(tileInfo) {
|
|||||||
|
|
||||||
cityButton!!.run {
|
cityButton!!.run {
|
||||||
clear()
|
clear()
|
||||||
if(viewable) {
|
if(viewable && city.health<city.getMaxHealth().toFloat()) {
|
||||||
val healthBarSize = 100f
|
val healthBarSize = 100f
|
||||||
val healthPercent = city.health / city.getMaxHealth().toFloat()
|
val healthPercent = city.health / city.getMaxHealth().toFloat()
|
||||||
val healthBar = Table()
|
val healthBar = Table()
|
||||||
@ -107,15 +107,15 @@ class WorldTileGroup(tileInfo: TileInfo) : TileGroup(tileInfo) {
|
|||||||
|
|
||||||
if(city.isBeingRazed){
|
if(city.isBeingRazed){
|
||||||
val fireImage = ImageGetter.getImage("OtherIcons/Fire.png")
|
val fireImage = ImageGetter.getImage("OtherIcons/Fire.png")
|
||||||
add(fireImage).size(20f).padLeft(5f)
|
add(fireImage).size(20f).pad(2f).padLeft(5f)
|
||||||
}
|
}
|
||||||
if(city.isCapital()){
|
if(city.isCapital()){
|
||||||
val starImage = ImageGetter.getImage("OtherIcons/Star.png").apply { color = Color.LIGHT_GRAY}
|
val starImage = ImageGetter.getImage("OtherIcons/Star.png").apply { color = Color.LIGHT_GRAY}
|
||||||
add(starImage).size(20f).padLeft(5f)
|
add(starImage).size(20f).pad(2f).padLeft(5f)
|
||||||
}
|
}
|
||||||
else if (city.civInfo.isPlayerCivilization() && city.cityStats.isConnectedToCapital(RoadStatus.Road)){
|
else if (city.civInfo.isPlayerCivilization() && city.cityStats.isConnectedToCapital(RoadStatus.Road)){
|
||||||
val connectionImage = ImageGetter.getStatIcon("CityConnection")
|
val connectionImage = ImageGetter.getStatIcon("CityConnection")
|
||||||
add(connectionImage).size(20f).padLeft(5f)
|
add(connectionImage).size(20f).pad(2f).padLeft(5f)
|
||||||
}
|
}
|
||||||
|
|
||||||
else{add()} // this is so the health bar is always 2 columns wide
|
else{add()} // this is so the health bar is always 2 columns wide
|
||||||
@ -130,5 +130,4 @@ class WorldTileGroup(tileInfo: TileInfo) : TileGroup(tileInfo) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -3,9 +3,13 @@ package com.unciv.ui.utils
|
|||||||
import com.badlogic.gdx.graphics.Color
|
import com.badlogic.gdx.graphics.Color
|
||||||
import com.badlogic.gdx.graphics.g2d.TextureAtlas
|
import com.badlogic.gdx.graphics.g2d.TextureAtlas
|
||||||
import com.badlogic.gdx.graphics.g2d.TextureRegion
|
import com.badlogic.gdx.graphics.g2d.TextureRegion
|
||||||
|
import com.badlogic.gdx.scenes.scene2d.Actor
|
||||||
|
import com.badlogic.gdx.scenes.scene2d.Group
|
||||||
import com.badlogic.gdx.scenes.scene2d.ui.Image
|
import com.badlogic.gdx.scenes.scene2d.ui.Image
|
||||||
import com.badlogic.gdx.scenes.scene2d.utils.Drawable
|
import com.badlogic.gdx.scenes.scene2d.utils.Drawable
|
||||||
import com.badlogic.gdx.scenes.scene2d.utils.TextureRegionDrawable
|
import com.badlogic.gdx.scenes.scene2d.utils.TextureRegionDrawable
|
||||||
|
import com.unciv.models.gamebasics.GameBasics
|
||||||
|
import com.unciv.models.gamebasics.tile.ResourceType
|
||||||
|
|
||||||
object ImageGetter {
|
object ImageGetter {
|
||||||
const val WhiteDot = "OtherIcons/whiteDot.png"
|
const val WhiteDot = "OtherIcons/whiteDot.png"
|
||||||
@ -69,4 +73,34 @@ object ImageGetter {
|
|||||||
fun refreshAltas() {
|
fun refreshAltas() {
|
||||||
atlas = TextureAtlas("game.atlas")
|
atlas = TextureAtlas("game.atlas")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun getResourceImage(resourceName: String, size:Float): Actor {
|
||||||
|
val group= Group()
|
||||||
|
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)
|
||||||
|
|
||||||
|
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
|
||||||
|
// happiness.y = group.height-happiness.height
|
||||||
|
group.addActor(happiness)
|
||||||
|
}
|
||||||
|
if(resource.resourceType==ResourceType.Strategic){
|
||||||
|
val production = getStatIcon("Production")
|
||||||
|
production.setSize(size/2,size/2)
|
||||||
|
production.x = group.width-production.width
|
||||||
|
// production.y = group.height-production.height
|
||||||
|
group.addActor(production)
|
||||||
|
}
|
||||||
|
return group
|
||||||
|
return getImage("ResourceIcons/${resourceName}")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package com.unciv.ui.worldscreen
|
package com.unciv.ui.worldscreen
|
||||||
|
|
||||||
import com.badlogic.gdx.graphics.Color
|
import com.badlogic.gdx.graphics.Color
|
||||||
|
import com.badlogic.gdx.scenes.scene2d.Actor
|
||||||
import com.badlogic.gdx.scenes.scene2d.Group
|
import com.badlogic.gdx.scenes.scene2d.Group
|
||||||
import com.badlogic.gdx.scenes.scene2d.ui.Image
|
import com.badlogic.gdx.scenes.scene2d.ui.Image
|
||||||
import com.badlogic.gdx.scenes.scene2d.ui.Label
|
import com.badlogic.gdx.scenes.scene2d.ui.Label
|
||||||
@ -27,9 +28,9 @@ class WorldScreenTopBar(val screen: WorldScreen) : Table() {
|
|||||||
private val happinessLabel = Label("Happiness:", labelSkin)
|
private val happinessLabel = Label("Happiness:", labelSkin)
|
||||||
private val cultureLabel = Label("Culture:", labelSkin).setFontColor(colorFromRGB(210, 94, 210) )
|
private val cultureLabel = Label("Culture:", labelSkin).setFontColor(colorFromRGB(210, 94, 210) )
|
||||||
private val resourceLabels = HashMap<String, Label>()
|
private val resourceLabels = HashMap<String, Label>()
|
||||||
private val resourceImages = HashMap<String, Image>()
|
private val resourceImages = HashMap<String, Actor>()
|
||||||
private val happinessImage = Group()
|
private val happinessImage = Group()
|
||||||
// These are all to improve performance IE recude update time (was 150 ms on my phone, which is a lot!)
|
// These are all to improve performance IE reduce update time (was 150 ms on my phone, which is a lot!)
|
||||||
private val malcontentColor = Color.valueOf("ef5350")
|
private val malcontentColor = Color.valueOf("ef5350")
|
||||||
val happinessColor = colorFromRGB(92, 194, 77)
|
val happinessColor = colorFromRGB(92, 194, 77)
|
||||||
val malcontentGroup = ImageGetter.getStatIcon("Malcontent")
|
val malcontentGroup = ImageGetter.getStatIcon("Malcontent")
|
||||||
@ -58,10 +59,9 @@ class WorldScreenTopBar(val screen: WorldScreen) : Table() {
|
|||||||
val revealedStrategicResources = GameBasics.TileResources.values
|
val revealedStrategicResources = GameBasics.TileResources.values
|
||||||
.filter { it.resourceType == ResourceType.Strategic } // && civInfo.tech.isResearched(it.revealedBy!!) }
|
.filter { it.resourceType == ResourceType.Strategic } // && civInfo.tech.isResearched(it.revealedBy!!) }
|
||||||
for (resource in revealedStrategicResources) {
|
for (resource in revealedStrategicResources) {
|
||||||
val fileName = "ResourceIcons/${resource.name}_(Civ5).png"
|
val resourceImage = ImageGetter.getResourceImage(resource.name,20f)
|
||||||
val resourceImage = ImageGetter.getImage(fileName)
|
|
||||||
resourceImages.put(resource.name, resourceImage)
|
resourceImages.put(resource.name, resourceImage)
|
||||||
resourceTable.add(resourceImage).size(20f)
|
resourceTable.add(resourceImage)
|
||||||
val resourceLabel = Label("0", labelSkin)
|
val resourceLabel = Label("0", labelSkin)
|
||||||
resourceLabels.put(resource.name, resourceLabel)
|
resourceLabels.put(resource.name, resourceLabel)
|
||||||
resourceTable.add(resourceLabel)
|
resourceTable.add(resourceLabel)
|
||||||
|
@ -2,20 +2,22 @@ package com.unciv.game.desktop;
|
|||||||
|
|
||||||
import com.badlogic.gdx.backends.lwjgl.LwjglApplication;
|
import com.badlogic.gdx.backends.lwjgl.LwjglApplication;
|
||||||
import com.badlogic.gdx.backends.lwjgl.LwjglApplicationConfiguration;
|
import com.badlogic.gdx.backends.lwjgl.LwjglApplicationConfiguration;
|
||||||
|
import com.badlogic.gdx.graphics.Texture;
|
||||||
|
import com.badlogic.gdx.tools.texturepacker.TexturePacker;
|
||||||
import com.unciv.UnCivGame;
|
import com.unciv.UnCivGame;
|
||||||
|
|
||||||
class DesktopLauncher {
|
class DesktopLauncher {
|
||||||
public static void main (String[] arg) {
|
public static void main (String[] arg) {
|
||||||
//
|
|
||||||
// TexturePacker.Settings settings = new TexturePacker.Settings();
|
TexturePacker.Settings settings = new TexturePacker.Settings();
|
||||||
// settings.maxWidth = 2048;
|
settings.maxWidth = 2048;
|
||||||
// settings.maxHeight = 2048;
|
settings.maxHeight = 2048;
|
||||||
// settings.combineSubdirectories=true;
|
settings.combineSubdirectories=true;
|
||||||
//
|
|
||||||
// // This is so they don't look all pixelated
|
// This is so they don't look all pixelated
|
||||||
// settings.filterMag = Texture.TextureFilter.MipMapLinearLinear;
|
settings.filterMag = Texture.TextureFilter.MipMapLinearLinear;
|
||||||
// settings.filterMin = Texture.TextureFilter.MipMapLinearLinear;
|
settings.filterMin = Texture.TextureFilter.MipMapLinearLinear;
|
||||||
// TexturePacker.process(settings, "../images", ".", "game");
|
TexturePacker.process(settings, "../images", ".", "game");
|
||||||
|
|
||||||
LwjglApplicationConfiguration config = new LwjglApplicationConfiguration();
|
LwjglApplicationConfiguration config = new LwjglApplicationConfiguration();
|
||||||
new LwjglApplication(new UnCivGame(), config);
|
new LwjglApplication(new UnCivGame(), config);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user