Resolved #883 - Added Civilization icons

This commit is contained in:
Yair Morgenstern 2019-06-19 18:43:25 +03:00
parent 27c83f1792
commit 227f6627be
22 changed files with 596 additions and 478 deletions

View file

@ -411,6 +411,22 @@ All the following are from [the Noun Project](https://thenounproject.com) licenc
* [Harvest](https://thenounproject.com/term/harvest/1022373/) By Made for Flood plains
* [Puddle](https://thenounproject.com/search/?q=puddle&i=1138155) By Bakunetsu Kaito for Lakes
## Nations
* [Eye of Horus](https://thenounproject.com/search/?q=eye%20of%20horus&i=92471) By Lilit Kalachyan for Egypt
* [Russia](https://thenounproject.com/search/?q=russia&i=64137) By Eugen Belyakoff
* [Yin Yang](https://thenounproject.com/search/?q=tao&i=1023129) By andriwidodo for China
* [Lion](https://thenounproject.com/search/?q=lion&i=912735) By parkjisun for Babylon
* [Omega](https://thenounproject.com/search/?q=omega&i=1925519) By icon 54 for Greece
* [Shield](https://thenounproject.com/search/?q=American%20shield&i=5825) By Nathan Driskell for America
* [Fleaur de Lis](https://thenounproject.com/search/?q=fleur%20de&i=78672) By Jessika Gadoury for France
* [Crown](https://thenounproject.com/search/?q=crown&i=607405) By Peter van Driel for England
* [Wreath](https://thenounproject.com/search/?q=laurel&i=692545) by VectorBakery or Roman
* [Iron Cross](https://thenounproject.com/search/?q=iron%20cross&i=373241) By Souvik Maity for Germany
* [Star and Crecent](https://thenounproject.com/search/?q=star%20and%20crescent&i=2552427) for Arabia
* [Family Crest Komon](https://thenounproject.com/search/?q=oda&i=2293528) by sahua d for Japan
* [Ashika Chakra](https://thenounproject.com/search/?q=ashoka%20chakra&i=2328559) by sahua d for India
## Others
* [Circle](https://thenounproject.com/term/circle/1841891/) By Aybige
@ -451,3 +467,5 @@ Sounds are from FreeSound.org and are either Creative Commons or Public Domain
* [Horse Neigh 2](https://freesound.org/people/GoodListener/sounds/322450/) By GoodListener as 'horse' for cavalry attack sounds
* [machine gun 001 - loop](https://freesound.org/people/pgi/sounds/212602/) By pgi as 'machinegun' for machine gun attack sound
* [uzzi_full_single](https://freesound.org/people/Deganoth/sounds/348685/) By Deganoth as 'shot' for bullet attacks

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

View file

Before

Width:  |  Height:  |  Size: 2.6 KiB

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

File diff suppressed because it is too large Load diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 948 KiB

After

Width:  |  Height:  |  Size: 1,006 KiB

View file

@ -209,7 +209,7 @@ class DiplomacyManager() {
}
if(hasOpenBorders && !newHasOpenBorders){ // borders were closed, get out!
for(unit in civInfo.getCivUnits().filter { it.currentTile.getOwner()?.civName== otherCivName }){
for(unit in civInfo.getCivUnits().filter { it.currentTile.getOwner()?.civName == otherCivName }){
unit.movementAlgs().teleportToClosestMoveableTile()
}
}

View file

@ -9,10 +9,7 @@ import com.unciv.models.gamebasics.GameBasics
import com.unciv.models.gamebasics.Nation
import com.unciv.models.gamebasics.Translations
import com.unciv.models.gamebasics.tr
import com.unciv.ui.utils.ImageGetter
import com.unciv.ui.utils.onClick
import com.unciv.ui.utils.setFontColor
import com.unciv.ui.utils.toLabel
import com.unciv.ui.utils.*
class NationTable(val nation: Nation, val newGameParameters: GameParameters, skin: Skin, width:Float, onClick:()->Unit): Table(skin){
val innerTable = Table()
@ -20,8 +17,13 @@ class NationTable(val nation: Nation, val newGameParameters: GameParameters, ski
background= ImageGetter.getBackground(nation.getSecondaryColor())
innerTable.pad(10f)
innerTable.background= ImageGetter.getBackground(nation.getColor())
innerTable.add(Label(nation.leaderName.tr()+" - "+nation.name.tr(), skin)
.apply { setFontColor(nation.getSecondaryColor())}).row()
val titleTable = Table()
titleTable.add(ImageGetter.getNationIndicator(nation,50f)).pad(10f)
titleTable.add(nation.getLeaderDisplayName().toLabel()
.apply { setFontColor(nation.getSecondaryColor()); setFontSize(24)})
innerTable.add(titleTable).row()
innerTable.add(getUniqueLabel(nation)
.apply { setWrap(true);setFontColor(nation.getSecondaryColor())})
.width(width)

View file

@ -79,7 +79,7 @@ class CityButton(val city: CityInfo, internal val tileGroup: WorldTileGroup, ski
}
if (city.isCapital()) {
if (city.civInfo.isCityState()) {
val cityStateImage = ImageGetter.getImage("OtherIcons/CityState.png")
val cityStateImage = ImageGetter.getNationIcon("CityState")
.apply { color = city.civInfo.getNation().getSecondaryColor()}
iconTable.add(cityStateImage).size(20f).pad(2f).padLeft(10f)
} else {

View file

@ -56,15 +56,7 @@ class DiplomacyScreen:CameraStageBaseScreen() {
.filterNot { it.isDefeated() || it.isPlayerCivilization() || it.isBarbarianCivilization() }) {
if (!currentPlayerCiv.knows(civ)) continue
val civIndicator = ImageGetter.getCircle().apply { color = civ.getNation().getSecondaryColor() }
.surroundWithCircle(100f).apply { circle.color = civ.getNation().getColor() }
if(civ.isCityState()){
val cityStateIcon = ImageGetter.getImage("OtherIcons/CityState.png")
cityStateIcon.setSize(70f,70f)
cityStateIcon.center(civIndicator)
cityStateIcon.color= Color.BLACK
civIndicator.addActor(cityStateIcon)
}
val civIndicator = ImageGetter.getNationIndicator(civ.getNation(),100f)
val relationship = ImageGetter.getCircle()
if(currentPlayerCiv.isAtWarWith(civ)) relationship.color = Color.RED

View file

@ -12,6 +12,7 @@ import com.badlogic.gdx.scenes.scene2d.utils.Drawable
import com.badlogic.gdx.scenes.scene2d.utils.TextureRegionDrawable
import com.badlogic.gdx.utils.Align
import com.unciv.models.gamebasics.GameBasics
import com.unciv.models.gamebasics.Nation
import com.unciv.models.gamebasics.tile.ResourceType
object ImageGetter {
@ -53,13 +54,8 @@ object ImageGetter {
}
}
fun imageExists(fileName:String): Boolean {
return atlas.findRegion(fileName)!=null
}
fun techIconExists(techName:String): Boolean {
return imageExists("TechIcons/$techName")
}
fun imageExists(fileName:String) = atlas.findRegion(fileName)!=null
fun techIconExists(techName:String) = imageExists("TechIcons/$techName")
fun getStatIcon(statName: String): Image {
return getImage("StatIcons/$statName")
@ -70,6 +66,25 @@ object ImageGetter {
return getImage("UnitIcons/$unitName").apply { this.color=color }
}
fun getNationIndicator(nation: Nation, size:Float): IconCircleGroup {
val civIndicator = getCircle().apply { color = nation.getSecondaryColor() }
.surroundWithCircle(size).apply { circle.color = nation.getColor() }
val civIconName = if(nation.isCityState()) "CityState" else nation.name
if(nationIconExists(civIconName)){
val cityStateIcon = ImageGetter.getNationIcon(civIconName)
cityStateIcon.setSize(size*0.7f,size*0.7f)
cityStateIcon.center(civIndicator)
cityStateIcon.color = nation.getColor()
civIndicator.addActor(cityStateIcon)
}
return civIndicator
}
fun nationIconExists(nation:String) = imageExists("NationIcons/$nation")
fun getNationIcon(nation:String) = getImage("NationIcons/$nation")
val foodCircleColor = colorFromRGB(129, 199, 132)
val productionCircleColor = Color.BROWN.cpy().lerp(Color.WHITE,0.5f)!!
val goldCircleColor = Color.GOLD.cpy().lerp(Color.WHITE,0.5f)!!