mirror of
https://github.com/ppy/osu.git
synced 2025-01-30 04:42:55 +08:00
Merge pull request #31138 from bdach/mark-as-played
Implement ability to mark beatmap as played
This commit is contained in:
commit
62e536baf6
@ -533,6 +533,16 @@ namespace osu.Game.Beatmaps
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void MarkPlayed(BeatmapInfo beatmapSetInfo) => Realm.Run(r =>
|
||||||
|
{
|
||||||
|
using var transaction = r.BeginWrite();
|
||||||
|
|
||||||
|
var beatmap = r.Find<BeatmapInfo>(beatmapSetInfo.ID)!;
|
||||||
|
beatmap.LastPlayed = DateTimeOffset.Now;
|
||||||
|
|
||||||
|
transaction.Commit();
|
||||||
|
});
|
||||||
|
|
||||||
#region Implementation of ICanAcceptFiles
|
#region Implementation of ICanAcceptFiles
|
||||||
|
|
||||||
public Task Import(params string[] paths) => beatmapImporter.Import(paths);
|
public Task Import(params string[] paths) => beatmapImporter.Import(paths);
|
||||||
|
@ -88,6 +88,9 @@ namespace osu.Game.Screens.Select.Carousel
|
|||||||
[Resolved]
|
[Resolved]
|
||||||
private OsuGame? game { get; set; }
|
private OsuGame? game { get; set; }
|
||||||
|
|
||||||
|
[Resolved]
|
||||||
|
private BeatmapManager? manager { get; set; }
|
||||||
|
|
||||||
private IBindable<StarDifficulty?> starDifficultyBindable = null!;
|
private IBindable<StarDifficulty?> starDifficultyBindable = null!;
|
||||||
private CancellationTokenSource? starDifficultyCancellationSource;
|
private CancellationTokenSource? starDifficultyCancellationSource;
|
||||||
|
|
||||||
@ -98,7 +101,7 @@ namespace osu.Game.Screens.Select.Carousel
|
|||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(BeatmapManager? manager, SongSelect? songSelect)
|
private void load(SongSelect? songSelect)
|
||||||
{
|
{
|
||||||
Header.Height = height;
|
Header.Height = height;
|
||||||
|
|
||||||
@ -300,6 +303,9 @@ namespace osu.Game.Screens.Select.Carousel
|
|||||||
if (beatmapInfo.GetOnlineURL(api, ruleset.Value) is string url)
|
if (beatmapInfo.GetOnlineURL(api, ruleset.Value) is string url)
|
||||||
items.Add(new OsuMenuItem(CommonStrings.CopyLink, MenuItemType.Standard, () => game?.CopyUrlToClipboard(url)));
|
items.Add(new OsuMenuItem(CommonStrings.CopyLink, MenuItemType.Standard, () => game?.CopyUrlToClipboard(url)));
|
||||||
|
|
||||||
|
if (manager != null)
|
||||||
|
items.Add(new OsuMenuItem("Mark as played", MenuItemType.Standard, () => manager.MarkPlayed(beatmapInfo)));
|
||||||
|
|
||||||
if (hideRequested != null)
|
if (hideRequested != null)
|
||||||
items.Add(new OsuMenuItem(WebCommonStrings.ButtonsHide.ToSentence(), MenuItemType.Destructive, () => hideRequested(beatmapInfo)));
|
items.Add(new OsuMenuItem(WebCommonStrings.ButtonsHide.ToSentence(), MenuItemType.Destructive, () => hideRequested(beatmapInfo)));
|
||||||
|
|
||||||
|
@ -378,7 +378,7 @@ namespace osu.Game.Screens.Select
|
|||||||
|
|
||||||
BeatmapOptions.AddButton(@"Manage", @"collections", FontAwesome.Solid.Book, colours.Green, () => manageCollectionsDialog?.Show());
|
BeatmapOptions.AddButton(@"Manage", @"collections", FontAwesome.Solid.Book, colours.Green, () => manageCollectionsDialog?.Show());
|
||||||
BeatmapOptions.AddButton(@"Delete", @"all difficulties", FontAwesome.Solid.Trash, colours.Pink, () => DeleteBeatmap(Beatmap.Value.BeatmapSetInfo));
|
BeatmapOptions.AddButton(@"Delete", @"all difficulties", FontAwesome.Solid.Trash, colours.Pink, () => DeleteBeatmap(Beatmap.Value.BeatmapSetInfo));
|
||||||
BeatmapOptions.AddButton(@"Remove", @"from unplayed", FontAwesome.Regular.TimesCircle, colours.Purple, null);
|
BeatmapOptions.AddButton(@"Mark", @"as played", FontAwesome.Regular.TimesCircle, colours.Purple, () => beatmaps.MarkPlayed(Beatmap.Value.BeatmapInfo));
|
||||||
BeatmapOptions.AddButton(@"Clear", @"local scores", FontAwesome.Solid.Eraser, colours.Purple, () => ClearScores(Beatmap.Value.BeatmapInfo));
|
BeatmapOptions.AddButton(@"Clear", @"local scores", FontAwesome.Solid.Eraser, colours.Purple, () => ClearScores(Beatmap.Value.BeatmapInfo));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user