From 70143932113d8a5220423ee7e5d66dfac71618d0 Mon Sep 17 00:00:00 2001 From: Mustafa Alperen Seki Date: Sun, 10 Dec 2017 13:19:17 +0300 Subject: [PATCH] Move Generic Prefixes to yaml and add prefix for Neutral --- OpenRA.Mods.Common/Traits/Tooltip.cs | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/OpenRA.Mods.Common/Traits/Tooltip.cs b/OpenRA.Mods.Common/Traits/Tooltip.cs index 40c713d1b0..e7b0991c61 100644 --- a/OpenRA.Mods.Common/Traits/Tooltip.cs +++ b/OpenRA.Mods.Common/Traits/Tooltip.cs @@ -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; } } -} \ No newline at end of file +}