Fix CA1851
This commit is contained in:
@@ -84,7 +84,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
var actors = new List<KeyValuePair<ActorInfo, EncyclopediaInfo>>();
|
||||
foreach (var actor in modData.DefaultRules.Actors.Values)
|
||||
{
|
||||
if (!actor.TraitInfos<IRenderActorPreviewSpritesInfo>().Any())
|
||||
if (actor.TraitInfos<IRenderActorPreviewSpritesInfo>().Count == 0)
|
||||
continue;
|
||||
|
||||
var statistics = actor.TraitInfoOrDefault<UpdatesPlayerStatisticsInfo>();
|
||||
|
||||
@@ -113,7 +113,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
.Select(p => (Player: p, PlayerStatistics: p.PlayerActor.TraitOrDefault<PlayerStatistics>()))
|
||||
.OrderByDescending(p => p.PlayerStatistics?.Experience ?? 0)
|
||||
.GroupBy(p => (world.LobbyInfo.ClientWithIndex(p.Player.ClientIndex) ?? new Session.Client()).Team)
|
||||
.OrderByDescending(g => g.Sum(gg => gg.PlayerStatistics?.Experience ?? 0));
|
||||
.OrderByDescending(g => g.Sum(gg => gg.PlayerStatistics?.Experience ?? 0))
|
||||
.ToList();
|
||||
|
||||
void KickAction(Session.Client client)
|
||||
{
|
||||
@@ -133,7 +134,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
|
||||
foreach (var t in teams)
|
||||
{
|
||||
if (teams.Count() > 1)
|
||||
if (teams.Count > 1)
|
||||
{
|
||||
var teamHeader = ScrollItemWidget.Setup(teamTemplate, () => false, () => { });
|
||||
var team = t.Key > 0
|
||||
|
||||
@@ -114,9 +114,10 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
.GroupBy(p => (world.LobbyInfo.ClientWithIndex(p.Player.ClientIndex) ?? new Session.Client()).Team)
|
||||
.OrderBy(g => g.Key);
|
||||
|
||||
var noTeams = teams.Count() == 1;
|
||||
var teamsList = teams.ToList();
|
||||
var noTeams = teamsList.Count == 1;
|
||||
var totalPlayers = 0;
|
||||
foreach (var t in teams)
|
||||
foreach (var t in teamsList)
|
||||
{
|
||||
totalPlayers += t.Count();
|
||||
var label = noTeams ? TranslationProvider.GetString(Players) : t.Key > 0
|
||||
@@ -209,12 +210,12 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
if (e.Key >= Keycode.NUMBER_0 && e.Key <= Keycode.NUMBER_9)
|
||||
{
|
||||
var key = (int)e.Key - (int)Keycode.NUMBER_0;
|
||||
var team = teams.Where(t => t.Key == key).SelectMany(s => s);
|
||||
if (!team.Any())
|
||||
var team = teams.Where(t => t.Key == key).SelectMany(s => s).ToList();
|
||||
if (team.Count == 0)
|
||||
return false;
|
||||
|
||||
if (e.Modifiers == Modifiers.Shift)
|
||||
team = team.Reverse();
|
||||
team.Reverse();
|
||||
|
||||
selected = team.SkipWhile(t => t.Player != selected.Player).Skip(1).FirstOrDefault() ?? team.FirstOrDefault();
|
||||
selected.OnClick();
|
||||
|
||||
@@ -183,7 +183,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
selectedPackages = availablePackages.ToDictionary(x => x.Identifier, y => y.Required);
|
||||
|
||||
// Ignore source if content is already installed
|
||||
if (availablePackages.Any())
|
||||
if (availablePackages.Length != 0)
|
||||
{
|
||||
Game.RunAfterTick(() =>
|
||||
{
|
||||
@@ -218,10 +218,10 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
|
||||
var options = new Dictionary<string, IEnumerable<string>>();
|
||||
|
||||
if (gameSources.Any())
|
||||
if (gameSources.Count != 0)
|
||||
options.Add(TranslationProvider.GetString(GameSources), gameSources);
|
||||
|
||||
if (digitalInstalls.Any())
|
||||
if (digitalInstalls.Count != 0)
|
||||
options.Add(TranslationProvider.GetString(DigitalInstalls), digitalInstalls);
|
||||
|
||||
Game.RunAfterTick(() =>
|
||||
|
||||
@@ -322,18 +322,19 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
if (!int.TryParse(mapFilter, out var playerCountFilter))
|
||||
playerCountFilter = -1;
|
||||
|
||||
var validMaps = tabMaps[tab]
|
||||
var maps = tabMaps[tab]
|
||||
.Where(m => category == null || m.Categories.Contains(category))
|
||||
.Where(m => mapFilter == null ||
|
||||
(m.Title != null && m.Title.Contains(mapFilter, StringComparison.CurrentCultureIgnoreCase)) ||
|
||||
(m.Author != null && m.Author.Contains(mapFilter, StringComparison.CurrentCultureIgnoreCase)) ||
|
||||
m.PlayerCount == playerCountFilter);
|
||||
|
||||
IOrderedEnumerable<MapPreview> maps;
|
||||
if (orderByFunc == null)
|
||||
maps = validMaps.OrderBy(m => m.Title);
|
||||
maps = maps.OrderBy(m => m.Title);
|
||||
else
|
||||
maps = validMaps.OrderBy(orderByFunc).ThenBy(m => m.Title);
|
||||
maps = maps.OrderBy(orderByFunc).ThenBy(m => m.Title);
|
||||
|
||||
maps = maps.ToList();
|
||||
|
||||
scrollpanels[tab].RemoveChildren();
|
||||
foreach (var loop in maps)
|
||||
|
||||
@@ -715,10 +715,11 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
|
||||
var players = replay.GameInfo.Players
|
||||
.GroupBy(p => p.Team)
|
||||
.OrderBy(g => g.Key);
|
||||
.OrderBy(g => g.Key)
|
||||
.ToList();
|
||||
|
||||
var teams = new Dictionary<string, IEnumerable<GameInformation.Player>>();
|
||||
var noTeams = players.Count() == 1;
|
||||
var noTeams = players.Count == 1;
|
||||
foreach (var p in players)
|
||||
{
|
||||
var label = noTeams ? TranslationProvider.GetString(Players) : p.Key > 0
|
||||
|
||||
@@ -572,10 +572,11 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
var players = server.Clients
|
||||
.Where(c => !c.IsSpectator)
|
||||
.GroupBy(p => p.Team)
|
||||
.OrderBy(g => g.Key);
|
||||
.OrderBy(g => g.Key)
|
||||
.ToList();
|
||||
|
||||
var teams = new Dictionary<string, IEnumerable<GameClient>>();
|
||||
var noTeams = players.Count() == 1;
|
||||
var noTeams = players.Count == 1;
|
||||
foreach (var p in players)
|
||||
{
|
||||
var label = noTeams ? TranslationProvider.GetString(Players) : p.Key > 0
|
||||
|
||||
@@ -183,9 +183,10 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
{
|
||||
var typesInGroup = hg.Value;
|
||||
var keysInGroup = modData.Hotkeys.Definitions
|
||||
.Where(hd => IsHotkeyVisibleInFilter(hd) && hd.Types.Overlaps(typesInGroup));
|
||||
.Where(hd => IsHotkeyVisibleInFilter(hd) && hd.Types.Overlaps(typesInGroup))
|
||||
.ToList();
|
||||
|
||||
if (!keysInGroup.Any())
|
||||
if (keysInGroup.Count == 0)
|
||||
continue;
|
||||
|
||||
var header = headerTemplate.Clone();
|
||||
|
||||
@@ -102,14 +102,15 @@ namespace OpenRA.Mods.Common.Widgets
|
||||
|
||||
var queues = world.ActorsWithTrait<ProductionQueue>()
|
||||
.Where(a => a.Actor.Owner == player)
|
||||
.Select((a, i) => new { a.Trait, i });
|
||||
.Select(a => a.Trait)
|
||||
.ToList();
|
||||
|
||||
foreach (var queue in queues)
|
||||
if (!clocks.ContainsKey(queue.Trait))
|
||||
clocks.Add(queue.Trait, new Animation(world, ClockAnimation));
|
||||
if (!clocks.ContainsKey(queue))
|
||||
clocks.Add(queue, new Animation(world, ClockAnimation));
|
||||
|
||||
var currentItemsByItem = queues
|
||||
.Select(a => a.Trait.CurrentItem())
|
||||
.Select(q => q.CurrentItem())
|
||||
.Where(pi => pi != null)
|
||||
.GroupBy(pr => pr.Item)
|
||||
.OrderBy(g => g.First().Queue.Info.DisplayOrder)
|
||||
|
||||
@@ -183,9 +183,9 @@ namespace OpenRA.Mods.Common.Widgets
|
||||
|
||||
public override void Draw()
|
||||
{
|
||||
var tabs = Groups[queueGroup].Tabs.Where(t => t.Queue.BuildableItems().Any());
|
||||
var tabs = Groups[queueGroup].Tabs.Where(t => t.Queue.BuildableItems().Any()).ToList();
|
||||
|
||||
if (!tabs.Any())
|
||||
if (tabs.Count == 0)
|
||||
return;
|
||||
|
||||
var rb = RenderBounds;
|
||||
|
||||
Reference in New Issue
Block a user