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:
parent
fda45997db
commit
9b4bed2ab2
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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.
|
||||
|
@ -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();
|
||||
}
|
||||
|
@ -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; }
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user