Fix IDE0048

This commit is contained in:
RoosterDragon
2023-02-28 19:27:42 +00:00
committed by Pavel Penev
parent 65e28d5562
commit 8ee6957e6a
23 changed files with 46 additions and 37 deletions

View File

@@ -185,7 +185,7 @@ namespace OpenRA.Mods.Common.Widgets
var xAxisText = GetXAxisValueFormat().F(n / XAxisTicksPerLabel);
var xAxisTickTextWidth = labelFont.Measure(xAxisText).X;
var xLocation = x - (xAxisTickTextWidth / 2);
var xLocation = x - xAxisTickTextWidth / 2;
labelFont.DrawTextWithShadow(xAxisText, graphOrigin + new float2(xLocation, 2), Color.White, BackgroundColorDark, BackgroundColorLight, 1);
}

View File

@@ -58,8 +58,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic
layerPreview.ResourceType = resourceType;
layerPreview.Bounds.Width = size.Width;
layerPreview.Bounds.Height = size.Height;
newResourcePreviewTemplate.Bounds.Width = size.Width + (layerPreview.Bounds.X * 2);
newResourcePreviewTemplate.Bounds.Height = size.Height + (layerPreview.Bounds.Y * 2);
newResourcePreviewTemplate.Bounds.Width = size.Width + layerPreview.Bounds.X * 2;
newResourcePreviewTemplate.Bounds.Height = size.Height + layerPreview.Bounds.Y * 2;
newResourcePreviewTemplate.IsVisible = () => true;
newResourcePreviewTemplate.GetTooltipText = () => resourceType;

View File

@@ -148,7 +148,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
if (scrollDown != null)
{
scrollDown.OnClick = palette.ScrollDown;
scrollDown.IsVisible = () => palette.TotalIconCount > (palette.MaxIconRowOffset * palette.Columns);
scrollDown.IsVisible = () => palette.TotalIconCount > palette.MaxIconRowOffset * palette.Columns;
scrollDown.IsDisabled = () => !palette.CanScrollDown;
}
@@ -157,7 +157,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
if (scrollUp != null)
{
scrollUp.OnClick = palette.ScrollUp;
scrollUp.IsVisible = () => palette.TotalIconCount > (palette.MaxIconRowOffset * palette.Columns);
scrollUp.IsVisible = () => palette.TotalIconCount > palette.MaxIconRowOffset * palette.Columns;
scrollUp.IsDisabled = () => !palette.CanScrollUp;
}
@@ -179,7 +179,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
// Check if icon heights exceed y resolution
var maxItemsHeight = screenHeight - sidebarProductionHeight;
var maxIconRowOffest = (maxItemsHeight / productionPalette.IconSize.Y) - 1;
var maxIconRowOffest = maxItemsHeight / productionPalette.IconSize.Y - 1;
productionPalette.MaxIconRowOffset = Math.Min(maxIconRowOffest, productionPalette.MaximumRows);
}
}

View File

@@ -116,7 +116,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
{
var power = actor.TraitInfos<PowerInfo>().Where(i => i.EnabledByDefault).Sum(i => i.Amount);
powerLabel.Text = power.ToString();
powerLabel.GetColor = () => ((pm.PowerProvided - pm.PowerDrained) >= -power || power > 0)
powerLabel.GetColor = () => (pm.PowerProvided - pm.PowerDrained >= -power || power > 0)
? Color.White : Color.Red;
powerLabel.Visible = power != 0;
powerIcon.Visible = power != 0;

View File

@@ -843,7 +843,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
if (game.State == (int)ServerState.WaitingPlayers && !filters.HasFlag(MPGameFilters.Waiting) && game.Players != 0)
return true;
if ((game.Players + game.Spectators) == 0 && !filters.HasFlag(MPGameFilters.Empty))
if (game.Players + game.Spectators == 0 && !filters.HasFlag(MPGameFilters.Empty))
return true;
if (!game.IsCompatible && !filters.HasFlag(MPGameFilters.Incompatible))

View File

@@ -372,7 +372,7 @@ namespace OpenRA.Mods.Common.Widgets
var thumbHeight = ContentHeight == 0 ? 0 : Math.Max(MinimumThumbSize, (int)(scrollbarHeight * Math.Min(rb.Height * 1f / ContentHeight, 1f)));
var oldOffset = currentListOffset;
var newOffset = currentListOffset + ((int)((lastMouseLocation.Y - mi.Location.Y) * (ContentHeight - rb.Height) * 1f / (scrollbarHeight - thumbHeight)));
var newOffset = currentListOffset + (int)((lastMouseLocation.Y - mi.Location.Y) * (ContentHeight - rb.Height) * 1f / (scrollbarHeight - thumbHeight));
newOffset = Math.Min(0, Math.Max(rb.Height - ContentHeight, newOffset));
SetListOffset(newOffset, false);

View File

@@ -128,7 +128,7 @@ namespace OpenRA.Mods.Common.Widgets
for (var i = 0; i < Ticks; i++)
{
var tickPos = new float2(
trackOrigin + (i * (trackRect.Width - (int)tick.Size.X) / (Ticks - 1)) - tick.Size.X / 2,
trackOrigin + i * (trackRect.Width - (int)tick.Size.X) / (Ticks - 1) - tick.Size.X / 2,
trackRect.Bottom);
WidgetUtils.DrawSprite(tick, tickPos);

View File

@@ -584,7 +584,7 @@ namespace OpenRA.Mods.Common.Widgets
var highlightEndX = font.Measure(apparentText.Substring(0, visualSelectionEndIndex)).X;
WidgetUtils.FillRectWithColor(
new Rectangle(textPos.X + highlightStartX, textPos.Y, highlightEndX - highlightStartX, Bounds.Height - (verticalMargin * 2)), TextColorHighlight);
new Rectangle(textPos.X + highlightStartX, textPos.Y, highlightEndX - highlightStartX, Bounds.Height - verticalMargin * 2), TextColorHighlight);
}
var color =