Add tooltips to some map generator settings

Adds tooltip descriptions for a few map generator settings. The tooltips
are limited to dropdown choices. No tooltips are added for the options
containing the choices or any non-dropdown settings.

- Terrain type
- Bounds shape
- Buildings

The "Square" bounds shape is rephrased as "Rectangle" for consistency
with the added description.

This is UI-only change.
This commit is contained in:
Ashley Newson
2025-02-12 23:58:41 +00:00
committed by Gustas Kažukauskas
parent 85999d7a40
commit 39a7e477c6
8 changed files with 318 additions and 99 deletions

View File

@@ -38,6 +38,9 @@ namespace OpenRA.Mods.Common.MapGenerator
/// <summary>The label to use for UI selection. Post-fluent.</summary>
public readonly string Label = null;
/// <summary>The tooltip to use for UI selection. Post-fluent.</summary>
public readonly string Description = null;
/// <summary>
/// Only offer the Choice for these tilesets. (If null, show for all.)
/// </summary>
@@ -51,7 +54,11 @@ namespace OpenRA.Mods.Common.MapGenerator
Id = id;
var label = my.NodeWithKeyOrDefault("Label")?.Value.Value;
if (label != null)
Label = FluentProvider.GetMessage(label);
{
Label = FluentProvider.GetMessage($"{label}.label");
FluentProvider.TryGetMessage($"{label}.description", out Description);
}
Tileset = my.NodeWithKeyOrDefault("Tileset")?.Value.Value
?.Split(',')
.ToImmutableHashSet();
@@ -63,6 +70,7 @@ namespace OpenRA.Mods.Common.MapGenerator
{
Id = value;
Label = value;
Description = null;
Tileset = null;
Settings = new MiniYaml(null, new[] { new MiniYamlNode(setting, value) });
}
@@ -71,7 +79,13 @@ namespace OpenRA.Mods.Common.MapGenerator
{
var label = my.NodeWithKeyOrDefault("Label")?.Value.Value;
if (label != null)
references.Add(label);
{
references.Add($"{label}.label");
// Descriptions are optional.
if (FluentProvider.TryGetMessage($"{label}.description", out _))
references.Add($"{label}.description");
}
}
/// <summary>Check whether this choice is permitted for this map.</summary>