Implemented horizontal allign support for SupportPowersWidget

This commit is contained in:
Unknown
2018-08-04 16:53:26 +02:00
committed by reaperrr
parent e179a9529e
commit c97f36793c
2 changed files with 17 additions and 3 deletions

View File

@@ -40,6 +40,8 @@ namespace OpenRA.Mods.Common.Widgets
public readonly string ClockSequence = "idle";
public readonly string ClockPalette = "chrome";
public readonly bool Horizontal = false;
public int IconCount { get; private set; }
public event Action<int, int> OnIconCountChanged = (a, b) => { };
@@ -124,7 +126,12 @@ namespace OpenRA.Mods.Common.Widgets
var rb = RenderBounds;
foreach (var p in powers)
{
var rect = new Rectangle(rb.X, rb.Y + IconCount * (IconSize.Y + IconMargin), IconSize.X, IconSize.Y);
Rectangle rect;
if (Horizontal)
rect = new Rectangle(rb.X + IconCount * (IconSize.X + IconMargin), rb.Y, IconSize.X, IconSize.Y);
else
rect = new Rectangle(rb.X, rb.Y + IconCount * (IconSize.Y + IconMargin), IconSize.X, IconSize.Y);
icon.Play(p.Info.Icon);
var power = new SupportPowerIcon()