small code cleanups

This commit is contained in:
FreezyLemon 2018-03-14 12:38:22 +01:00
parent a438e45434
commit 070decf890
1 changed files with 11 additions and 20 deletions

View File

@ -27,14 +27,8 @@ public abstract class ModSection : Container
public string Header
{
get
{
return headerLabel.Text;
}
set
{
headerLabel.Text = value;
}
get => headerLabel.Text;
set => headerLabel.Text = value;
}
public IEnumerable<Mod> SelectedMods => buttons.Select(b => b.SelectedMod).Where(m => m != null);
@ -47,12 +41,12 @@ public IEnumerable<Mod> Mods
{
if (m == null)
return new ModButtonEmpty();
else
return new ModButton(m)
{
SelectedColour = selectedColour,
SelectionChanged = Action,
};
return new ModButton(m)
{
SelectedColour = selectedColour,
SelectionChanged = Action,
};
}).ToArray();
ButtonsContainer.Children = modContainers;
@ -65,10 +59,7 @@ public IEnumerable<Mod> Mods
private Color4 selectedColour = Color4.White;
public Color4 SelectedColour
{
get
{
return selectedColour;
}
get => selectedColour;
set
{
if (value == selectedColour) return;
@ -102,13 +93,13 @@ public void DeselectTypes(IEnumerable<Type> modTypes, bool immediate = false)
{
Mod selected = button.SelectedMod;
if (selected == null) continue;
foreach (Type type in modTypes)
foreach (var type in modTypes)
if (type.IsInstanceOfType(selected))
{
if (immediate)
button.Deselect();
else
Scheduler.AddDelayed(() => button.Deselect(), delay += 50);
Scheduler.AddDelayed(button.Deselect, delay += 50);
}
}
}