.Any(), .Count() -> .Count or .Length
This commit is contained in:
committed by
atlimit8
parent
6eb4fe8980
commit
79f321cb44
@@ -10,7 +10,6 @@
|
||||
#endregion
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using OpenRA.Mods.Common.Effects;
|
||||
using OpenRA.Traits;
|
||||
|
||||
@@ -125,7 +124,7 @@ namespace OpenRA.Mods.Common.Traits.Render
|
||||
if (++offset >= Info.Offsets.Length)
|
||||
offset = 0;
|
||||
|
||||
if (!Info.TerrainTypes.Any() || Info.TerrainTypes.Contains(type))
|
||||
if (Info.TerrainTypes.Count == 0 || Info.TerrainTypes.Contains(type))
|
||||
{
|
||||
var spawnFacing = Info.SpawnAtLastPosition ? cachedFacing : facing?.Facing ?? WAngle.Zero;
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ namespace OpenRA.Mods.Common.Traits.Render
|
||||
public WithAmmoPipsDecoration(Actor self, WithAmmoPipsDecorationInfo info)
|
||||
: base(self, info)
|
||||
{
|
||||
if (info.AmmoPools.Any())
|
||||
if (info.AmmoPools.Length > 0)
|
||||
ammo = self.TraitsImplementing<AmmoPool>()
|
||||
.Where(ap => info.AmmoPools.Contains(ap.Info.Name))
|
||||
.ToArray();
|
||||
|
||||
@@ -106,11 +106,11 @@ namespace OpenRA.Mods.Common.Traits.Render
|
||||
var bDestroyed = bridgeInfo.BOffset != CVec.Zero && NeighbourIsDestroyed(bridgeInfo.BOffset);
|
||||
|
||||
var sequence = DefaultAnimation.CurrentSequence.Name;
|
||||
if (aDestroyed && bDestroyed && bridgeInfo.ABDestroyedSequences.Any())
|
||||
if (aDestroyed && bDestroyed && bridgeInfo.ABDestroyedSequences.Length > 0)
|
||||
sequence = bridgeInfo.ABDestroyedSequences.Random(Game.CosmeticRandom);
|
||||
else if (aDestroyed && bridgeInfo.ADestroyedSequences.Any())
|
||||
else if (aDestroyed && bridgeInfo.ADestroyedSequences.Length > 0)
|
||||
sequence = bridgeInfo.ADestroyedSequences.Random(Game.CosmeticRandom);
|
||||
else if (bDestroyed && bridgeInfo.BDestroyedSequences.Any())
|
||||
else if (bDestroyed && bridgeInfo.BDestroyedSequences.Length > 0)
|
||||
sequence = bridgeInfo.BDestroyedSequences.Random(Game.CosmeticRandom);
|
||||
else
|
||||
sequence = bridgeInfo.Sequences.Random(Game.CosmeticRandom);
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using OpenRA.Graphics;
|
||||
using OpenRA.Mods.Common.Graphics;
|
||||
using OpenRA.Traits;
|
||||
@@ -59,7 +58,7 @@ namespace OpenRA.Mods.Common.Traits.Render
|
||||
|
||||
var rs = self.Trait<RenderSprites>();
|
||||
var image = rs.GetImage(self);
|
||||
var images = info.XmasImages.Any() && DateTime.Today.Month == 12 ? info.XmasImages : new[] { image };
|
||||
var images = info.XmasImages.Length > 0 && DateTime.Today.Month == 12 ? info.XmasImages : new[] { image };
|
||||
|
||||
anim = new Animation(self.World, images.Random(Game.CosmeticRandom));
|
||||
anim.Play(info.IdleSequence);
|
||||
|
||||
@@ -92,11 +92,11 @@ namespace OpenRA.Mods.Common.Traits.Render
|
||||
var bRamp = bridgeInfo.BOffset != CVec.Zero && RampExists(self, bridgeInfo.BOffset);
|
||||
|
||||
var sequence = DefaultAnimation.CurrentSequence.Name;
|
||||
if (aRamp && bRamp && bridgeInfo.ABRampSequences.Any())
|
||||
if (aRamp && bRamp && bridgeInfo.ABRampSequences.Length > 0)
|
||||
sequence = bridgeInfo.ABRampSequences.Random(Game.CosmeticRandom);
|
||||
else if (aRamp && bridgeInfo.ARampSequences.Any())
|
||||
else if (aRamp && bridgeInfo.ARampSequences.Length > 0)
|
||||
sequence = bridgeInfo.ARampSequences.Random(Game.CosmeticRandom);
|
||||
else if (bRamp && bridgeInfo.BRampSequences.Any())
|
||||
else if (bRamp && bridgeInfo.BRampSequences.Length > 0)
|
||||
sequence = bridgeInfo.BRampSequences.Random(Game.CosmeticRandom);
|
||||
|
||||
DefaultAnimation.PlayRepeating(NormalizeSequence(self, sequence));
|
||||
|
||||
@@ -73,7 +73,7 @@ namespace OpenRA.Mods.Common.Traits.Render
|
||||
if (self.World.FogObscures(self))
|
||||
return false;
|
||||
|
||||
if (blinkPattern != null && blinkPattern.Any())
|
||||
if (blinkPattern != null && blinkPattern.Length > 0)
|
||||
{
|
||||
var i = (self.World.WorldTick / Info.BlinkInterval) % blinkPattern.Length;
|
||||
if (blinkPattern[i] != BlinkState.On)
|
||||
|
||||
@@ -77,15 +77,15 @@ namespace OpenRA.Mods.Common.Traits.Render
|
||||
// Per-actor production
|
||||
queues = self.TraitsImplementing<ProductionQueue>()
|
||||
.Where(q => productionInfos.Any(p => p.Produces.Contains(q.Info.Type)))
|
||||
.Where(q => !Info.Queues.Any() || Info.Queues.Contains(q.Info.Type))
|
||||
.Where(q => Info.Queues.Count == 0 || Info.Queues.Contains(q.Info.Type))
|
||||
.ToArray();
|
||||
|
||||
if (!queues.Any())
|
||||
if (queues.Length == 0)
|
||||
{
|
||||
// Player-wide production
|
||||
queues = self.Owner.PlayerActor.TraitsImplementing<ProductionQueue>()
|
||||
.Where(q => productionInfos.Any(p => p.Produces.Contains(q.Info.Type)))
|
||||
.Where(q => !Info.Queues.Any() || Info.Queues.Contains(q.Info.Type))
|
||||
.Where(q => Info.Queues.Count == 0 || Info.Queues.Contains(q.Info.Type))
|
||||
.ToArray();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user