mirror of
https://github.com/ppy/osu.git
synced 2025-03-16 05:37:19 +08:00
small code cleanups
This commit is contained in:
parent
a438e45434
commit
070decf890
@ -27,14 +27,8 @@ namespace osu.Game.Overlays.Mods
|
||||
|
||||
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 @@ namespace osu.Game.Overlays.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 @@ namespace osu.Game.Overlays.Mods
|
||||
private Color4 selectedColour = Color4.White;
|
||||
public Color4 SelectedColour
|
||||
{
|
||||
get
|
||||
{
|
||||
return selectedColour;
|
||||
}
|
||||
get => selectedColour;
|
||||
set
|
||||
{
|
||||
if (value == selectedColour) return;
|
||||
@ -102,13 +93,13 @@ namespace osu.Game.Overlays.Mods
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user