1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-14 03:25:11 +08:00

Add ability to select mods from a specific score

This commit is contained in:
Joehu 2020-07-11 16:02:47 -07:00
parent fda45997db
commit 9b4bed2ab2
4 changed files with 18 additions and 5 deletions

View File

@ -58,6 +58,9 @@ namespace osu.Game.Online.Leaderboards
[Resolved(CanBeNull = true)]
private DialogOverlay dialogOverlay { get; set; }
[Resolved(CanBeNull = true)]
private SongSelect songSelect { get; set; }
public LeaderboardScore(ScoreInfo score, int? rank, bool allowHighlight = true)
{
this.score = score;
@ -373,11 +376,21 @@ namespace osu.Game.Online.Leaderboards
{
List<MenuItem> items = new List<MenuItem>();
if (score.Mods.Length > 0 && modsContainer.Any(s => s.IsHovered))
items.Add(new OsuMenuItem("Use these mods", MenuItemType.Highlighted, () => getMods()));
if (score.ID != 0)
items.Add(new OsuMenuItem("Delete", MenuItemType.Destructive, () => dialogOverlay?.Push(new LocalScoreDeleteDialog(score))));
return items.ToArray();
}
}
private void getMods()
{
songSelect.ModSelect.DeselectAll(true);
songSelect.Mods.Value = score.Mods;
}
}
}

View File

@ -95,7 +95,7 @@ namespace osu.Game.Overlays.Mods
return base.OnKeyDown(e);
}
public void DeselectAll() => DeselectTypes(buttons.Select(b => b.SelectedMod?.GetType()).Where(t => t != null));
public void DeselectAll(bool immediate = false) => DeselectTypes(buttons.Select(b => b.SelectedMod?.GetType()).Where(t => t != null), immediate);
/// <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()
public void DeselectAll(bool immediate = false)
{
foreach (var section in ModSectionsContainer.Children)
section.DeselectAll();
section.DeselectAll(immediate);
refreshSelectedMods();
}

View File

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