Moved production description from Tooltip to Buildable
This commit is contained in:
@@ -45,6 +45,9 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
// TODO: UI fluff; doesn't belong here
|
||||
public readonly int BuildPaletteOrder = 9999;
|
||||
|
||||
[Desc("Text shown in the production tooltip.")]
|
||||
[Translate] public readonly string Description = "";
|
||||
}
|
||||
|
||||
public class Buildable { }
|
||||
|
||||
@@ -15,7 +15,6 @@ namespace OpenRA.Mods.Common.Traits
|
||||
{
|
||||
public abstract class TooltipInfoBase : ITraitInfo
|
||||
{
|
||||
[Translate] public readonly string Description = "";
|
||||
[Translate] public readonly string Name = "";
|
||||
|
||||
public abstract object Create(ActorInitializer init);
|
||||
|
||||
@@ -397,6 +397,25 @@ namespace OpenRA.Mods.Common.UtilityCommands
|
||||
}
|
||||
}
|
||||
|
||||
// Move production description from Tooltip to Buildable
|
||||
if (engineVersion < 20161016)
|
||||
{
|
||||
var tooltipChild = node.Value.Nodes.FirstOrDefault(n => n.Key == "Tooltip");
|
||||
if (tooltipChild != null || (tooltipChild = node.Value.Nodes.FirstOrDefault(n => n.Key == "DisguiseToolTip")) != null)
|
||||
{
|
||||
var descNode = tooltipChild.Value.Nodes.FirstOrDefault(n => n.Key == "Description");
|
||||
if (descNode != null)
|
||||
{
|
||||
var buildableNode = node.Value.Nodes.FirstOrDefault(n => n.Key == "Buildable");
|
||||
if (buildableNode == null)
|
||||
node.Value.Nodes.Add(buildableNode = new MiniYamlNode("Buildable", ""));
|
||||
|
||||
buildableNode.Value.Nodes.Add(descNode);
|
||||
tooltipChild.Value.Nodes.Remove(descNode);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
UpgradeActorRules(modData, engineVersion, ref node.Value.Nodes, node, depth + 1);
|
||||
}
|
||||
|
||||
|
||||
@@ -93,7 +93,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
costLabel.GetColor = () => pr.Cash + pr.Resources >= cost
|
||||
? Color.White : Color.Red;
|
||||
|
||||
var descString = tooltip.Description.Replace("\\n", "\n");
|
||||
var descString = buildable.Description.Replace("\\n", "\n");
|
||||
descLabel.GetText = () => descString;
|
||||
|
||||
var leftWidth = new[] { nameWidth + hotkeyWidth, requiresFont.Measure(requiresString).X, descFont.Measure(descString).X }.Aggregate(Math.Max);
|
||||
|
||||
Reference in New Issue
Block a user