Use out var syntax
This commit is contained in:
@@ -27,8 +27,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
public ColorPickerLogic(Widget widget, ModData modData, World world, Color initialColor, string initialFaction, Action<Color> onChange,
|
||||
Dictionary<string, MiniYaml> logicArgs)
|
||||
{
|
||||
string actorType;
|
||||
if (initialFaction == null || !ChromeMetrics.TryGet("ColorPickerActorType-" + initialFaction, out actorType))
|
||||
if (initialFaction == null || !ChromeMetrics.TryGet("ColorPickerActorType-" + initialFaction, out string actorType))
|
||||
actorType = ChromeMetrics.Get<string>("ColorPickerActorType");
|
||||
|
||||
var preview = widget.GetOrNull<ActorPreviewWidget>("PREVIEW");
|
||||
@@ -103,8 +102,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
var palettePresetRows = 2;
|
||||
var paletteCustomRows = 1;
|
||||
|
||||
MiniYaml yaml;
|
||||
if (logicArgs.TryGetValue("PaletteColumns", out yaml))
|
||||
if (logicArgs.TryGetValue("PaletteColumns", out var yaml))
|
||||
if (!int.TryParse(yaml.Value, out paletteCols))
|
||||
throw new YamlException("Invalid value for PaletteColumns: {0}".F(yaml.Value));
|
||||
if (logicArgs.TryGetValue("PalettePresetRows", out yaml))
|
||||
@@ -189,9 +187,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
|
||||
static float HueFromColor(Color c)
|
||||
{
|
||||
float h, s, v;
|
||||
int a;
|
||||
c.ToAhsv(out a, out h, out s, out v);
|
||||
c.ToAhsv(out var a, out var h, out var s, out var v);
|
||||
return h;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user