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