mirror of
https://github.com/ppy/osu.git
synced 2025-01-28 12:32:56 +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)]
|
[Resolved(CanBeNull = true)]
|
||||||
private DialogOverlay dialogOverlay { get; set; }
|
private DialogOverlay dialogOverlay { get; set; }
|
||||||
|
|
||||||
|
[Resolved(CanBeNull = true)]
|
||||||
|
private SongSelect songSelect { get; set; }
|
||||||
|
|
||||||
public LeaderboardScore(ScoreInfo score, int? rank, bool allowHighlight = true)
|
public LeaderboardScore(ScoreInfo score, int? rank, bool allowHighlight = true)
|
||||||
{
|
{
|
||||||
this.score = score;
|
this.score = score;
|
||||||
@ -373,11 +376,21 @@ namespace osu.Game.Online.Leaderboards
|
|||||||
{
|
{
|
||||||
List<MenuItem> items = new List<MenuItem>();
|
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)
|
if (score.ID != 0)
|
||||||
items.Add(new OsuMenuItem("Delete", MenuItemType.Destructive, () => dialogOverlay?.Push(new LocalScoreDeleteDialog(score))));
|
items.Add(new OsuMenuItem("Delete", MenuItemType.Destructive, () => dialogOverlay?.Push(new LocalScoreDeleteDialog(score))));
|
||||||
|
|
||||||
return items.ToArray();
|
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);
|
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>
|
/// <summary>
|
||||||
/// Deselect one or more mods in this section.
|
/// Deselect one or more mods in this section.
|
||||||
|
@ -231,7 +231,7 @@ namespace osu.Game.Overlays.Mods
|
|||||||
{
|
{
|
||||||
Width = 180,
|
Width = 180,
|
||||||
Text = "Deselect All",
|
Text = "Deselect All",
|
||||||
Action = DeselectAll,
|
Action = () => DeselectAll(),
|
||||||
Origin = Anchor.CentreLeft,
|
Origin = Anchor.CentreLeft,
|
||||||
Anchor = Anchor.CentreLeft,
|
Anchor = Anchor.CentreLeft,
|
||||||
},
|
},
|
||||||
@ -328,10 +328,10 @@ namespace osu.Game.Overlays.Mods
|
|||||||
sampleOff = audio.Samples.Get(@"UI/check-off");
|
sampleOff = audio.Samples.Get(@"UI/check-off");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DeselectAll()
|
public void DeselectAll(bool immediate = false)
|
||||||
{
|
{
|
||||||
foreach (var section in ModSectionsContainer.Children)
|
foreach (var section in ModSectionsContainer.Children)
|
||||||
section.DeselectAll();
|
section.DeselectAll(immediate);
|
||||||
|
|
||||||
refreshSelectedMods();
|
refreshSelectedMods();
|
||||||
}
|
}
|
||||||
|
@ -86,7 +86,7 @@ namespace osu.Game.Screens.Select
|
|||||||
[Resolved]
|
[Resolved]
|
||||||
private BeatmapManager beatmaps { get; set; }
|
private BeatmapManager beatmaps { get; set; }
|
||||||
|
|
||||||
protected ModSelectOverlay ModSelect { get; private set; }
|
public ModSelectOverlay ModSelect { get; private set; }
|
||||||
|
|
||||||
protected SampleChannel SampleConfirm { get; private set; }
|
protected SampleChannel SampleConfirm { get; private set; }
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user