1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 12:57:36 +08:00

Update to match upstream changes

This commit is contained in:
naoey 2019-06-26 21:10:21 +05:30
parent ab0bb8b678
commit 53d6d74537
No known key found for this signature in database
GPG Key ID: 670DA9BE3DF7EE60
3 changed files with 14 additions and 10 deletions

View File

@ -1,13 +1,15 @@
using osu.Game.Scoring;
namespace osu.Game.Online.API.Requests
{
public class DownloadReplayRequest : ArchiveDownloadModelRequest<ScoreInfo>
public class DownloadReplayRequest : ArchiveDownloadRequest<ScoreInfo>
{
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";
}
}

View File

@ -18,7 +18,7 @@ using osu.Game.Scoring.Legacy;
namespace osu.Game.Scoring
{
public class ScoreManager : ArchiveDownloadModelManager<ScoreInfo, ScoreFileInfo>
public class ScoreManager : DownloadableArchiveModelManager<ScoreInfo, ScoreFileInfo>
{
public override string[] HandledExtensions => new[] { ".osr" };
@ -63,6 +63,6 @@ namespace osu.Game.Scoring
public ScoreInfo Query(Expression<Func<ScoreInfo, bool>> query) => ModelStore.ConsumableItems.AsNoTracking().FirstOrDefault(query);
protected override ArchiveDownloadModelRequest<ScoreInfo> CreateDownloadRequest(ScoreInfo score, object[] options) => new DownloadReplayRequest(score);
protected override ArchiveDownloadRequest<ScoreInfo> CreateDownloadRequest(ScoreInfo score, bool minimiseDownload) => new DownloadReplayRequest(score);
}
}

View File

@ -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));
};
}
}