1
0
mirror of https://github.com/ppy/osu synced 2025-03-30 15:17:22 +00:00

Addresses requested changes

This commit is contained in:
Microgolf 2019-01-08 17:57:03 +01:00
parent 42ba690809
commit 097062caf7
4 changed files with 10 additions and 9 deletions

View File

@ -55,7 +55,9 @@ namespace osu.Game.Scoring
public Score GetScore(ScoreInfo score) => new LegacyDatabasedScore(score, rulesets, beatmaps, Files.Store); public Score GetScore(ScoreInfo score) => new LegacyDatabasedScore(score, rulesets, beatmaps, Files.Store);
public IEnumerable<ScoreInfo> GetAllUsableScores() => ModelStore.ConsumableItems.Where(s => !s.DeletePending); public List<ScoreInfo> GetAllUsableScores() => ModelStore.ConsumableItems.Where(s => !s.DeletePending).ToList();
public IEnumerable<ScoreInfo> QueryScores(Expression<Func<ScoreInfo, bool>> query) => ModelStore.ConsumableItems.AsNoTracking().Where(query);
public ScoreInfo Query(Expression<Func<ScoreInfo, bool>> query) => ModelStore.ConsumableItems.AsNoTracking().FirstOrDefault(query); public ScoreInfo Query(Expression<Func<ScoreInfo, bool>> query) => ModelStore.ConsumableItems.AsNoTracking().FirstOrDefault(query);
} }

View File

@ -22,12 +22,11 @@ namespace osu.Game.Screens.Select
manager = scoreManager; manager = scoreManager;
} }
public BeatmapClearScoresDialog(BeatmapSetInfo beatmap, IEnumerable<ScoreInfo> scores, Action refresh) public BeatmapClearScoresDialog(BeatmapInfo beatmap, Action refresh)
{ {
BodyText = $@"{beatmap.Metadata?.Artist} - {beatmap.Metadata?.Title}"; BodyText = $@"{beatmap.Metadata?.Artist} - {beatmap.Metadata?.Title}";
Icon = FontAwesome.fa_eraser; Icon = FontAwesome.fa_eraser;
HeaderText = $@"Clearing {scores.Count()} local score(s). Are you sure?"; HeaderText = $@"Clearing all local scores. Are you sure?";
Buttons = new PopupDialogButton[] Buttons = new PopupDialogButton[]
{ {
new PopupDialogOkButton new PopupDialogOkButton
@ -35,7 +34,7 @@ namespace osu.Game.Screens.Select
Text = @"Yes. Please.", Text = @"Yes. Please.",
Action = () => Action = () =>
{ {
manager.Delete(scores.ToList()); manager.Delete(manager.QueryScores(s => !s.DeletePending && s.Beatmap.ID == beatmap.ID).ToList());
refresh(); refresh();
} }
}, },

View File

@ -55,7 +55,7 @@ namespace osu.Game.Screens.Select.Leaderboards
{ {
if (Scope == BeatmapLeaderboardScope.Local) if (Scope == BeatmapLeaderboardScope.Local)
{ {
Scores = scoreManager.GetAllUsableScores().Where(s => s.Beatmap.ID == Beatmap.ID).ToArray(); Scores = scoreManager.QueryScores(s => !s.DeletePending && s.Beatmap.ID == Beatmap.ID).ToArray();
PlaceholderState = Scores.Any() ? PlaceholderState.Successful : PlaceholderState.NoScores; PlaceholderState = Scores.Any() ? PlaceholderState.Successful : PlaceholderState.NoScores;
return null; return null;
} }

View File

@ -228,7 +228,7 @@ namespace osu.Game.Screens.Select
BeatmapOptions.AddButton(@"Delete", @"all difficulties", FontAwesome.fa_trash, colours.Pink, () => delete(Beatmap.Value.BeatmapSetInfo), Key.Number4, float.MaxValue); BeatmapOptions.AddButton(@"Delete", @"all difficulties", FontAwesome.fa_trash, colours.Pink, () => delete(Beatmap.Value.BeatmapSetInfo), Key.Number4, float.MaxValue);
BeatmapOptions.AddButton(@"Remove", @"from unplayed", FontAwesome.fa_times_circle_o, colours.Purple, null, Key.Number1); BeatmapOptions.AddButton(@"Remove", @"from unplayed", FontAwesome.fa_times_circle_o, colours.Purple, null, Key.Number1);
BeatmapOptions.AddButton(@"Clear", @"local scores", FontAwesome.fa_eraser, colours.Purple, () => clearScores(Beatmap.Value.BeatmapSetInfo), Key.Number2); BeatmapOptions.AddButton(@"Clear", @"local scores", FontAwesome.fa_eraser, colours.Purple, () => clearScores(Beatmap.Value.BeatmapInfo), Key.Number2);
} }
if (this.beatmaps == null) if (this.beatmaps == null)
@ -626,7 +626,7 @@ namespace osu.Game.Screens.Select
dialogOverlay?.Push(new BeatmapDeleteDialog(beatmap)); dialogOverlay?.Push(new BeatmapDeleteDialog(beatmap));
} }
private void clearScores(BeatmapSetInfo beatmap) private void clearScores(BeatmapInfo beatmap)
{ {
if (BeatmapDetails.Leaderboard.Scope != BeatmapLeaderboardScope.Local) return; if (BeatmapDetails.Leaderboard.Scope != BeatmapLeaderboardScope.Local) return;
@ -634,7 +634,7 @@ namespace osu.Game.Screens.Select
if (BeatmapDetails.Leaderboard.Scores == null || !BeatmapDetails.Leaderboard.Scores.Any()) return; if (BeatmapDetails.Leaderboard.Scores == null || !BeatmapDetails.Leaderboard.Scores.Any()) return;
dialogOverlay?.Push(new BeatmapClearScoresDialog(beatmap, BeatmapDetails.Leaderboard.Scores, () => BeatmapDetails.Leaderboard.RefreshScores())); dialogOverlay?.Push(new BeatmapClearScoresDialog(beatmap, () => BeatmapDetails.Leaderboard.RefreshScores()));
} }
public override bool OnPressed(GlobalAction action) public override bool OnPressed(GlobalAction action)