make maximum and minimum rows configurable

This commit is contained in:
Matthias Mailänder
2015-02-08 10:13:28 +01:00
parent 3be3700722
commit b0f986887c
3 changed files with 9 additions and 3 deletions

View File

@@ -56,6 +56,9 @@ namespace OpenRA.Mods.Common.Widgets
public readonly World World; public readonly World World;
readonly OrderManager orderManager; readonly OrderManager orderManager;
public int MinimumRows = 4;
public int MaximumRows = int.MaxValue;
public int IconRowOffset = 0; public int IconRowOffset = 0;
public int MaxIconRowOffset = int.MaxValue; public int MaxIconRowOffset = int.MaxValue;

View File

@@ -88,8 +88,8 @@ namespace OpenRA.Mods.RA.Widgets.Logic
Action<int, int> updateBackground = (_, icons) => Action<int, int> updateBackground = (_, icons) =>
{ {
// Minimum of four rows to make space for the production buttons. var rows = Math.Max(palette.MinimumRows, (icons + palette.Columns - 1) / palette.Columns);
var rows = Math.Max(4, (icons + palette.Columns - 1) / palette.Columns); rows = Math.Min(rows, palette.MaximumRows);
if (background != null) if (background != null)
{ {
@@ -189,7 +189,8 @@ namespace OpenRA.Mods.RA.Widgets.Logic
// Check if icon heights exceed y resolution // Check if icon heights exceed y resolution
var maxItemsHeight = screenHeight - sidebarProductionHeight; 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);
} }
} }
} }

View File

@@ -233,6 +233,8 @@ Container@PLAYER_WIDGETS:
IconSize: 58, 48 IconSize: 58, 48
IconMargin: 2, 0 IconMargin: 2, 0
IconSpriteOffset: 0, 0 IconSpriteOffset: 0, 0
MinimumRows: 4
MaximumRows: 6
Container@PALETTE_FOREGROUND: Container@PALETTE_FOREGROUND:
X: 64 X: 64
Y: 0 Y: 0