Compact lambda expressions in some (not all) places
This commit is contained in:
@@ -230,10 +230,7 @@ namespace OpenRA
|
|||||||
var err1 = FieldLoader.UnknownFieldAction;
|
var err1 = FieldLoader.UnknownFieldAction;
|
||||||
var err2 = FieldLoader.InvalidValueAction;
|
var err2 = FieldLoader.InvalidValueAction;
|
||||||
|
|
||||||
FieldLoader.UnknownFieldAction = (s, f) =>
|
FieldLoader.UnknownFieldAction = (s, f) => Console.WriteLine("Ignoring unknown field `{0}` on `{1}`".F(s, f.Name));
|
||||||
{
|
|
||||||
Console.WriteLine("Ignoring unknown field `{0}` on `{1}`".F(s, f.Name));
|
|
||||||
};
|
|
||||||
|
|
||||||
if (File.Exists(settingsFile))
|
if (File.Exists(settingsFile))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ namespace OpenRA.Widgets
|
|||||||
{
|
{
|
||||||
this.modRules = modRules;
|
this.modRules = modRules;
|
||||||
|
|
||||||
GetText = () => { return Text; };
|
GetText = () => Text;
|
||||||
GetColor = () => TextColor;
|
GetColor = () => TextColor;
|
||||||
GetColorDisabled = () => TextColorDisabled;
|
GetColorDisabled = () => TextColorDisabled;
|
||||||
GetContrastColor = () => ContrastColor;
|
GetContrastColor = () => ContrastColor;
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ namespace OpenRA.Widgets
|
|||||||
[ObjectCreator.UseCtor]
|
[ObjectCreator.UseCtor]
|
||||||
public SpriteWidget(WorldRenderer worldRenderer)
|
public SpriteWidget(WorldRenderer worldRenderer)
|
||||||
{
|
{
|
||||||
GetPalette = () => { return Palette; };
|
GetPalette = () => Palette;
|
||||||
|
|
||||||
this.worldRenderer = worldRenderer;
|
this.worldRenderer = worldRenderer;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,10 +22,7 @@ namespace OpenRA.Mods.RA
|
|||||||
{
|
{
|
||||||
static void Explode(Actor self)
|
static void Explode(Actor self)
|
||||||
{
|
{
|
||||||
self.World.AddFrameEndTask(w =>
|
self.World.AddFrameEndTask(w => self.InflictDamage(self, int.MaxValue, null));
|
||||||
{
|
|
||||||
self.InflictDamage(self, int.MaxValue, null);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public IEnumerable<IOrderTargeter> Orders
|
public IEnumerable<IOrderTargeter> Orders
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ namespace OpenRA.Mods.RA.Render
|
|||||||
public void PlayCustomAnimRepeating(Actor self, string name)
|
public void PlayCustomAnimRepeating(Actor self, string name)
|
||||||
{
|
{
|
||||||
DefaultAnimation.PlayThen(name,
|
DefaultAnimation.PlayThen(name,
|
||||||
() => { PlayCustomAnimRepeating(self, name); });
|
() => PlayCustomAnimRepeating(self, name));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void PlayCustomAnimBackwards(Actor self, string name, Action after)
|
public void PlayCustomAnimBackwards(Actor self, string name, Action after)
|
||||||
|
|||||||
@@ -65,19 +65,13 @@ namespace OpenRA.Mods.RA.Widgets.Logic
|
|||||||
mirror != null ? new Uri(mirror).Host : "unknown host");
|
mirror != null ? new Uri(mirror).Host : "unknown host");
|
||||||
};
|
};
|
||||||
|
|
||||||
Action<string> onExtractProgress = s =>
|
Action<string> onExtractProgress = s => Game.RunAfterTick(() => statusLabel.GetText = () => s);
|
||||||
{
|
|
||||||
Game.RunAfterTick(() => statusLabel.GetText = () => s);
|
|
||||||
};
|
|
||||||
|
|
||||||
Action<string> onError = s =>
|
Action<string> onError = s => Game.RunAfterTick(() =>
|
||||||
{
|
{
|
||||||
Game.RunAfterTick(() =>
|
statusLabel.GetText = () => "Error: " + s;
|
||||||
{
|
retryButton.IsVisible = () => true;
|
||||||
statusLabel.GetText = () => "Error: " + s;
|
});
|
||||||
retryButton.IsVisible = () => true;
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
Action<AsyncCompletedEventArgs, bool> onDownloadComplete = (i, cancelled) =>
|
Action<AsyncCompletedEventArgs, bool> onDownloadComplete = (i, cancelled) =>
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -66,10 +66,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
Action<string> onRetry = password =>
|
Action<string> onRetry = password => ConnectionLogic.Connect(om.Host, om.Port, password, onConnect, onExit);
|
||||||
{
|
|
||||||
ConnectionLogic.Connect(om.Host, om.Port, password, onConnect, onExit);
|
|
||||||
};
|
|
||||||
|
|
||||||
Ui.OpenWindow("CONNECTIONFAILED_PANEL", new WidgetArgs()
|
Ui.OpenWindow("CONNECTIONFAILED_PANEL", new WidgetArgs()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -58,8 +58,8 @@ namespace OpenRA.Mods.RA.Widgets.Logic
|
|||||||
{
|
{
|
||||||
replays = Directory
|
replays = Directory
|
||||||
.GetFiles(dir, "*.rep")
|
.GetFiles(dir, "*.rep")
|
||||||
.Select((filename) => ReplayMetadata.Read(filename))
|
.Select(ReplayMetadata.Read)
|
||||||
.Where((r) => r != null)
|
.Where(r => r != null)
|
||||||
.OrderByDescending(r => r.GameInfo.StartTimeUtc)
|
.OrderByDescending(r => r.GameInfo.StartTimeUtc)
|
||||||
.ToList();
|
.ToList();
|
||||||
}
|
}
|
||||||
@@ -365,14 +365,11 @@ namespace OpenRA.Mods.RA.Widgets.Logic
|
|||||||
"Rename Replay",
|
"Rename Replay",
|
||||||
"Enter a new file name:",
|
"Enter a new file name:",
|
||||||
initialName,
|
initialName,
|
||||||
onAccept: (newName) =>
|
onAccept: newName => RenameReplay(r, newName),
|
||||||
{
|
|
||||||
RenameReplay(r, newName);
|
|
||||||
},
|
|
||||||
onCancel: null,
|
onCancel: null,
|
||||||
acceptText: "Rename",
|
acceptText: "Rename",
|
||||||
cancelText: null,
|
cancelText: null,
|
||||||
inputValidator: (newName) =>
|
inputValidator: newName =>
|
||||||
{
|
{
|
||||||
if (newName == initialName)
|
if (newName == initialName)
|
||||||
return false;
|
return false;
|
||||||
@@ -439,7 +436,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic
|
|||||||
"Delete {0} replays?".F(list.Count),
|
"Delete {0} replays?".F(list.Count),
|
||||||
() =>
|
() =>
|
||||||
{
|
{
|
||||||
list.ForEach((r) => DeleteReplay(r));
|
list.ForEach(DeleteReplay);
|
||||||
if (selectedReplay == null)
|
if (selectedReplay == null)
|
||||||
SelectFirstVisibleReplay();
|
SelectFirstVisibleReplay();
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user