Show retreating armies in progress panels (#8688)

This commit is contained in:
2026-07-17 20:41:06 -07:00
committed by GitHub
parent 89d1d15979
commit 62fd16cec5
2 changed files with 13 additions and 4 deletions
@@ -24,9 +24,11 @@ namespace eagle {
public void
Populate(ShardokBattleView battle, IGameModel model, Action<string> goToBattleAction) {
model.Provinces.TryGetValue(battle.DefenderProvince, out var pv);
provinceLabel.text = AttackerOriginsText(battle, model);
defenderProvinceLabel.text =
pv != null ? pv.Name : $"Province {battle.DefenderProvince}";
provinceLabel.text =
RetreatingLabel(AttackerOriginsText(battle, model), battle.AttackerRetreating);
defenderProvinceLabel.text = RetreatingLabel(
pv != null ? pv.Name : $"Province {battle.DefenderProvince}",
battle.DefenderRetreating);
bool isSelf = battle.PlayerInfos.Any(pi => pi.Hostility == Hostility.SelfHostility);
bool isAllied = isSelf ||
@@ -136,6 +138,11 @@ namespace eagle {
return $"Province {provinceId}";
}
private static string RetreatingLabel(string label, bool isRetreating) {
if (!isRetreating) return label;
return string.IsNullOrEmpty(label) ? "Retreating" : $"{label} (Retreating)";
}
private void SetFightButtonTutorialRegistration(bool shouldRegister) {
var registry = TutorialManager.Instance?.TargetRegistry;
if (registry == null) return;
@@ -163,7 +163,9 @@ namespace eagle {
newRow.HeroCount = army.HeroCount;
newRow.TroopCount = army.TroopCount;
newRow.Origin = Model.Provinces[army.OriginProvinceId].Name;
newRow.Destination = Model.Provinces[army.DestinationProvinceId].Name;
var destination = Model.Provinces[army.DestinationProvinceId].Name;
newRow.Destination =
army.IsRetreating ? $"{destination} (Retreating)" : destination;
if (CurrentProvince != null && army.DestinationProvinceId == CurrentProvince.Id) {
newRow.DestinationColor = Color.blue;
} else {