Fix IDE0053
This commit is contained in:
committed by
Pavel Penev
parent
37afd6094e
commit
939f715e3c
@@ -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))
|
||||
{
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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))
|
||||
|
||||
@@ -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))));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user