Fix IDE0053

This commit is contained in:
RoosterDragon
2023-03-04 19:21:09 +00:00
committed by Pavel Penev
parent 37afd6094e
commit 939f715e3c
28 changed files with 41 additions and 91 deletions

View File

@@ -94,10 +94,7 @@ namespace OpenRA.Mods.Common.Widgets
{
otherButton.Visible = true;
otherButton.Bounds.Y += headerHeight;
otherButton.OnClick = () =>
{
onOther();
};
otherButton.OnClick = onOther;
if (!string.IsNullOrEmpty(otherText))
{

View File

@@ -452,7 +452,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
{
var item = ScrollItemWidget.Setup(template,
() => currentFilename == filepath && currentPackage == package,
() => { LoadAsset(package, filepath); });
() => LoadAsset(package, filepath));
var label = item.Get<LabelWithTooltipWidget>("TITLE");
WidgetUtils.TruncateLabelToTooltip(label, filepath);

View File

@@ -37,7 +37,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
{
var tab = tabContainer.Get<ButtonWidget>(buttonId);
tab.IsHighlighted = () => menuType == tabType;
tab.OnClick = () => { menuType = tabType; };
tab.OnClick = () => menuType = tabType;
var container = widget.Parent.Get<ContainerWidget>(tabId);
container.IsVisible = () => menuType == tabType;

View File

@@ -33,7 +33,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
{
var item = ScrollItemWidget.Setup(template,
() => tilesetDropDown.Text == option,
() => { tilesetDropDown.Text = option; });
() => tilesetDropDown.Text = option);
item.Get<LabelWidget>("LABEL").GetText = () => option;
return item;
}

View File

@@ -113,7 +113,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
var saveButton = panel.Get<ButtonWidget>("SAVE_BUTTON");
saveButton.IsDisabled = () => string.IsNullOrWhiteSpace(saveTextField.Text);
saveButton.OnClick = () => { Save(world); };
saveButton.OnClick = () => Save(world);
saveButton.IsVisible = () => true;
var saveWidgets = panel.Get("SAVE_WIDGETS");
@@ -127,7 +127,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
var loadButton = panel.Get<ButtonWidget>("LOAD_BUTTON");
loadButton.IsVisible = () => true;
loadButton.IsDisabled = () => selectedSave == null;
loadButton.OnClick = () => { Load(); };
loadButton.OnClick = Load;
}
if (Directory.Exists(baseSavePath))

View File

@@ -333,9 +333,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
catch (Exception e)
{
Game.RunAfterTick(() => // run on the main thread
{
SetNewsStatus(modData.Translation.GetString(NewsRetrivalFailed, Translation.Arguments("message", e.Message)));
});
SetNewsStatus(modData.Translation.GetString(NewsRetrivalFailed, Translation.Arguments("message", e.Message))));
}
});
}

View File

@@ -434,10 +434,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic
{
var fsPlayer = fullscreenVideoPlayer.Get<VideoPlayerWidget>("PLAYER");
fullscreenVideoPlayer.Visible = true;
PlayVideo(fsPlayer, missionData.StartVideo, PlayingVideo.GameStart, () =>
{
Game.CreateAndStartLocalServer(selectedMap.Uid, orders);
});
PlayVideo(fsPlayer, missionData.StartVideo, PlayingVideo.GameStart,
() => Game.CreateAndStartLocalServer(selectedMap.Uid, orders));
}
else
Game.CreateAndStartLocalServer(selectedMap.Uid, orders);

View File

@@ -66,7 +66,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
pauseButton.IsVisible = () => Game.Sound.MusicPlaying;
var stopButton = panel.Get<ButtonWidget>("BUTTON_STOP");
stopButton.OnClick = () => { musicPlaylist.Stop(); };
stopButton.OnClick = musicPlaylist.Stop;
stopButton.IsDisabled = NoMusic;
var nextButton = panel.Get<ButtonWidget>("BUTTON_NEXT");

View File

@@ -148,7 +148,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
var watch = panel.Get<ButtonWidget>("WATCH_BUTTON");
watch.IsDisabled = () => selectedReplay == null || map.Status != MapStatus.Available;
watch.OnClick = () => { WatchReplay(); };
watch.OnClick = WatchReplay;
var mapPreviewRoot = panel.Get("MAP_PREVIEW_ROOT");
mapPreviewRoot.IsVisible = () => selectedReplay != null;

View File

@@ -68,10 +68,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
var hotkeyValidColor = ChromeMetrics.Get<Color>("HotkeyColor");
var hotkeyInvalidColor = ChromeMetrics.Get<Color>("HotkeyColorInvalid");
remapButton.GetColor = () =>
{
return hd.HasDuplicates ? hotkeyInvalidColor : hotkeyValidColor;
};
remapButton.GetColor = () => hd.HasDuplicates ? hotkeyInvalidColor : hotkeyValidColor;
if (selectedHotkeyDefinition == hd)
{
@@ -253,9 +250,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
hotkeyEntryWidget.IsValid = () => isHotkeyValid;
hotkeyEntryWidget.OnLoseFocus = ValidateHotkey;
hotkeyEntryWidget.OnEscKey = _ =>
{
hotkeyEntryWidget.Key = modData.Hotkeys[selectedHotkeyDefinition.Name].GetValue();
};
hotkeyEntryWidget.IsDisabled = () => selectedHotkeyDefinition.Readonly;
validHotkeyEntryWidth = hotkeyEntryWidget.Bounds.Width;

View File

@@ -285,10 +285,7 @@ namespace OpenRA.Mods.Common.Widgets
public void ScrollToItem(string itemKey, bool smooth = false)
{
var item = Children.FirstOrDefault(c =>
{
return c is ScrollItemWidget si && si.ItemKey == itemKey;
});
var item = Children.FirstOrDefault(c => c is ScrollItemWidget si && si.ItemKey == itemKey);
if (item != null)
ScrollToItem(item, smooth);
@@ -296,10 +293,7 @@ namespace OpenRA.Mods.Common.Widgets
public void ScrollToSelectedItem()
{
var item = Children.FirstOrDefault(c =>
{
return c is ScrollItemWidget si && si.IsSelected();
});
var item = Children.FirstOrDefault(c => c is ScrollItemWidget si && si.IsSelected());
if (item != null)
ScrollToItem(item);