1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-15 21:42:55 +08:00

Simplify and add null check

This commit is contained in:
Joehu 2020-07-12 12:04:53 -07:00
parent 25d2d9ba5c
commit 9c039848bc
4 changed files with 7 additions and 8 deletions

View File

@ -388,9 +388,8 @@ namespace osu.Game.Online.Leaderboards
private void getMods()
{
songSelect.ModSelect.DeselectAll(true);
songSelect.Mods.Value = score.Mods;
if (songSelect != null)
songSelect.Mods.Value = score.Mods;
}
}
}

View File

@ -95,7 +95,7 @@ namespace osu.Game.Overlays.Mods
return base.OnKeyDown(e);
}
public void DeselectAll(bool immediate = false) => DeselectTypes(buttons.Select(b => b.SelectedMod?.GetType()).Where(t => t != null), immediate);
public void DeselectAll() => DeselectTypes(buttons.Select(b => b.SelectedMod?.GetType()).Where(t => t != null));
/// <summary>
/// Deselect one or more mods in this section.

View File

@ -231,7 +231,7 @@ namespace osu.Game.Overlays.Mods
{
Width = 180,
Text = "Deselect All",
Action = () => DeselectAll(),
Action = DeselectAll,
Origin = Anchor.CentreLeft,
Anchor = Anchor.CentreLeft,
},
@ -328,10 +328,10 @@ namespace osu.Game.Overlays.Mods
sampleOff = audio.Samples.Get(@"UI/check-off");
}
public void DeselectAll(bool immediate = false)
public void DeselectAll()
{
foreach (var section in ModSectionsContainer.Children)
section.DeselectAll(immediate);
section.DeselectAll();
refreshSelectedMods();
}

View File

@ -86,7 +86,7 @@ namespace osu.Game.Screens.Select
[Resolved]
private BeatmapManager beatmaps { get; set; }
public ModSelectOverlay ModSelect { get; private set; }
protected ModSelectOverlay ModSelect { get; private set; }
protected SampleChannel SampleConfirm { get; private set; }