Fix CA1305
This commit is contained in:
committed by
Matthias Mailänder
parent
486a07602b
commit
d83e579dfe
@@ -11,6 +11,7 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using OpenRA.Traits;
|
||||
|
||||
@@ -61,11 +62,11 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
IEnumerable<LobbyOption> ILobbyOptions.LobbyOptions(MapPreview map)
|
||||
{
|
||||
var startingCash = SelectableCash.ToDictionary(c => c.ToString(), c => "$" + c.ToString());
|
||||
var startingCash = SelectableCash.ToDictionary(c => c.ToStringInvariant(), c => "$" + c.ToString(NumberFormatInfo.CurrentInfo));
|
||||
|
||||
if (startingCash.Count > 0)
|
||||
yield return new LobbyOption(map, "startingcash", DefaultCashDropdownLabel, DefaultCashDropdownDescription, DefaultCashDropdownVisible, DefaultCashDropdownDisplayOrder,
|
||||
startingCash, DefaultCash.ToString(), DefaultCashDropdownLocked);
|
||||
startingCash, DefaultCash.ToStringInvariant(), DefaultCashDropdownLocked);
|
||||
}
|
||||
|
||||
public override object Create(ActorInitializer init) { return new PlayerResources(init.Self, this); }
|
||||
@@ -82,7 +83,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
owner = self.Owner;
|
||||
|
||||
var startingCash = self.World.LobbyInfo.GlobalSettings
|
||||
.OptionOrDefault("startingcash", info.DefaultCash.ToString());
|
||||
.OptionOrDefault("startingcash", info.DefaultCash.ToStringInvariant());
|
||||
|
||||
if (!int.TryParse(startingCash, out Cash))
|
||||
Cash = info.DefaultCash;
|
||||
|
||||
@@ -123,7 +123,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
if (cg.Count > 0)
|
||||
{
|
||||
var actorIds = cg.Select(a => a.ActorID).ToArray();
|
||||
groups.Add(new MiniYamlNode(i.ToString(), FieldSaver.FormatValue(actorIds)));
|
||||
groups.Add(new MiniYamlNode(i.ToStringInvariant(), FieldSaver.FormatValue(actorIds)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -142,7 +142,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
{
|
||||
var group = FieldLoader.GetValue<uint[]>(n.Key, n.Value.Value)
|
||||
.Select(a => self.World.GetActorById(a)).Where(a => a != null);
|
||||
controlGroups[int.Parse(n.Key)].AddRange(group);
|
||||
controlGroups[Exts.ParseInt32Invariant(n.Key)].AddRange(group);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -201,7 +201,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
foreach (var kv in mp)
|
||||
{
|
||||
var name = kv.Key;
|
||||
var index = int.Parse(name[5..]);
|
||||
var index = Exts.ParseInt32Invariant(name[5..]);
|
||||
|
||||
if (index >= newCount)
|
||||
{
|
||||
@@ -303,12 +303,12 @@ namespace OpenRA.Mods.Common.Traits
|
||||
string NextActorName()
|
||||
{
|
||||
var id = previews.Count;
|
||||
var possibleName = "Actor" + id.ToString();
|
||||
var possibleName = "Actor" + id.ToStringInvariant();
|
||||
|
||||
while (previews.Any(p => p.ID == possibleName))
|
||||
{
|
||||
id++;
|
||||
possibleName = "Actor" + id.ToString();
|
||||
possibleName = "Actor" + id.ToStringInvariant();
|
||||
}
|
||||
|
||||
return possibleName;
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#endregion
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using OpenRA.Graphics;
|
||||
using OpenRA.Mods.Common.Commands;
|
||||
@@ -133,7 +134,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
(cost.Destination.X + nodeCell.X) / 2,
|
||||
(cost.Destination.Y + nodeCell.Y) / 2);
|
||||
var centerPos = self.World.Map.CenterOfSubCell(centerCell, SubCell.FullCell);
|
||||
yield return new TextAnnotationRenderable(font, centerPos, 0, lineColor, cost.Cost.ToString());
|
||||
yield return new TextAnnotationRenderable(font, centerPos, 0, lineColor, cost.Cost.ToString(NumberFormatInfo.CurrentInfo));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -84,7 +84,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
IEnumerable<LobbyOption> ILobbyOptions.LobbyOptions(MapPreview map)
|
||||
{
|
||||
var timelimits = TimeLimitOptions.ToDictionary(m => m.ToString(), m =>
|
||||
var timelimits = TimeLimitOptions.ToDictionary(m => m.ToStringInvariant(), m =>
|
||||
{
|
||||
if (m == 0)
|
||||
return TranslationProvider.GetString(NoTimeLimit);
|
||||
@@ -93,7 +93,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
});
|
||||
|
||||
yield return new LobbyOption(map, "timelimit", TimeLimitLabel, TimeLimitDescription, TimeLimitDropdownVisible, TimeLimitDisplayOrder,
|
||||
timelimits, TimeLimitDefault.ToString(), TimeLimitLocked);
|
||||
timelimits, TimeLimitDefault.ToStringInvariant(), TimeLimitLocked);
|
||||
}
|
||||
|
||||
public override object Create(ActorInitializer init) { return new TimeLimitManager(init.Self, this); }
|
||||
@@ -119,7 +119,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
Notification = info.Notification;
|
||||
ticksPerSecond = 1000 / self.World.Timestep;
|
||||
|
||||
var tl = self.World.LobbyInfo.GlobalSettings.OptionOrDefault("timelimit", info.TimeLimitDefault.ToString());
|
||||
var tl = self.World.LobbyInfo.GlobalSettings.OptionOrDefault("timelimit", info.TimeLimitDefault.ToStringInvariant());
|
||||
if (!int.TryParse(tl, out TimeLimit))
|
||||
TimeLimit = info.TimeLimitDefault;
|
||||
|
||||
@@ -136,7 +136,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
if (countdownLabel != null)
|
||||
{
|
||||
countdown = new CachedTransform<int, string>(t =>
|
||||
string.Format(info.CountdownText, WidgetUtils.FormatTime(t, w.Timestep)));
|
||||
info.CountdownText.FormatCurrent(WidgetUtils.FormatTime(t, w.Timestep)));
|
||||
countdownLabel.GetText = () => TimeLimit > 0 ? countdown.Update(ticksRemaining) : "";
|
||||
}
|
||||
}
|
||||
@@ -167,7 +167,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
{
|
||||
if (ticksRemaining == m * 60 * ticksPerSecond)
|
||||
{
|
||||
TextNotificationsManager.AddSystemLine(string.Format(Notification, m, m > 1 ? "s" : null));
|
||||
TextNotificationsManager.AddSystemLine(Notification.FormatCurrent(m, m > 1 ? "s" : null));
|
||||
|
||||
var faction = self.World.LocalPlayer?.Faction.InternalName;
|
||||
Game.Sound.PlayNotification(self.World.Map.Rules, self.World.LocalPlayer, "Speech", info.TimeLimitWarnings[m], faction);
|
||||
|
||||
Reference in New Issue
Block a user