Icons for city states (#5160)

* Add city state icons

* Add the icons

* Get filename from cityStateType.name

* less padding

* Icon names in enum, icons in diplomacy screen
This commit is contained in:
SimonCeder 2021-09-09 20:28:30 +02:00 committed by GitHub
parent 9a35323331
commit cbd3c2910e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 29 additions and 6 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

View File

@ -1,10 +1,11 @@
package com.unciv.logic.civilization
enum class CityStateType(val color: String = "") {
Cultured("#8b60ff"),
Maritime("#38ff70"),
Mercantile("#ffd800"),
Militaristic("#ff0000")
enum class CityStateType(val color: String = "", val icon: String) {
Cultured("#8b60ff", "OtherIcons/Cultured"),
Maritime("#38ff70", "OtherIcons/Maritime"),
Mercantile("#ffd800", "OtherIcons/Mercantile"),
Militaristic("#ff0000", "OtherIcons/Militaristic"),
//Religious("#FFFFFF", "OtherIcons/Religious")
}
enum class CityStatePersonality {

View File

@ -15,6 +15,7 @@ import com.unciv.logic.city.CityConstructions
import com.unciv.logic.city.CityInfo
import com.unciv.logic.city.INonPerpetualConstruction
import com.unciv.logic.city.PerpetualConstruction
import com.unciv.logic.civilization.CityStateType
import com.unciv.logic.civilization.diplomacy.RelationshipLevel
import com.unciv.ui.cityscreen.CityScreen
import com.unciv.ui.trade.DiplomacyScreen
@ -226,7 +227,8 @@ class CityButton(val city: CityInfo, private val tileGroup: WorldTileGroup): Tab
val cityButtonText = city.name
val label = cityButtonText.toLabel(secondaryColor)
iconTable.add(label).padRight(20f).padLeft(20f) // sufficient horizontal padding
val rightPadding = if (city.civInfo.isCityState()) 10f else 20f // CS needs less padding here as there will be an icon
iconTable.add(label).padRight(rightPadding).padLeft(20f) // sufficient horizontal padding
.fillY() // provide full-height clicking area
label.toBack() // this is so the label is rendered right before the population group,
// so we save the font texture and avoid another texture switch
@ -237,6 +239,11 @@ class CityButton(val city: CityInfo, private val tileGroup: WorldTileGroup): Tab
iconTable.addActor(cityStrengthLabel) // We create this here to we can .toBack() it as well.
cityStrengthLabel.toBack()
if (city.civInfo.isCityState()) {
val cityStateImage = ImageGetter.getImage(city.civInfo.cityStateType.icon).apply { color = secondaryColor }
iconTable.add(cityStateImage).size(20f).fillY()
}
if (uncivGame.viewEntireMapForDebug || belongsToViewingCiv() || worldScreen.viewingCiv.isSpectator()) {
val constructionGroup = getConstructionGroup(city.cityConstructions)
iconTable.add(constructionGroup)

View File

@ -89,6 +89,17 @@ class DiplomacyScreen(val viewingCiv:CivilizationInfo):CameraStageBaseScreen() {
}
civIndicator.addActor(relationshipIcon)
if (civ.isCityState()) {
val innerColor = civ.gameInfo.ruleSet.nations[civ.civName]!!.getInnerColor()
val typeIcon = ImageGetter.getImage(civ.cityStateType.icon)
.surroundWithCircle(size = 35f, color = innerColor).apply {
actor.color = Color.BLACK
}
civIndicator.addActor(typeIcon)
typeIcon.y = floor(civIndicator.height - typeIcon.height)
typeIcon.x = floor(civIndicator.width - typeIcon.width)
}
if (civ.isCityState() && civ.questManager.haveQuestsFor(viewingCiv)) {
val questIcon = ImageGetter.getImage("OtherIcons/Quest")
.surroundWithCircle(size = 30f, color = Color.GOLDENROD)

View File

@ -634,6 +634,10 @@ Unless otherwise specified, all the following are from [the Noun Project](https:
* [Shield](https://thenounproject.com/search/?q=shield&i=813568) by Gregor Cresnar for Religious Strength
* [skill sword flame](https://thenounproject.com/term/skill-sword-flame/2360212/) by Maxicons) for Remove Heresy
* [Pencil](https://thenounproject.com/search/?q=pencil&i=4195852) by Muhamad Aldi Maulana for Enter Text Prompt Button / Pencil
* [Parchment](https://thenounproject.com/term/parchment/1516378/) by hans draiman for Cultured City-States
* [connection](https://thenounproject.com/term/connection/1365233/) by Popular for Mercantile City-States
* [crossed sword](https://thenounproject.com/term/crossed-sword/2427559/) by ProSymbols for Militaristic City-States
* [ship helm](https://thenounproject.com/term/ship-helm/2170591/) by Vectors Market for Maritime City-States
## Main menu