.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

@@ -106,7 +106,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
{
RefreshMaps(currentTab, filter);
EnumerateMaps(currentTab, itemTemplate);
if (!tabMaps[currentTab].Any())
if (tabMaps[currentTab].Length == 0)
SwitchTab(modData.MapCache[newUid].Class, itemTemplate);
});
};
@@ -126,7 +126,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
SetupMapTab(MapClassification.User, filter, "USER_MAPS_TAB_BUTTON", "USER_MAPS_TAB", itemTemplate);
SetupMapTab(MapClassification.System, filter, "SYSTEM_MAPS_TAB_BUTTON", "SYSTEM_MAPS_TAB", itemTemplate);
if (initialMap == null && tabMaps.Keys.Contains(initialTab) && tabMaps[initialTab].Any())
if (initialMap == null && tabMaps.Keys.Contains(initialTab) && tabMaps[initialTab].Length > 0)
{
selectedUid = Game.ModData.MapCache.ChooseInitialMap(tabMaps[initialTab].Select(mp => mp.Uid).First(),
Game.CosmeticRandom);
@@ -163,7 +163,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
var tabButton = widget.Get<ButtonWidget>(tabButtonName);
tabButton.IsHighlighted = () => currentTab == tab;
tabButton.IsVisible = () => tabMaps[tab].Any();
tabButton.IsVisible = () => tabMaps[tab].Length > 0;
tabButton.OnClick = () => SwitchTab(tab, itemTemplate);
RefreshMaps(tab, filter);
@@ -191,7 +191,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
.ToList();
// 'all game types' extra item
categories.Insert(0, (null as string, tabMaps[tab].Count()));
categories.Insert(0, (null as string, tabMaps[tab].Length));
Func<(string Category, int Count), string> showItem = x => $"{x.Category ?? "All Maps"} ({x.Count})";