diff --git a/OpenRA.Mods.Common/Widgets/Logic/Ingame/SupportPowerBinLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/Ingame/SupportPowerBinLogic.cs index af25658847..ed94438bae 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/Ingame/SupportPowerBinLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/Ingame/SupportPowerBinLogic.cs @@ -37,6 +37,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic Action updateBackground = (_, icons) => { var rowHeight = palette.IconSize.Y + palette.IconMargin; + var rowWidth = palette.IconSize.X + palette.IconMargin; if (background != null) { @@ -45,7 +46,10 @@ namespace OpenRA.Mods.Common.Widgets.Logic for (var i = 0; i < icons; i++) { var row = backgroundTemplate.Clone(); - row.Bounds.Y += i * rowHeight; + if (palette.Horizontal) + row.Bounds.X += i * rowWidth; + else + row.Bounds.Y += i * rowHeight; background.AddChild(row); } } @@ -57,7 +61,10 @@ namespace OpenRA.Mods.Common.Widgets.Logic for (var i = 0; i < icons; i++) { var row = foregroundTemplate.Clone(); - row.Bounds.Y += i * rowHeight; + if (palette.Horizontal) + row.Bounds.X += i * rowWidth; + else + row.Bounds.Y += i * rowHeight; foreground.AddChild(row); } } diff --git a/OpenRA.Mods.Common/Widgets/SupportPowersWidget.cs b/OpenRA.Mods.Common/Widgets/SupportPowersWidget.cs index 88a2d234e3..32c81feb75 100644 --- a/OpenRA.Mods.Common/Widgets/SupportPowersWidget.cs +++ b/OpenRA.Mods.Common/Widgets/SupportPowersWidget.cs @@ -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 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()