Move hardcoded support power keys into yaml.

This commit is contained in:
Paul Chote
2017-09-01 22:50:13 +01:00
committed by reaperrr
parent 4f00d62237
commit 2a6bb0678e
7 changed files with 58 additions and 32 deletions

View File

@@ -57,13 +57,19 @@ namespace OpenRA.Mods.Common.Widgets.Logic
name = sp.Info.Description;
desc = sp.Info.LongDesc.Replace("\\n", "\n");
var hotkey = icon.Hotkey;
var hotkeyText = "({0})".F(hotkey.DisplayString());
var hotkeyWidth = hotkey.IsValid() ? nameFont.Measure(hotkeyText).X + 2 * nameLabel.Bounds.X : 0;
hotkeyLabel.GetText = () => hotkeyText;
hotkeyLabel.Bounds.X = nameFont.Measure(name).X + 2 * nameLabel.Bounds.X;
var hotkeyWidth = 0;
var hotkey = icon.Hotkey != null ? icon.Hotkey.GetValue() : Hotkey.Invalid;
hotkeyLabel.Visible = hotkey.IsValid();
if (hotkeyLabel.Visible)
{
var hotkeyText = "({0})".F(hotkey.DisplayString());
hotkeyWidth = nameFont.Measure(hotkeyText).X + 2 * nameLabel.Bounds.X;
hotkeyLabel.Text = hotkeyText;
hotkeyLabel.Bounds.X = nameFont.Measure(name).X + 2 * nameLabel.Bounds.X;
}
var timeWidth = timeFont.Measure(time).X;
var topWidth = nameFont.Measure(name).X + hotkeyWidth + timeWidth + timeOffset;
var descSize = descFont.Measure(desc);