Fix CA1851, assume_method_enumerates_parameters = true
This commit is contained in:
@@ -57,7 +57,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
.SelectMany(t => t.Value.RestrictedPlayerColors)
|
||||
.Distinct()
|
||||
.ToList();
|
||||
var playerColors = Enumerable.Empty<Color>();
|
||||
var playerColors = Array.Empty<Color>();
|
||||
randomButton.OnClick = () =>
|
||||
{
|
||||
var randomColor = colorManager.RandomValidColor(world.LocalRandom, terrainColors, playerColors);
|
||||
@@ -140,7 +140,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
var colorIndex = j * paletteCols + i;
|
||||
|
||||
var newSwatch = (ColorBlockWidget)customColorTemplate.Clone();
|
||||
var getColor = new CachedTransform<Color, Color>(c => colorManager.MakeValid(c, world.LocalRandom, Enumerable.Empty<Color>(), Enumerable.Empty<Color>()));
|
||||
var getColor = new CachedTransform<Color, Color>(c => colorManager.MakeValid(c, world.LocalRandom, Array.Empty<Color>(), Array.Empty<Color>()));
|
||||
|
||||
newSwatch.GetColor = () => getColor.Update(Game.Settings.Player.CustomColors[colorIndex]);
|
||||
newSwatch.IsVisible = () => Game.Settings.Player.CustomColors.Length > colorIndex;
|
||||
|
||||
@@ -79,7 +79,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
};
|
||||
}
|
||||
|
||||
IEnumerable<KeyValuePair<ActorInfo, EncyclopediaInfo>> GetFilteredActorEncyclopediaPairs()
|
||||
IReadOnlyCollection<KeyValuePair<ActorInfo, EncyclopediaInfo>> GetFilteredActorEncyclopediaPairs()
|
||||
{
|
||||
var actors = new List<KeyValuePair<ActorInfo, EncyclopediaInfo>>();
|
||||
foreach (var actor in modData.DefaultRules.Actors.Values)
|
||||
@@ -149,9 +149,11 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
var buildable = actor.TraitInfoOrDefault<BuildableInfo>();
|
||||
if (buildable != null)
|
||||
{
|
||||
var prerequisites = buildable.Prerequisites.Select(a => ActorName(modData.DefaultRules, a))
|
||||
.Where(s => !s.StartsWith('~') && !s.StartsWith('!'));
|
||||
if (prerequisites.Any())
|
||||
var prerequisites = buildable.Prerequisites
|
||||
.Select(a => ActorName(modData.DefaultRules, a))
|
||||
.Where(s => !s.StartsWith('~') && !s.StartsWith('!'))
|
||||
.ToList();
|
||||
if (prerequisites.Count != 0)
|
||||
text += $"Requires {prerequisites.JoinWith(", ")}\n\n";
|
||||
}
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic.Ingame
|
||||
var newSelection = SelectionUtils.SelectActorsOnScreen(world, worldRenderer, null, eligiblePlayers).SubsetWithHighestSelectionPriority(e.Modifiers).ToList();
|
||||
|
||||
// Check if selecting actors on the screen has selected new units
|
||||
if (newSelection.Count > selection.Actors.Count())
|
||||
if (newSelection.Count > selection.Actors.Count)
|
||||
TextNotificationsManager.AddFeedbackLine(SelectedUnitsAcrossScreen, Translation.Arguments("units", newSelection.Count));
|
||||
else
|
||||
{
|
||||
|
||||
@@ -52,7 +52,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic.Ingame
|
||||
if (world.IsGameOver)
|
||||
return false;
|
||||
|
||||
if (!selection.Actors.Any())
|
||||
if (selection.Actors.Count == 0)
|
||||
{
|
||||
TextNotificationsManager.AddFeedbackLine(NothingSelected);
|
||||
Game.Sound.PlayNotification(world.Map.Rules, world.LocalPlayer, "Sounds", ClickDisabledSound, null);
|
||||
@@ -78,7 +78,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic.Ingame
|
||||
var newSelection = SelectionUtils.SelectActorsOnScreen(world, worldRenderer, selectedClasses, eligiblePlayers).ToList();
|
||||
|
||||
// Check if selecting actors on the screen has selected new units
|
||||
if (newSelection.Count > selection.Actors.Count())
|
||||
if (newSelection.Count > selection.Actors.Count)
|
||||
TextNotificationsManager.AddFeedbackLine(SelectedUnitsAcrossScreen, Translation.Arguments("units", newSelection.Count));
|
||||
else
|
||||
{
|
||||
|
||||
@@ -112,9 +112,9 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
requiredWidget.IsVisible = () => p.Value.Required;
|
||||
|
||||
var sourceWidget = container.Get<ImageWidget>("SOURCE");
|
||||
var sourceTitles = p.Value.Sources.Select(s => sources[s].Title).Distinct();
|
||||
var sourceTitles = p.Value.Sources.Select(s => sources[s].Title).Distinct().ToList();
|
||||
var sourceList = sourceTitles.JoinWith("\n");
|
||||
var isSourceAvailable = sourceTitles.Any();
|
||||
var isSourceAvailable = sourceTitles.Count != 0;
|
||||
sourceWidget.GetTooltipText = () => sourceList;
|
||||
sourceWidget.IsVisible = () => isSourceAvailable;
|
||||
|
||||
|
||||
@@ -136,9 +136,10 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
})
|
||||
.Where(x => x.Index != -1)
|
||||
.OrderBy(x => x.Index)
|
||||
.Select(x => x.Preview);
|
||||
.Select(x => x.Preview)
|
||||
.ToList();
|
||||
|
||||
if (previews.Any())
|
||||
if (previews.Count != 0)
|
||||
{
|
||||
CreateMissionGroup(kv.Key, previews, onExit);
|
||||
allPreviews.AddRange(previews);
|
||||
@@ -148,9 +149,12 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
|
||||
// Add an additional group for loose missions
|
||||
var loosePreviews = modData.MapCache
|
||||
.Where(p => p.Status == MapStatus.Available && p.Visibility.HasFlag(MapVisibility.MissionSelector) && !allPreviews.Any(a => a.Uid == p.Uid));
|
||||
.Where(p => p.Status == MapStatus.Available &&
|
||||
p.Visibility.HasFlag(MapVisibility.MissionSelector) &&
|
||||
!allPreviews.Any(a => a.Uid == p.Uid))
|
||||
.ToList();
|
||||
|
||||
if (loosePreviews.Any())
|
||||
if (loosePreviews.Count != 0)
|
||||
{
|
||||
CreateMissionGroup("Missions", loosePreviews, onExit);
|
||||
allPreviews.AddRange(loosePreviews);
|
||||
|
||||
@@ -443,7 +443,7 @@ namespace OpenRA.Mods.Common.Widgets
|
||||
if (facility == null || facility.OccupiesSpace == null)
|
||||
return true;
|
||||
|
||||
if (selection.Actors.Count() == 1 && selection.Contains(facility))
|
||||
if (selection.Actors.Count == 1 && selection.Contains(facility))
|
||||
viewport.Center(selection.Actors);
|
||||
else
|
||||
selection.Combine(World, new[] { facility }, false, true);
|
||||
|
||||
@@ -109,7 +109,7 @@ namespace OpenRA.Mods.Common.Widgets
|
||||
{
|
||||
if (useClassicMouseStyle && HasMouseFocus)
|
||||
{
|
||||
if (!IsValidDragbox && World.Selection.Actors.Any() && !multiClick && uog.InputOverridesSelection(World, mousePos, mi))
|
||||
if (!IsValidDragbox && World.Selection.Actors.Count != 0 && !multiClick && uog.InputOverridesSelection(World, mousePos, mi))
|
||||
{
|
||||
// Order units instead of selecting
|
||||
ApplyOrders(World, mi);
|
||||
|
||||
Reference in New Issue
Block a user