mirror of
https://github.com/ppy/osu
synced 2024-12-15 03:16:17 +00:00
Convert into auto-property
This commit is contained in:
parent
f6eb9037df
commit
54c904d439
@ -45,18 +45,12 @@ namespace osu.Game.Screens.SelectV2.Leaderboards
|
||||
{
|
||||
public Bindable<IReadOnlyList<Mod>> SelectedMods = new Bindable<IReadOnlyList<Mod>>();
|
||||
|
||||
private Func<Mod, bool> isValidMod = _ => true;
|
||||
|
||||
/// <summary>
|
||||
/// A function determining whether each mod in the score can be selected.
|
||||
/// A return value of <see langword="true"/> means that the mod can be selected in the current context.
|
||||
/// A return value of <see langword="false"/> means that the mod cannot be selected in the current context.
|
||||
/// </summary>
|
||||
public Func<Mod, bool> IsValidMod
|
||||
{
|
||||
get => isValidMod;
|
||||
set => isValidMod = value ?? throw new ArgumentNullException(nameof(value));
|
||||
}
|
||||
public Func<Mod, bool> IsValidMod { get; set; } = _ => true;
|
||||
|
||||
public int? Rank { get; init; }
|
||||
public bool IsPersonalBest { get; init; }
|
||||
@ -751,7 +745,7 @@ namespace osu.Game.Screens.SelectV2.Leaderboards
|
||||
List<MenuItem> items = new List<MenuItem>();
|
||||
|
||||
if (score.Mods.Length > 0)
|
||||
items.Add(new OsuMenuItem("Use these mods", MenuItemType.Highlighted, () => SelectedMods.Value = score.Mods.Where(m => isValidMod.Invoke(m)).ToArray()));
|
||||
items.Add(new OsuMenuItem("Use these mods", MenuItemType.Highlighted, () => SelectedMods.Value = score.Mods.Where(m => IsValidMod.Invoke(m)).ToArray()));
|
||||
|
||||
if (score.Files.Count <= 0) return items.ToArray();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user