.Any(), .Count() -> .Count or .Length

This commit is contained in:
Eduardo Cáceres
2022-05-02 13:05:22 +02:00
committed by atlimit8
parent 6eb4fe8980
commit 79f321cb44
138 changed files with 233 additions and 258 deletions

View File

@@ -10,7 +10,6 @@
#endregion
using System.Collections.Generic;
using System.Linq;
using OpenRA.GameRules;
using OpenRA.Graphics;
using OpenRA.Traits;
@@ -42,7 +41,7 @@ namespace OpenRA.Mods.Cnc.Effects
entryAnimation = new Animation(world, entryEffect);
entryAnimation.PlayThen(entrySequence, () => Finish(world));
if (weapon.Report != null && weapon.Report.Any())
if (weapon.Report != null && weapon.Report.Length > 0)
Game.Sound.Play(SoundType.World, weapon.Report, world, launchPos);
}

View File

@@ -10,7 +10,6 @@
#endregion
using System.Collections.Generic;
using System.Linq;
using OpenRA.GameRules;
using OpenRA.Graphics;
using OpenRA.Traits;
@@ -38,7 +37,7 @@ namespace OpenRA.Mods.Cnc.Effects
anim = new Animation(world, effect);
anim.PlayThen(sequence, () => Finish(world));
if (weapon.Report != null && weapon.Report.Any())
if (weapon.Report != null && weapon.Report.Length > 0)
Game.Sound.Play(SoundType.World, weapon.Report, world, launchPos);
}

View File

@@ -289,7 +289,7 @@ namespace OpenRA.Mods.Cnc.Traits
{
minelayers.Clear();
minelayers.AddRange(selected.Where(s => !s.IsDead && s.Info.HasTraitInfo<MinelayerInfo>()));
if (!minelayers.Any())
if (minelayers.Count == 0)
world.CancelInputMode();
}

View File

@@ -61,7 +61,7 @@ namespace OpenRA.Mods.Cnc.Traits.Render
// HACK: We don't have an efficient way to know when the preview
// bounds change, so assume that we need to update the screen map
// (only) when the facing changes
if (facing.Facing != cachedFacing && previews.Any())
if (facing.Facing != cachedFacing && previews.Count > 0)
{
self.World.ScreenMap.AddOrUpdate(self);
cachedFacing = facing.Facing;

View File

@@ -634,7 +634,7 @@ namespace OpenRA.Mods.Cnc.UtilityCommands
lightingNodes.Add(new MiniYamlNode(node.Value, FieldSaver.FormatValue(val)));
}
if (lightingNodes.Any())
if (lightingNodes.Count > 0)
{
map.RuleDefinitions.Nodes.Add(new MiniYamlNode("^BaseWorld", new MiniYaml("", new List<MiniYamlNode>()
{
@@ -674,7 +674,7 @@ namespace OpenRA.Mods.Cnc.UtilityCommands
}
}
if (lightingNodes.Any())
if (lightingNodes.Count > 0)
{
map.RuleDefinitions.Nodes.Add(new MiniYamlNode(lamp, new MiniYaml("", new List<MiniYamlNode>()
{