Extract strings from resource renderer.

This commit is contained in:
Matthias Mailänder
2024-04-02 12:57:55 +02:00
committed by Gustas
parent 6c9e33b76c
commit 97c61e0068
11 changed files with 41 additions and 9 deletions

View File

@@ -39,6 +39,7 @@ namespace OpenRA.Mods.Common.Traits
[FieldLoader.Require]
[Desc("Resource name used by tooltips.")]
[TranslationReference]
public readonly string Name = null;
public ResourceTypeInfo(MiniYaml yaml)
@@ -266,7 +267,14 @@ namespace OpenRA.Mods.Common.Traits
protected virtual string GetRenderedResourceType(CPos cell) { return RenderContents[cell].Type; }
protected virtual string GetRenderedResourceTooltip(CPos cell) { return RenderContents[cell].Info?.Name; }
protected virtual string GetRenderedResourceTooltip(CPos cell)
{
var info = RenderContents[cell].Info;
if (info == null)
return null;
return TranslationProvider.GetString(info.Name);
}
IEnumerable<string> IResourceRenderer.ResourceTypes => Info.ResourceTypes.Keys;