Fix IDE0074
This commit is contained in:
committed by
Pavel Penev
parent
cbd0583289
commit
bd2b3d9793
@@ -147,13 +147,11 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
if (map.Package != null)
|
||||
{
|
||||
selectedDirectory = writableDirectories.FirstOrDefault(k => k.Folder.Contains(map.Package.Name));
|
||||
if (selectedDirectory == null)
|
||||
selectedDirectory = writableDirectories.FirstOrDefault(k => Directory.GetDirectories(k.Folder.Name).Any(f => f.Contains(map.Package.Name)));
|
||||
selectedDirectory ??= writableDirectories.FirstOrDefault(k => Directory.GetDirectories(k.Folder.Name).Any(f => f.Contains(map.Package.Name)));
|
||||
}
|
||||
|
||||
// Prioritize MapClassification.User directories over system directories
|
||||
if (selectedDirectory == null)
|
||||
selectedDirectory = writableDirectories.OrderByDescending(kv => kv.Classification).First();
|
||||
selectedDirectory ??= writableDirectories.OrderByDescending(kv => kv.Classification).First();
|
||||
|
||||
directoryDropdown.GetText = () => selectedDirectory?.DisplayName ?? "";
|
||||
directoryDropdown.OnClick = () =>
|
||||
|
||||
@@ -65,8 +65,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic.Ingame
|
||||
.Skip(1)
|
||||
.FirstOrDefault();
|
||||
|
||||
if (next == null)
|
||||
next = bases.First();
|
||||
next ??= bases.First();
|
||||
|
||||
selection.Combine(world, new Actor[] { next }, false, true);
|
||||
viewport.Center(selection.Actors);
|
||||
|
||||
@@ -51,8 +51,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic.Ingame
|
||||
.Skip(1)
|
||||
.FirstOrDefault();
|
||||
|
||||
if (next == null)
|
||||
next = harvesters.First();
|
||||
next ??= harvesters.First();
|
||||
|
||||
selection.Combine(world, new Actor[] { next }, false, true);
|
||||
viewport.Center(selection.Actors);
|
||||
|
||||
@@ -58,8 +58,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic.Ingame
|
||||
.Skip(1)
|
||||
.FirstOrDefault();
|
||||
|
||||
if (next == null)
|
||||
next = facilities.First();
|
||||
next ??= facilities.First();
|
||||
|
||||
Game.Sound.PlayNotification(world.Map.Rules, null, "Sounds", clickSound, null);
|
||||
|
||||
|
||||
@@ -292,8 +292,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
{ orderByDate, m => -m.ModifiedDate.Ticks }
|
||||
};
|
||||
|
||||
if (orderByFunc == null)
|
||||
orderByFunc = orderByDict[orderByPlayer];
|
||||
orderByFunc ??= orderByDict[orderByPlayer];
|
||||
|
||||
ScrollItemWidget SetupItem(string o, ScrollItemWidget template)
|
||||
{
|
||||
|
||||
@@ -45,8 +45,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
|
||||
public static bool PromptConfirmReplayCompatibility(ReplayMetadata replayMeta, ModData modData, Action onCancel = null)
|
||||
{
|
||||
if (onCancel == null)
|
||||
onCancel = DoNothing;
|
||||
onCancel ??= DoNothing;
|
||||
|
||||
if (replayMeta == null)
|
||||
return IncompatibleReplayDialog(IncompatibleReplayPrompt, null, modData, onCancel);
|
||||
|
||||
@@ -194,8 +194,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
{
|
||||
if (added.Add(hd))
|
||||
{
|
||||
if (selectedHotkeyDefinition == null)
|
||||
selectedHotkeyDefinition = hd;
|
||||
selectedHotkeyDefinition ??= hd;
|
||||
|
||||
BindHotkeyPref(hd, template);
|
||||
}
|
||||
|
||||
@@ -155,8 +155,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
{
|
||||
var panel = panelContainer.Get(panelID);
|
||||
|
||||
if (activePanel == null)
|
||||
activePanel = panelID;
|
||||
activePanel ??= panelID;
|
||||
|
||||
panel.IsVisible = () => activePanel == panelID;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user