make maximum and minimum rows configurable
This commit is contained in:
@@ -56,6 +56,9 @@ namespace OpenRA.Mods.Common.Widgets
|
||||
public readonly World World;
|
||||
readonly OrderManager orderManager;
|
||||
|
||||
public int MinimumRows = 4;
|
||||
public int MaximumRows = int.MaxValue;
|
||||
|
||||
public int IconRowOffset = 0;
|
||||
public int MaxIconRowOffset = int.MaxValue;
|
||||
|
||||
|
||||
@@ -88,8 +88,8 @@ namespace OpenRA.Mods.RA.Widgets.Logic
|
||||
|
||||
Action<int, int> updateBackground = (_, icons) =>
|
||||
{
|
||||
// Minimum of four rows to make space for the production buttons.
|
||||
var rows = Math.Max(4, (icons + palette.Columns - 1) / palette.Columns);
|
||||
var rows = Math.Max(palette.MinimumRows, (icons + palette.Columns - 1) / palette.Columns);
|
||||
rows = Math.Min(rows, palette.MaximumRows);
|
||||
|
||||
if (background != null)
|
||||
{
|
||||
@@ -189,7 +189,8 @@ namespace OpenRA.Mods.RA.Widgets.Logic
|
||||
// Check if icon heights exceed y resolution
|
||||
var maxItemsHeight = screenHeight - sidebarProductionHeight;
|
||||
|
||||
productionPalette.MaxIconRowOffset = (maxItemsHeight / productionPalette.IconSize.Y) - 1;
|
||||
var maxIconRowOffest = (maxItemsHeight / productionPalette.IconSize.Y) - 1;
|
||||
productionPalette.MaxIconRowOffset = Math.Min(maxIconRowOffest, productionPalette.MaximumRows);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -233,6 +233,8 @@ Container@PLAYER_WIDGETS:
|
||||
IconSize: 58, 48
|
||||
IconMargin: 2, 0
|
||||
IconSpriteOffset: 0, 0
|
||||
MinimumRows: 4
|
||||
MaximumRows: 6
|
||||
Container@PALETTE_FOREGROUND:
|
||||
X: 64
|
||||
Y: 0
|
||||
|
||||
Reference in New Issue
Block a user