From 8fa034356822dc3d4be1ce51207960008bc7b654 Mon Sep 17 00:00:00 2001 From: vegeta1k95 <32207817+vegeta1k95@users.noreply.github.com> Date: Tue, 10 Jan 2023 08:18:04 +0100 Subject: [PATCH] Fix foreign units flags fading (#8352) Co-authored-by: tunerzinc@gmail.com --- core/src/com/unciv/ui/tilegroups/TileGroupIcons.kt | 4 ++-- core/src/com/unciv/ui/utils/UnitGroup.kt | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/core/src/com/unciv/ui/tilegroups/TileGroupIcons.kt b/core/src/com/unciv/ui/tilegroups/TileGroupIcons.kt index ee33ef2757..36db6b5525 100644 --- a/core/src/com/unciv/ui/tilegroups/TileGroupIcons.kt +++ b/core/src/com/unciv/ui/tilegroups/TileGroupIcons.kt @@ -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 diff --git a/core/src/com/unciv/ui/utils/UnitGroup.kt b/core/src/com/unciv/ui/utils/UnitGroup.kt index 517780458e..21ccb84fd9 100644 --- a/core/src/com/unciv/ui/utils/UnitGroup.kt +++ b/core/src/com/unciv/ui/utils/UnitGroup.kt @@ -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 }