From 2aac9ea314b519089625ddb561928dee192a9449 Mon Sep 17 00:00:00 2001 From: 9kgsofrice <65415105+9kgsofrice@users.noreply.github.com> Date: Wed, 2 Dec 2020 17:12:05 +0000 Subject: [PATCH] Nation "style" can define unit appearance (#3368) * added "style" in Nation.kt and checks in Tilegroups allows pixel units to be displayed as a specific style if appropriate file exists * Preserves "specificUnitIconLocation" in tilegroups.kt --- core/src/com/unciv/models/ruleset/Nation.kt | 1 + core/src/com/unciv/ui/tilegroups/TileGroup.kt | 10 ++++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/core/src/com/unciv/models/ruleset/Nation.kt b/core/src/com/unciv/models/ruleset/Nation.kt index c050dc8df1..12189af611 100644 --- a/core/src/com/unciv/models/ruleset/Nation.kt +++ b/core/src/com/unciv/models/ruleset/Nation.kt @@ -24,6 +24,7 @@ class Nation : INamed { fun getLeaderDisplayName() = if (isCityState()) name else "[$leaderName] of [$name]" + val style = "" var cityStateType: CityStateType? = null var preferredVictoryType: VictoryType = VictoryType.Neutral var declaringWar = "" diff --git a/core/src/com/unciv/ui/tilegroups/TileGroup.kt b/core/src/com/unciv/ui/tilegroups/TileGroup.kt index 09311589a2..99e6773381 100644 --- a/core/src/com/unciv/ui/tilegroups/TileGroup.kt +++ b/core/src/com/unciv/ui/tilegroups/TileGroup.kt @@ -614,7 +614,6 @@ open class TileGroup(var tileInfo: TileInfo, var tileSetStrings:TileSetStrings) } } } - fun updatePixelMilitaryUnit(showMilitaryUnit: Boolean) { var newImageLocation = "" @@ -624,8 +623,11 @@ open class TileGroup(var tileInfo: TileInfo, var tileSetStrings:TileSetStrings) val specificUnitIconLocation = tileSetStrings.unitsLocation + militaryUnit.name newImageLocation = when { !UncivGame.Current.settings.showPixelUnits -> "" + militaryUnit.civInfo.nation.style=="" && + ImageGetter.imageExists(specificUnitIconLocation) -> specificUnitIconLocation + ImageGetter.imageExists(specificUnitIconLocation + "-" + militaryUnit.civInfo.nation.style) -> + specificUnitIconLocation + "-" + militaryUnit.civInfo.nation.style ImageGetter.imageExists(specificUnitIconLocation) -> specificUnitIconLocation - militaryUnit.baseUnit.replaces!=null && ImageGetter.imageExists(tileSetStrings.unitsLocation + militaryUnit.baseUnit.replaces) -> tileSetStrings.unitsLocation + militaryUnit.baseUnit.replaces @@ -664,6 +666,10 @@ open class TileGroup(var tileInfo: TileInfo, var tileSetStrings:TileSetStrings) val specificUnitIconLocation = tileSetStrings.unitsLocation + civilianUnit.name newImageLocation = when { !UncivGame.Current.settings.showPixelUnits -> "" + civilianUnit.civInfo.nation.style=="" && + ImageGetter.imageExists(specificUnitIconLocation) -> specificUnitIconLocation + ImageGetter.imageExists(specificUnitIconLocation + "-" + civilianUnit.civInfo.nation.style) -> + specificUnitIconLocation + "-" + civilianUnit.civInfo.nation.style ImageGetter.imageExists(specificUnitIconLocation) -> specificUnitIconLocation else -> "" }