ProductionTabsWidget: allow specifying different panels for left/right scroll button and tab buttons.

This commit is contained in:
michaeldgg2
2023-01-25 11:42:25 +01:00
committed by Gustas
parent 38e52c062e
commit ca7e7c2304
4 changed files with 52 additions and 5 deletions

View File

@@ -81,7 +81,9 @@ namespace OpenRA.Mods.Common.Widgets
public readonly Dictionary<string, ProductionTabGroup> Groups;
public string Button = "button";
public string ArrowButton = "button";
public string TabButton = "button";
public string Background = "panel-black";
public readonly string Decorations = "scrollpanel-decorations";
public readonly string DecorationScrollLeft = "left";
@@ -190,8 +192,8 @@ namespace OpenRA.Mods.Common.Widgets
var rightHover = Ui.MouseOverWidget == this && rightButtonRect.Contains(Viewport.LastMousePos);
WidgetUtils.DrawPanel(Background, rb);
ButtonWidget.DrawBackground(Button, leftButtonRect, leftDisabled, leftPressed, leftHover, false);
ButtonWidget.DrawBackground(Button, rightButtonRect, rightDisabled, rightPressed, rightHover, false);
ButtonWidget.DrawBackground(ArrowButton, leftButtonRect, leftDisabled, leftPressed, leftHover, false);
ButtonWidget.DrawBackground(ArrowButton, rightButtonRect, rightDisabled, rightPressed, rightHover, false);
var leftArrowImage = getLeftArrowImage.Update((leftDisabled, leftPressed, leftHover, false, false));
WidgetUtils.DrawSprite(leftArrowImage,
@@ -211,7 +213,7 @@ namespace OpenRA.Mods.Common.Widgets
var rect = new Rectangle(origin.X + contentWidth, origin.Y, TabWidth, rb.Height);
var hover = !leftHover && !rightHover && Ui.MouseOverWidget == this && rect.Contains(Viewport.LastMousePos);
var highlighted = tab.Queue == CurrentQueue;
ButtonWidget.DrawBackground(Button, rect, false, false, hover, highlighted);
ButtonWidget.DrawBackground(TabButton, rect, false, false, hover, highlighted);
contentWidth += TabWidth - 1;
var textSize = font.Measure(tab.Name);