From 53d6d74537c67512d7afc57746306fcdf6716243 Mon Sep 17 00:00:00 2001 From: naoey Date: Wed, 26 Jun 2019 21:10:21 +0530 Subject: [PATCH] Update to match upstream changes --- .../Online/API/Requests/DownloadReplayRequest.cs | 6 ++++-- osu.Game/Scoring/ScoreManager.cs | 4 ++-- osu.Game/Screens/Play/ReplayDownloadButton.cs | 14 ++++++++------ 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/osu.Game/Online/API/Requests/DownloadReplayRequest.cs b/osu.Game/Online/API/Requests/DownloadReplayRequest.cs index 11747f4f5f..0eacb4ed7b 100644 --- a/osu.Game/Online/API/Requests/DownloadReplayRequest.cs +++ b/osu.Game/Online/API/Requests/DownloadReplayRequest.cs @@ -1,13 +1,15 @@ using osu.Game.Scoring; namespace osu.Game.Online.API.Requests { - public class DownloadReplayRequest : ArchiveDownloadModelRequest + public class DownloadReplayRequest : ArchiveDownloadRequest { public DownloadReplayRequest(ScoreInfo score) : base(score) { } - protected override string Target => $@"scores/{Info.Ruleset.ShortName}/{Info.OnlineScoreID}/download"; + protected override string FileExtension => ".osr"; + + protected override string Target => $@"scores/{Model.Ruleset.ShortName}/{Model.OnlineScoreID}/download"; } } diff --git a/osu.Game/Scoring/ScoreManager.cs b/osu.Game/Scoring/ScoreManager.cs index 6d2ade5ecd..33be8c41ef 100644 --- a/osu.Game/Scoring/ScoreManager.cs +++ b/osu.Game/Scoring/ScoreManager.cs @@ -18,7 +18,7 @@ using osu.Game.Scoring.Legacy; namespace osu.Game.Scoring { - public class ScoreManager : ArchiveDownloadModelManager + public class ScoreManager : DownloadableArchiveModelManager { public override string[] HandledExtensions => new[] { ".osr" }; @@ -63,6 +63,6 @@ namespace osu.Game.Scoring public ScoreInfo Query(Expression> query) => ModelStore.ConsumableItems.AsNoTracking().FirstOrDefault(query); - protected override ArchiveDownloadModelRequest CreateDownloadRequest(ScoreInfo score, object[] options) => new DownloadReplayRequest(score); + protected override ArchiveDownloadRequest CreateDownloadRequest(ScoreInfo score, bool minimiseDownload) => new DownloadReplayRequest(score); } } diff --git a/osu.Game/Screens/Play/ReplayDownloadButton.cs b/osu.Game/Screens/Play/ReplayDownloadButton.cs index 14a6f942eb..51061e0660 100644 --- a/osu.Game/Screens/Play/ReplayDownloadButton.cs +++ b/osu.Game/Screens/Play/ReplayDownloadButton.cs @@ -35,18 +35,20 @@ namespace osu.Game.Screens.Play private void onReplay() { - if (scores.IsAvailableLocally(ModelInfo.Value)) + if (scores.IsAvailableLocally(Model.Value)) { - game.PresentScore(ModelInfo.Value); + game.PresentScore(Model.Value); return; } - scores.Download(ModelInfo.Value); + scores.Download(Model.Value); - scores.ItemAdded += (score, _) => + scores.ItemAdded += score => { - if (score.Equals(ModelInfo.Value)) - game.PresentScore(ModelInfo.Value); + if (score.Equals(Model.Value)) + // use the newly added score instead of ModelInfo.Score because that won't have the Files property populated + game.PresentScore(score); + //ReplayLoaded?.Invoke(scores.GetScore(score)); }; } }