Extract unit names and descriptions

This commit is contained in:
Gustas
2023-11-11 14:06:08 +02:00
committed by Matthias Mailänder
parent a5e472dfe6
commit 0f5b78442b
10 changed files with 56 additions and 32 deletions

View File

@@ -111,13 +111,17 @@ namespace OpenRA.Mods.Common.Widgets.Logic
var tooltip = a.TraitInfos<EditorOnlyTooltipInfo>().FirstOrDefault(ti => ti.EnabledByDefault) as TooltipInfoBase
?? a.TraitInfos<TooltipInfo>().FirstOrDefault(ti => ti.EnabledByDefault);
var actorType = TranslationProvider.GetString(ActorTypeTooltip, Translation.Arguments("actorType", a.Name));
var searchTerms = new List<string>() { a.Name };
if (tooltip != null)
searchTerms.Add(tooltip.Name);
var actorType = TranslationProvider.GetString(ActorTypeTooltip, Translation.Arguments("actorType", a.Name));
var tooltipText = tooltip == null ? actorType : tooltip.Name + $"\n{actorType}";
allActorsTemp.Add(new ActorSelectorActor(a, editorData.Categories, searchTerms.ToArray(), tooltipText));
{
var actorName = TranslationProvider.GetString(tooltip.Name);
searchTerms.Add(actorName);
allActorsTemp.Add(new ActorSelectorActor(a, editorData.Categories, searchTerms.ToArray(), actorName + $"\n{actorType}"));
}
else
allActorsTemp.Add(new ActorSelectorActor(a, editorData.Categories, searchTerms.ToArray(), actorType));
}
allActors = allActorsTemp.ToArray();