Move Generic Prefixes to yaml and add prefix for Neutral

This commit is contained in:
Mustafa Alperen Seki
2017-12-10 13:19:17 +03:00
committed by Paul Chote
parent 841c873276
commit 7014393211

View File

@@ -31,9 +31,18 @@ namespace OpenRA.Mods.Common.Traits
"to be shown to chosen players.")]
[Translate] public readonly string GenericName = null;
[Desc("Prefix generic tooltip name with 'Enemy' or 'Allied'.")]
[Desc("Prefix generic tooltip name with 'Ally/Neutral/EnemyPrefix'.")]
public readonly bool GenericStancePrefix = true;
[Desc("Prefix to display in the tooltip for allied units.")]
[Translate] public readonly string AllyPrefix = "Allied";
[Desc("Prefix to display in the tooltip for neutral units.")]
[Translate] public readonly string NeutralPrefix = null;
[Desc("Prefix to display in the tooltip for enemy units.")]
[Translate] public readonly string EnemyPrefix = "Enemy";
[Desc("Player stances that the generic name should be shown to.")]
public readonly Stance GenericVisibility = Stance.None;
@@ -47,11 +56,14 @@ namespace OpenRA.Mods.Common.Traits
if (stance == Stance.None || !GenericVisibility.HasStance(stance))
return Name;
if (GenericStancePrefix && stance == Stance.Ally)
return "Allied " + GenericName;
if (GenericStancePrefix && !string.IsNullOrEmpty(AllyPrefix) && stance == Stance.Ally)
return AllyPrefix + " " + GenericName;
if (GenericStancePrefix && stance == Stance.Enemy)
return "Enemy " + GenericName;
if (GenericStancePrefix && !string.IsNullOrEmpty(NeutralPrefix) && stance == Stance.Neutral)
return NeutralPrefix + " " + GenericName;
if (GenericStancePrefix && !string.IsNullOrEmpty(EnemyPrefix) && stance == Stance.Enemy)
return EnemyPrefix + " " + GenericName;
return GenericName;
}
@@ -74,4 +86,4 @@ namespace OpenRA.Mods.Common.Traits
this.info = info;
}
}
}
}