Fix foreign units flags fading (#8352)

Co-authored-by: tunerzinc@gmail.com <vfylfhby>
This commit is contained in:
vegeta1k95 2023-01-10 08:18:04 +01:00 committed by GitHub
parent a507a0c15e
commit 8fa0343568
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 3 deletions

View File

@ -100,11 +100,11 @@ class TileGroupIcons(val tileGroup: TileGroup) {
// Instead of fading out the entire unit with its background, we just fade out its central icon,
// that way it remains much more visible on the map
if (!unit.isIdle() && unit.civInfo == viewingCiv) {
if (unit.civInfo == viewingCiv && !unit.isIdle()) {
newImage.actionGroup?.color?.a = 0.5f * UncivGame.Current.settings.unitIconOpacity
}
if (unit.currentMovement == 0f) {
if (unit.civInfo == viewingCiv && unit.currentMovement == 0f) {
newImage.flagSelection.color?.apply { a *= 0.5f }
newImage.flagBg.children?.forEach { it.color.apply { a *= 0.5f } }
newImage.unitBaseImage.color.a *= 0.5f

View File

@ -145,7 +145,10 @@ class UnitGroup(val unit: MapUnit, val size: Float): Group() {
}
// Unit base icon is faded out only if out of moves
val alpha = if (unit.currentMovement == 0f) 0.5f else 1f
// Foreign unit icons are never faded!
val shouldBeFaded = (unit.owner == UncivGame.Current.worldScreen?.viewingCiv?.civName
&& unit.currentMovement == 0f)
val alpha = if (shouldBeFaded) 0.5f else 1f
unitBaseImage.color.a = alpha
flagBg.children.forEach { it.color.a = alpha }