Convert into auto-property

This commit is contained in:
Bartłomiej Dach 2024-07-29 10:40:29 +02:00
parent f6eb9037df
commit 54c904d439
No known key found for this signature in database

View File

@ -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();