Deprecate string format shorthand.
This commit is contained in:
committed by
abcdefg30
parent
1c2ce0dcc0
commit
65c0cf1065
@@ -124,7 +124,7 @@ namespace OpenRA.Mods.Common.Widgets
|
||||
|
||||
var scale = 200 / Math.Max(5000, (float)Math.Ceiling(maxValue / 1000) * 1000);
|
||||
|
||||
var widthMaxValue = labelFont.Measure(GetYAxisValueFormat().F(height / scale)).X;
|
||||
var widthMaxValue = labelFont.Measure(string.Format(GetYAxisValueFormat(), height / scale)).X;
|
||||
var widthLongestName = labelFont.Measure(longestName).X;
|
||||
|
||||
// y axis label
|
||||
@@ -164,7 +164,7 @@ namespace OpenRA.Mods.Common.Widgets
|
||||
}), 1, color);
|
||||
|
||||
if (lastPoint != 0f)
|
||||
labelFont.DrawTextWithShadow(GetValueFormat().F(lastPoint), graphOrigin + new float2(lastX * xStep, -lastPoint * scale - 2),
|
||||
labelFont.DrawTextWithShadow(string.Format(GetValueFormat(), lastPoint), graphOrigin + new float2(lastX * xStep, -lastPoint * scale - 2),
|
||||
color, BackgroundColorDark, BackgroundColorLight, 1);
|
||||
}
|
||||
|
||||
@@ -185,7 +185,7 @@ namespace OpenRA.Mods.Common.Widgets
|
||||
if (n % XAxisTicksPerLabel != 0)
|
||||
continue;
|
||||
|
||||
var xAxisText = GetXAxisValueFormat().F(n / XAxisTicksPerLabel);
|
||||
var xAxisText = string.Format(GetXAxisValueFormat(), n / XAxisTicksPerLabel);
|
||||
var xAxisTickTextWidth = labelFont.Measure(xAxisText).X;
|
||||
var xLocation = x - xAxisTickTextWidth / 2;
|
||||
labelFont.DrawTextWithShadow(xAxisText,
|
||||
@@ -202,7 +202,7 @@ namespace OpenRA.Mods.Common.Widgets
|
||||
{
|
||||
var yValue = y / scale;
|
||||
cr.DrawLine(graphOrigin + new float2(0, -y), graphOrigin + new float2(5, -y), 1, Color.White);
|
||||
var text = GetYAxisValueFormat().F(yValue);
|
||||
var text = string.Format(GetYAxisValueFormat(), yValue);
|
||||
|
||||
var textWidth = labelFont.Measure(text);
|
||||
|
||||
|
||||
@@ -80,7 +80,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
}
|
||||
|
||||
siloUsageTooltip = siloUsageTooltipCache.Update((playerResources.Resources, playerResources.ResourceCapacity));
|
||||
cashLabel.Text = cashTemplate.F(displayResources);
|
||||
cashLabel.Text = string.Format(cashTemplate, displayResources);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -100,7 +100,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
var requiresSize = int2.Zero;
|
||||
if (prereqs.Any())
|
||||
{
|
||||
requiresLabel.Text = requiresFormat.F(prereqs.JoinWith(", "));
|
||||
requiresLabel.Text = string.Format(requiresFormat, prereqs.JoinWith(", "));
|
||||
requiresSize = requiresFont.Measure(requiresLabel.Text);
|
||||
requiresLabel.Visible = true;
|
||||
descLabel.Bounds.Y = descLabelY + requiresLabel.Bounds.Height;
|
||||
|
||||
@@ -425,7 +425,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
titleLabel.GetText = () => item.Title;
|
||||
|
||||
var authorDateTimeLabel = newsItem.Get<LabelWidget>("AUTHOR_DATETIME");
|
||||
var authorDateTime = authorDateTimeLabel.Text.F(item.Author, item.DateTime.ToLocalTime());
|
||||
var authorDateTime = string.Format(authorDateTimeLabel.Text, item.Author, item.DateTime.ToLocalTime());
|
||||
authorDateTimeLabel.GetText = () => authorDateTime;
|
||||
|
||||
var contentLabel = newsItem.Get<LabelWidget>("CONTENT");
|
||||
|
||||
@@ -220,14 +220,14 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
duplicateNotice.IsVisible = () => !isHotkeyValid;
|
||||
var duplicateNoticeText = new CachedTransform<HotkeyDefinition, string>(hd =>
|
||||
hd != null ?
|
||||
duplicateNotice.Text.F(hd.Description, hd.Contexts.First(c => selectedHotkeyDefinition.Contexts.Contains(c))) :
|
||||
string.Format(duplicateNotice.Text, hd.Description, hd.Contexts.First(c => selectedHotkeyDefinition.Contexts.Contains(c))) :
|
||||
"");
|
||||
duplicateNotice.GetText = () => duplicateNoticeText.Update(duplicateHotkeyDefinition);
|
||||
|
||||
var originalNotice = panel.Get<LabelWidget>("ORIGINAL_NOTICE");
|
||||
originalNotice.TextColor = ChromeMetrics.Get<Color>("NoticeInfoColor");
|
||||
originalNotice.IsVisible = () => isHotkeyValid && !isHotkeyDefault;
|
||||
var originalNoticeText = new CachedTransform<HotkeyDefinition, string>(hd => originalNotice.Text.F(hd?.Default.DisplayString()));
|
||||
var originalNoticeText = new CachedTransform<HotkeyDefinition, string>(hd => string.Format(originalNotice.Text, hd?.Default.DisplayString()));
|
||||
originalNotice.GetText = () => originalNoticeText.Update(selectedHotkeyDefinition);
|
||||
|
||||
var readonlyNotice = panel.Get<LabelWidget>("READONLY_NOTICE");
|
||||
|
||||
@@ -57,7 +57,7 @@ namespace OpenRA.Mods.Common.Widgets
|
||||
{
|
||||
var self = p.Instances[0].Self;
|
||||
var time = WidgetUtils.FormatTime(p.RemainingTicks, false, self.World.Timestep);
|
||||
var text = Format.F(self.Owner.PlayerName, p.Info.Name, time);
|
||||
var text = string.Format(Format, self.Owner.PlayerName, p.Info.Name, time);
|
||||
var playerColor = self.Owner.Color;
|
||||
|
||||
if (Game.Settings.Game.UsePlayerStanceColors)
|
||||
|
||||
Reference in New Issue
Block a user