1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 21:43:04 +08:00

Merge pull request #9536 from Joehuu/select-mods-from-score

Add ability to select mods from a specific score in song select
This commit is contained in:
Dan Balasescu 2020-07-13 14:32:14 +09:00 committed by GitHub
commit 744e695174
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 26 additions and 19 deletions

View File

@ -170,7 +170,11 @@ namespace osu.Game.Online.Leaderboards
{ {
InternalChildren = new Drawable[] InternalChildren = new Drawable[]
{ {
new GridContainer new OsuContextMenuContainer
{
RelativeSizeAxes = Axes.Both,
Masking = true,
Child = new GridContainer
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
RowDimensions = new[] RowDimensions = new[]
@ -182,15 +186,11 @@ namespace osu.Game.Online.Leaderboards
{ {
new Drawable[] new Drawable[]
{ {
new OsuContextMenuContainer scrollContainer = new OsuScrollContainer
{
RelativeSizeAxes = Axes.Both,
Child = scrollContainer = new OsuScrollContainer
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
ScrollbarVisible = false, ScrollbarVisible = false,
} }
}
}, },
new Drawable[] new Drawable[]
{ {
@ -202,6 +202,7 @@ namespace osu.Game.Online.Leaderboards
} }
}, },
}, },
},
loading = new LoadingSpinner(), loading = new LoadingSpinner(),
placeholderContainer = new Container placeholderContainer = new Container
{ {

View File

@ -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,6 +376,9 @@ 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) && songSelect != null)
items.Add(new OsuMenuItem("Use these mods", MenuItemType.Highlighted, () => songSelect.Mods.Value = score.Mods));
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))));