Fix IDE0200
This commit is contained in:
committed by
Gustas Kažukauskas
parent
ce3ad6fbb3
commit
0338258b45
@@ -63,7 +63,7 @@ dotnet_diagnostic.IDE0161.severity = warning
|
||||
|
||||
# IDE0200 Remove unnecessary lambda expression
|
||||
#csharp_style_prefer_method_group_conversion = true
|
||||
dotnet_diagnostic.IDE0200.severity = suggestion # TODO: Consider enabling
|
||||
dotnet_diagnostic.IDE0200.severity = warning
|
||||
|
||||
# IDE0210 Convert to top-level statements/IDE0211 Convert to 'Program.Main' style program
|
||||
csharp_style_prefer_top_level_statements = false
|
||||
|
||||
@@ -252,7 +252,7 @@ namespace OpenRA.Graphics
|
||||
|
||||
public string GetRandomExistingSequence(string[] sequences, MersenneTwister random)
|
||||
{
|
||||
return sequences.Where(s => HasSequence(s)).RandomOrDefault(random);
|
||||
return sequences.Where(HasSequence).RandomOrDefault(random);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -70,7 +70,7 @@ namespace OpenRA.Graphics
|
||||
renderers = world.WorldActor.TraitsImplementing<IRenderer>().ToArray();
|
||||
terrainRenderer = world.WorldActor.TraitOrDefault<IRenderTerrain>();
|
||||
|
||||
debugVis = Exts.Lazy(() => world.WorldActor.TraitOrDefault<DebugVisualizations>());
|
||||
debugVis = Exts.Lazy(world.WorldActor.TraitOrDefault<DebugVisualizations>);
|
||||
|
||||
postProcessPasses = world.WorldActor.TraitsImplementing<IRenderPostProcessPass>().ToArray();
|
||||
}
|
||||
|
||||
@@ -87,7 +87,7 @@ namespace OpenRA.Primitives
|
||||
return true;
|
||||
|
||||
// Easy case 4: Polygon vertex is inside rect
|
||||
if (Vertices.Any(p => rect.Contains(p)))
|
||||
if (Vertices.Any(rect.Contains))
|
||||
return true;
|
||||
|
||||
// Hard case: check intersection of every line segment pair
|
||||
|
||||
@@ -288,7 +288,7 @@ namespace OpenRA.Mods.Cnc.SpriteLoaders
|
||||
|
||||
public static void Write(Stream s, Size size, IEnumerable<byte[]> frames)
|
||||
{
|
||||
var compressedFrames = frames.Select(f => LCWCompression.Encode(f)).ToList();
|
||||
var compressedFrames = frames.Select(LCWCompression.Encode).ToList();
|
||||
|
||||
// note: end-of-file and all-zeroes headers
|
||||
var dataOffset = 14 + (compressedFrames.Count + 2) * 8;
|
||||
|
||||
@@ -44,7 +44,7 @@ namespace OpenRA.Mods.Cnc.Traits
|
||||
return 0;
|
||||
}
|
||||
|
||||
wr.AddPalette(info.Name, new ImmutablePalette(Enumerable.Range(0, Palette.Size).Select(i => MakeColor(i))));
|
||||
wr.AddPalette(info.Name, new ImmutablePalette(Enumerable.Range(0, Palette.Size).Select(MakeColor)));
|
||||
}
|
||||
|
||||
public IEnumerable<string> PaletteNames { get { yield return info.Name; } }
|
||||
|
||||
@@ -95,7 +95,7 @@ namespace OpenRA.Mods.Cnc.Traits
|
||||
var ratio = Common.Util.RandomInRange(world.LocalRandom, info.Ratio);
|
||||
var positions = cells.Shuffle(world.LocalRandom)
|
||||
.Take(Math.Max(1, cells.Count * ratio / 100))
|
||||
.Select(x => world.Map.CenterOfCell(x));
|
||||
.Select(world.Map.CenterOfCell);
|
||||
|
||||
foreach (var position in positions)
|
||||
world.AddFrameEndTask(w => w.Add(new SpriteEffect(position, w, info.Image, info.Sequences.Random(w.LocalRandom), info.Palette)));
|
||||
|
||||
@@ -72,7 +72,7 @@ namespace OpenRA.Mods.Common
|
||||
|
||||
public static void NotifyBlocker(this Actor self, IEnumerable<CPos> positions)
|
||||
{
|
||||
NotifyBlocker(self, positions.SelectMany(p => self.World.ActorMap.GetActorsAt(p)));
|
||||
NotifyBlocker(self, positions.SelectMany(self.World.ActorMap.GetActorsAt));
|
||||
}
|
||||
|
||||
public static CPos ClosestCell(this Actor self, IEnumerable<CPos> cells)
|
||||
|
||||
@@ -48,7 +48,7 @@ namespace OpenRA.Mods.Common.Lint
|
||||
|
||||
foreach (var w in modData.ObjectCreator.GetTypesImplementing<Widget>())
|
||||
{
|
||||
foreach (var m in w.GetMethods().Where(m => Utility.HasAttribute<CustomLintableHotkeyNames>(m)))
|
||||
foreach (var m in w.GetMethods().Where(Utility.HasAttribute<CustomLintableHotkeyNames>))
|
||||
{
|
||||
var p = m.GetParameters();
|
||||
if (p.Length == 3 && p[0].ParameterType == typeof(MiniYamlNode) && p[1].ParameterType == typeof(Action<string>)
|
||||
|
||||
@@ -42,19 +42,19 @@ namespace OpenRA.Mods.Common.Lint
|
||||
var properties = trait.GetType().GetProperties();
|
||||
|
||||
var fieldConsumed = fields
|
||||
.Where(x => Utility.HasAttribute<ConsumedConditionReferenceAttribute>(x))
|
||||
.Where(Utility.HasAttribute<ConsumedConditionReferenceAttribute>)
|
||||
.SelectMany(f => LintExts.GetFieldValues(trait, f));
|
||||
|
||||
var propertyConsumed = properties
|
||||
.Where(x => Utility.HasAttribute<ConsumedConditionReferenceAttribute>(x))
|
||||
.Where(Utility.HasAttribute<ConsumedConditionReferenceAttribute>)
|
||||
.SelectMany(p => LintExts.GetPropertyValues(trait, p));
|
||||
|
||||
var fieldGranted = fields
|
||||
.Where(x => Utility.HasAttribute<GrantedConditionReferenceAttribute>(x))
|
||||
.Where(Utility.HasAttribute<GrantedConditionReferenceAttribute>)
|
||||
.SelectMany(f => LintExts.GetFieldValues(trait, f));
|
||||
|
||||
var propertyGranted = properties
|
||||
.Where(x => Utility.HasAttribute<GrantedConditionReferenceAttribute>(x))
|
||||
.Where(Utility.HasAttribute<GrantedConditionReferenceAttribute>)
|
||||
.SelectMany(f => LintExts.GetPropertyValues(trait, f));
|
||||
|
||||
foreach (var c in fieldConsumed.Concat(propertyConsumed))
|
||||
|
||||
@@ -46,7 +46,7 @@ namespace OpenRA.Mods.Common.Lint
|
||||
{
|
||||
foreach (var traitInfo in actorInfo.Value.TraitInfos<TraitInfo>())
|
||||
{
|
||||
var fields = Utility.GetFields(traitInfo.GetType()).Where(f => Utility.HasAttribute<LocomotorReferenceAttribute>(f));
|
||||
var fields = Utility.GetFields(traitInfo.GetType()).Where(Utility.HasAttribute<LocomotorReferenceAttribute>);
|
||||
foreach (var field in fields)
|
||||
{
|
||||
var locomotors = LintExts.GetFieldValues(traitInfo, field);
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace OpenRA.Mods.Common.Lint
|
||||
foreach (var traitInfo in actorInfo.Value.TraitInfos<TraitInfo>())
|
||||
{
|
||||
var fields = Utility.GetFields(traitInfo.GetType());
|
||||
foreach (var field in fields.Where(x => Utility.HasAttribute<NotificationReferenceAttribute>(x)))
|
||||
foreach (var field in fields.Where(Utility.HasAttribute<NotificationReferenceAttribute>))
|
||||
{
|
||||
string type = null;
|
||||
var notificationReference = Utility.GetCustomAttributes<NotificationReferenceAttribute>(field, true).First();
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace OpenRA.Mods.Common.Lint
|
||||
const BindingFlags Flags = BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly;
|
||||
while (type != null)
|
||||
{
|
||||
if (((MemberInfo[])type.GetFields(Flags)).Concat(type.GetProperties(Flags)).Any(x => Utility.HasAttribute<SyncAttribute>(x)))
|
||||
if (((MemberInfo[])type.GetFields(Flags)).Concat(type.GetProperties(Flags)).Any(Utility.HasAttribute<SyncAttribute>))
|
||||
return true;
|
||||
type = type.BaseType;
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ namespace OpenRA.Mods.Common.Lint
|
||||
{
|
||||
foreach (var traitInfo in actorInfo.Value.TraitInfos<TraitInfo>())
|
||||
{
|
||||
var fields = Utility.GetFields(traitInfo.GetType()).Where(f => Utility.HasAttribute<VoiceSetReferenceAttribute>(f));
|
||||
var fields = Utility.GetFields(traitInfo.GetType()).Where(Utility.HasAttribute<VoiceSetReferenceAttribute>);
|
||||
foreach (var field in fields)
|
||||
{
|
||||
var voiceSets = LintExts.GetFieldValues(traitInfo, field);
|
||||
@@ -57,7 +57,7 @@ namespace OpenRA.Mods.Common.Lint
|
||||
|
||||
foreach (var traitInfo in actorInfo.TraitInfos<TraitInfo>())
|
||||
{
|
||||
var fields = Utility.GetFields(traitInfo.GetType()).Where(f => Utility.HasAttribute<VoiceReferenceAttribute>(f));
|
||||
var fields = Utility.GetFields(traitInfo.GetType()).Where(Utility.HasAttribute<VoiceReferenceAttribute>);
|
||||
foreach (var field in fields)
|
||||
{
|
||||
var voices = LintExts.GetFieldValues(traitInfo, field);
|
||||
|
||||
@@ -159,7 +159,7 @@ namespace OpenRA.Mods.Common.MapGenerator
|
||||
var templates = new List<TerrainTemplateInfo>();
|
||||
var segments = Start.Union(Inner).Union(End).ToHashSet();
|
||||
foreach (var template in TemplatedTerrainInfo.Templates.Values.OrderBy(tti => tti.Id))
|
||||
if (template.Segments.Any(segment => segments.Contains(segment)))
|
||||
if (template.Segments.Any(segments.Contains))
|
||||
templates.Add(template);
|
||||
return templates;
|
||||
}
|
||||
|
||||
@@ -90,7 +90,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
: base(self, info)
|
||||
{
|
||||
Info = info;
|
||||
coords = Exts.Lazy(() => self.Trait<BodyOrientation>());
|
||||
coords = Exts.Lazy(self.Trait<BodyOrientation>);
|
||||
armaments = new List<Armament>();
|
||||
muzzles = new List<AnimationWithOffset>();
|
||||
paxFacing = new Dictionary<Actor, IFacing>();
|
||||
|
||||
@@ -140,7 +140,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
if (minelayers.Length == 0)
|
||||
return;
|
||||
|
||||
var enemies = world.Actors.Where(a => IsPreferredEnemyUnit(a)).ToArray();
|
||||
var enemies = world.Actors.Where(IsPreferredEnemyUnit).ToArray();
|
||||
if (enemies.Length == 0)
|
||||
return;
|
||||
|
||||
|
||||
@@ -553,14 +553,14 @@ namespace OpenRA.Mods.Common.Traits
|
||||
{
|
||||
unitsHangingAroundTheBase.Clear();
|
||||
unitsHangingAroundTheBase.AddRange(FieldLoader.GetValue<uint[]>("UnitsHangingAroundTheBase", unitsHangingAroundTheBaseNode.Value)
|
||||
.Select(a => self.World.GetActorById(a)).Where(a => a != null));
|
||||
.Select(self.World.GetActorById).Where(a => a != null));
|
||||
}
|
||||
|
||||
if (nodes.TryGetValue("ActiveUnits", out var activeUnitsNode))
|
||||
{
|
||||
activeUnits.Clear();
|
||||
activeUnits.UnionWith(FieldLoader.GetValue<uint[]>("ActiveUnits", activeUnitsNode.Value)
|
||||
.Select(a => self.World.GetActorById(a)).Where(a => a != null));
|
||||
.Select(self.World.GetActorById).Where(a => a != null));
|
||||
}
|
||||
|
||||
if (nodes.TryGetValue("RushTicks", out var rushTicksNode))
|
||||
|
||||
@@ -174,7 +174,7 @@ namespace OpenRA.Mods.Common.Traits.BotModules.Squads
|
||||
var unitsNode = yaml.NodeWithKeyOrDefault("Units");
|
||||
if (unitsNode != null)
|
||||
squad.Units.UnionWith(FieldLoader.GetValue<uint[]>("Units", unitsNode.Value.Value)
|
||||
.Select(a => squadManager.World.GetActorById(a)));
|
||||
.Select(squadManager.World.GetActorById));
|
||||
|
||||
return squad;
|
||||
}
|
||||
|
||||
@@ -288,7 +288,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
bool IDisableEnemyAutoTarget.DisableEnemyAutoTarget(Actor self, Actor attacker)
|
||||
{
|
||||
return info.PreventsAutoTarget && currentCaptors.Any(c => attacker.AppearsFriendlyTo(c));
|
||||
return info.PreventsAutoTarget && currentCaptors.Any(attacker.AppearsFriendlyTo);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -123,7 +123,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
if (runtimeCargoInit != null)
|
||||
{
|
||||
cargo = runtimeCargoInit.Value.ToList();
|
||||
totalWeight = cargo.Sum(c => GetWeight(c));
|
||||
totalWeight = cargo.Sum(GetWeight);
|
||||
}
|
||||
else if (cargoInit != null)
|
||||
{
|
||||
@@ -135,7 +135,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
cargo.Add(unit);
|
||||
}
|
||||
|
||||
totalWeight = cargo.Sum(c => GetWeight(c));
|
||||
totalWeight = cargo.Sum(GetWeight);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -147,7 +147,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
cargo.Add(unit);
|
||||
}
|
||||
|
||||
totalWeight = cargo.Sum(c => GetWeight(c));
|
||||
totalWeight = cargo.Sum(GetWeight);
|
||||
}
|
||||
|
||||
facing = Exts.Lazy(self.TraitOrDefault<IFacing>);
|
||||
|
||||
@@ -140,7 +140,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
if (buildingInfo != null)
|
||||
{
|
||||
var footprint = buildingInfo.PathableTiles(target.Location);
|
||||
if (footprint.All(c => self.World.ShroudObscures(c)))
|
||||
if (footprint.All(self.World.ShroudObscures))
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -83,7 +83,7 @@ namespace OpenRA.Mods.Common.Traits.Render
|
||||
DefaultAnimation = new Animation(self.World, rs.GetImage(self), () => turreted.WorldOrientation.Yaw);
|
||||
DefaultAnimation.PlayRepeating(NormalizeSequence(self, Info.Sequence));
|
||||
rs.Add(new AnimationWithOffset(
|
||||
DefaultAnimation, () => BarrelOffset(), () => IsTraitDisabled, p => RenderUtils.ZOffsetFromCenter(self, p, 0)));
|
||||
DefaultAnimation, BarrelOffset, () => IsTraitDisabled, p => RenderUtils.ZOffsetFromCenter(self, p, 0)));
|
||||
|
||||
// Restrict turret facings to match the sprite
|
||||
turreted.QuantizedFacings = DefaultAnimation.CurrentSequence.Facings;
|
||||
|
||||
@@ -61,7 +61,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
{
|
||||
this.self = self;
|
||||
this.info = info;
|
||||
health = Exts.Lazy(() => self.TraitOrDefault<IHealth>());
|
||||
health = Exts.Lazy(self.TraitOrDefault<IHealth>);
|
||||
}
|
||||
|
||||
public void ResolveOrder(Actor self, Order order)
|
||||
|
||||
@@ -44,7 +44,7 @@ namespace OpenRA.Mods.Common.Traits.Sound
|
||||
public AnnounceOnSeen(Actor self, AnnounceOnSeenInfo info)
|
||||
{
|
||||
Info = info;
|
||||
radarPings = Exts.Lazy(() => self.World.WorldActor.Trait<RadarPings>());
|
||||
radarPings = Exts.Lazy(self.World.WorldActor.Trait<RadarPings>);
|
||||
}
|
||||
|
||||
public void OnDiscovered(Actor self, Player discoverer, bool playNotification)
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
Self = init.Self;
|
||||
DevMode = Self.Trait<DeveloperMode>();
|
||||
TechTree = Self.Trait<TechTree>();
|
||||
RadarPings = Exts.Lazy(() => Self.World.WorldActor.TraitOrDefault<RadarPings>());
|
||||
RadarPings = Exts.Lazy(Self.World.WorldActor.TraitOrDefault<RadarPings>);
|
||||
|
||||
init.World.ActorAdded += ActorAdded;
|
||||
init.World.ActorRemoved += ActorRemoved;
|
||||
|
||||
@@ -50,7 +50,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
// All the map cells that visually overlap the current cell
|
||||
var testCells = w.Map.ProjectedCellsCovering(uv)
|
||||
.SelectMany(puv => w.Map.Unproject(puv));
|
||||
.SelectMany(w.Map.Unproject);
|
||||
if (testCells.Any(x => x.V >= uv.V + 4))
|
||||
w.Map.CustomTerrain[uv] = tileType;
|
||||
}
|
||||
|
||||
@@ -141,7 +141,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
foreach (var n in groupsNode.Value.Nodes)
|
||||
{
|
||||
var group = FieldLoader.GetValue<uint[]>(n.Key, n.Value.Value)
|
||||
.Select(a => self.World.GetActorById(a)).Where(a => a != null);
|
||||
.Select(self.World.GetActorById).Where(a => a != null);
|
||||
controlGroups[Exts.ParseInt32Invariant(n.Key)].AddRange(group);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -191,7 +191,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
if (selectionNode != null)
|
||||
{
|
||||
var selected = FieldLoader.GetValue<uint[]>("Selection", selectionNode.Value.Value)
|
||||
.Select(a => self.World.GetActorById(a)).Where(a => a != null);
|
||||
.Select(self.World.GetActorById).Where(a => a != null);
|
||||
Combine(self.World, selected, false, false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -303,7 +303,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
if (newShroud != null)
|
||||
{
|
||||
cellVisibility = puv => newShroud.GetVisibility(puv);
|
||||
cellVisibility = newShroud.GetVisibility;
|
||||
newShroud.OnShroudChanged += UpdateShroudCell;
|
||||
}
|
||||
else
|
||||
|
||||
@@ -193,7 +193,7 @@ namespace OpenRA.Mods.Common
|
||||
|
||||
public static IEnumerable<CPos> AdjacentCells(World w, in Target target)
|
||||
{
|
||||
var cells = target.Positions.Select(p => w.Map.CellContaining(p)).Distinct();
|
||||
var cells = target.Positions.Select(w.Map.CellContaining).Distinct();
|
||||
return ExpandFootprint(cells, true);
|
||||
}
|
||||
|
||||
|
||||
@@ -191,7 +191,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
}
|
||||
|
||||
filenameInput = panel.Get<TextFieldWidget>("FILENAME_INPUT");
|
||||
filenameInput.OnTextEdited = () => ApplyFilter();
|
||||
filenameInput.OnTextEdited = ApplyFilter;
|
||||
filenameInput.OnEscKey = _ =>
|
||||
{
|
||||
if (string.IsNullOrEmpty(filenameInput.Text))
|
||||
|
||||
@@ -265,7 +265,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
|
||||
slider.GetValue = () => so.GetValue(SelectedActor);
|
||||
slider.OnChange += value => so.OnChange(SelectedActor, value);
|
||||
slider.OnChange += value => editorActionHandle.OnChange(value);
|
||||
slider.OnChange += editorActionHandle.OnChange;
|
||||
|
||||
var valueField = sliderContainer.GetOrNull<TextFieldWidget>("VALUE");
|
||||
if (valueField != null)
|
||||
|
||||
@@ -48,9 +48,9 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
{
|
||||
var actionManager = world.WorldActor.Trait<EditorActionManager>();
|
||||
undoButton.IsDisabled = () => !actionManager.HasUndos();
|
||||
undoButton.OnClick = () => actionManager.Undo();
|
||||
undoButton.OnClick = actionManager.Undo;
|
||||
redoButton.IsDisabled = () => !actionManager.HasRedos();
|
||||
redoButton.OnClick = () => actionManager.Redo();
|
||||
redoButton.OnClick = actionManager.Redo;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -110,7 +110,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
|
||||
void CreateCategoryPanel(MapBlitFilters copyFilter, CheckboxWidget checkbox)
|
||||
{
|
||||
checkbox.GetText = () => copyFilter.ToString();
|
||||
checkbox.GetText = copyFilter.ToString;
|
||||
checkbox.IsChecked = () => selectionFilters.HasFlag(copyFilter);
|
||||
checkbox.IsVisible = () => true;
|
||||
checkbox.OnClick = () => selectionFilters ^= copyFilter;
|
||||
|
||||
@@ -102,7 +102,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
foreach (var cat in allCategories)
|
||||
{
|
||||
var category = categoryTemplate.Clone();
|
||||
category.GetText = () => cat.ToString();
|
||||
category.GetText = cat.ToString;
|
||||
category.IsVisible = () => true;
|
||||
|
||||
if (cat.HasFlag(MapOverlays.Grid))
|
||||
|
||||
@@ -98,7 +98,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
continue;
|
||||
|
||||
var checkbox = visOptionTemplate.Clone();
|
||||
checkbox.GetText = () => visibilityOption.ToString();
|
||||
checkbox.GetText = visibilityOption.ToString;
|
||||
checkbox.IsChecked = () => map.Visibility.HasFlag(visibilityOption);
|
||||
checkbox.OnClick = () => map.Visibility ^= visibilityOption;
|
||||
visibilityPanel.AddChild(checkbox);
|
||||
|
||||
@@ -118,8 +118,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
saveWidgets.IsVisible = () => true;
|
||||
|
||||
saveTextField = saveWidgets.Get<TextFieldWidget>("SAVE_TEXTFIELD");
|
||||
saveTextField.OnEnterKey = input => saveButton.HandleKeyPress(input);
|
||||
saveTextField.OnEscKey = input => cancelButton.HandleKeyPress(input);
|
||||
saveTextField.OnEnterKey = saveButton.HandleKeyPress;
|
||||
saveTextField.OnEscKey = cancelButton.HandleKeyPress;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -226,7 +226,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
}
|
||||
|
||||
var savePaths = Directory.GetFiles(baseSavePath, "*.orasav", SearchOption.AllDirectories)
|
||||
.OrderByDescending(p => File.GetLastWriteTime(p))
|
||||
.OrderByDescending(File.GetLastWriteTime)
|
||||
.ToList();
|
||||
|
||||
foreach (var savePath in savePaths)
|
||||
|
||||
@@ -196,8 +196,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
CreateStatsOption(SupportPowers, ObserverStatsPanel.SupportPowers, supportPowersPlayerTemplate, () => DisplayStats(SupportPowerStats)),
|
||||
CreateStatsOption(Combat, ObserverStatsPanel.Combat, combatPlayerTemplate, () => DisplayStats(CombatStats)),
|
||||
CreateStatsOption(Army, ObserverStatsPanel.Army, armyPlayerTemplate, () => DisplayStats(ArmyStats)),
|
||||
CreateStatsOption(EarningsGraph, ObserverStatsPanel.Graph, null, () => IncomeGraph()),
|
||||
CreateStatsOption(ArmyGraph, ObserverStatsPanel.ArmyGraph, null, () => ArmyValueGraph()),
|
||||
CreateStatsOption(EarningsGraph, ObserverStatsPanel.Graph, null, IncomeGraph),
|
||||
CreateStatsOption(ArmyGraph, ObserverStatsPanel.ArmyGraph, null, ArmyValueGraph),
|
||||
};
|
||||
|
||||
ScrollItemWidget SetupItem(StatsDropDownOption option, ScrollItemWidget template)
|
||||
@@ -352,7 +352,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
var armyText = new CachedTransform<int, string>(i => "$" + i.ToString(NumberFormatInfo.CurrentInfo));
|
||||
template.Get<LabelWidget>("ARMY_VALUE").GetText = () => armyText.Update(stats.ArmyValue);
|
||||
|
||||
var visionText = new CachedTransform<int, string>(i => Vision(i));
|
||||
var visionText = new CachedTransform<int, string>(Vision);
|
||||
template.Get<LabelWidget>("VISION").GetText = () => player.Shroud.Disabled ? "100%" : visionText.Update(player.Shroud.RevealedCells);
|
||||
|
||||
return template;
|
||||
@@ -520,7 +520,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
var experienceText = new CachedTransform<int, string>(i => i.ToString(NumberFormatInfo.CurrentInfo));
|
||||
template.Get<LabelWidget>("EXPERIENCE").GetText = () => experienceText.Update(stats.Experience);
|
||||
|
||||
var actionsText = new CachedTransform<double, string>(d => AverageOrdersPerMinute(d));
|
||||
var actionsText = new CachedTransform<double, string>(AverageOrdersPerMinute);
|
||||
template.Get<LabelWidget>("ACTIONS_MIN").GetText = () => actionsText.Update(stats.OrderCount);
|
||||
|
||||
return template;
|
||||
|
||||
@@ -793,7 +793,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
var item = ScrollItemWidget.Setup(template,
|
||||
() => selectedReplay == replay,
|
||||
() => SelectReplay(replay),
|
||||
() => WatchReplay());
|
||||
WatchReplay);
|
||||
|
||||
replayState[replay] = new ReplayState
|
||||
{
|
||||
|
||||
@@ -118,7 +118,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
contexts.UnionWith(hd.Contexts);
|
||||
|
||||
filterInput = panel.Get<TextFieldWidget>("FILTER_INPUT");
|
||||
filterInput.OnTextEdited = () => InitHotkeyList();
|
||||
filterInput.OnTextEdited = InitHotkeyList;
|
||||
filterInput.OnEscKey = _ =>
|
||||
{
|
||||
if (string.IsNullOrEmpty(filterInput.Text))
|
||||
|
||||
@@ -68,7 +68,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
|
||||
var mouseScrollDropdown = panel.Get<DropDownButtonWidget>("MOUSE_SCROLL_TYPE_DROPDOWN");
|
||||
mouseScrollDropdown.OnMouseDown = _ => ShowMouseScrollDropdown(mouseScrollDropdown, gs);
|
||||
mouseScrollDropdown.GetText = () => gs.MouseScroll.ToString();
|
||||
mouseScrollDropdown.GetText = gs.MouseScroll.ToString;
|
||||
|
||||
var mouseControlDescClassic = panel.Get("MOUSE_CONTROL_DESC_CLASSIC");
|
||||
mouseControlDescClassic.IsVisible = () => gs.UseClassicMouseStyle;
|
||||
@@ -113,7 +113,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
|
||||
var zoomModifierDropdown = panel.Get<DropDownButtonWidget>("ZOOM_MODIFIER");
|
||||
zoomModifierDropdown.OnMouseDown = _ => ShowZoomModifierDropdown(zoomModifierDropdown, gs);
|
||||
zoomModifierDropdown.GetText = () => gs.ZoomModifier.ToString();
|
||||
zoomModifierDropdown.GetText = gs.ZoomModifier.ToString;
|
||||
|
||||
SettingsUtils.AdjustSettingsScrollPanelLayout(scrollPanel);
|
||||
|
||||
|
||||
@@ -198,7 +198,7 @@ namespace OpenRA.Mods.Common.Widgets
|
||||
}
|
||||
|
||||
case TextFieldType.Integer:
|
||||
return new string(input.Where(c => char.IsDigit(c)).ToArray());
|
||||
return new string(input.Where(char.IsDigit).ToArray());
|
||||
|
||||
default:
|
||||
return input;
|
||||
|
||||
@@ -85,7 +85,7 @@ namespace OpenRA.Mods.D2k.Traits
|
||||
// If close enough, we don't care about other actors.
|
||||
var target = self.World.FindActorsInCircle(self.CenterPosition, WormInfo.IgnoreNoiseAttackRange)
|
||||
.WithPathFrom(self)
|
||||
.Select(t => Target.FromActor(t))
|
||||
.Select(Target.FromActor)
|
||||
.FirstOrDefault(t => attackTrait.HasAnyValidWeapons(t));
|
||||
|
||||
if (target.Type == TargetType.Actor)
|
||||
|
||||
@@ -81,11 +81,11 @@ namespace OpenRA.Platforms.Default
|
||||
context.InitializeOpenGL();
|
||||
|
||||
doClear = () => { context.Clear(); return null; };
|
||||
doClearDepthBuffer = () => context.ClearDepthBuffer();
|
||||
doDisableDepthBuffer = () => context.DisableDepthBuffer();
|
||||
doEnableDepthBuffer = () => context.EnableDepthBuffer();
|
||||
doDisableScissor = () => context.DisableScissor();
|
||||
doPresent = () => context.Present();
|
||||
doClearDepthBuffer = context.ClearDepthBuffer;
|
||||
doDisableDepthBuffer = context.DisableDepthBuffer;
|
||||
doEnableDepthBuffer = context.EnableDepthBuffer;
|
||||
doDisableScissor = context.DisableScissor;
|
||||
doPresent = context.Present;
|
||||
getGLVersion = () => context.GLVersion;
|
||||
getCreateTexture = () => new ThreadedTexture(this, (ITextureInternal)context.CreateTexture());
|
||||
getCreateFrameBuffer =
|
||||
@@ -659,7 +659,7 @@ namespace OpenRA.Platforms.Default
|
||||
setScaleFilter = value => texture.ScaleFilter = (TextureScaleFilter)value;
|
||||
getSize = () => texture.Size;
|
||||
setEmpty = tuple => { var t = ((int, int))tuple; texture.SetEmpty(t.Item1, t.Item2); };
|
||||
getData = () => texture.GetData();
|
||||
getData = texture.GetData;
|
||||
setData1 = tuple => { var t = ((byte[], int, int))tuple; texture.SetData(t.Item1, t.Item2, t.Item3); };
|
||||
setData2 = tuple => { setData1(tuple); return null; };
|
||||
setData3 = tuple => { var t = ((float[], int, int))tuple; texture.SetFloatData(t.Item1, t.Item2, t.Item3); };
|
||||
|
||||
Reference in New Issue
Block a user