mirror of
https://github.com/ppy/osu.git
synced 2025-01-29 06:33:21 +08:00
Update to match upstream changes
This commit is contained in:
parent
ab0bb8b678
commit
53d6d74537
@ -1,13 +1,15 @@
|
|||||||
using osu.Game.Scoring;
|
using osu.Game.Scoring;
|
||||||
namespace osu.Game.Online.API.Requests
|
namespace osu.Game.Online.API.Requests
|
||||||
{
|
{
|
||||||
public class DownloadReplayRequest : ArchiveDownloadModelRequest<ScoreInfo>
|
public class DownloadReplayRequest : ArchiveDownloadRequest<ScoreInfo>
|
||||||
{
|
{
|
||||||
public DownloadReplayRequest(ScoreInfo score)
|
public DownloadReplayRequest(ScoreInfo score)
|
||||||
: base(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";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,7 @@ using osu.Game.Scoring.Legacy;
|
|||||||
|
|
||||||
namespace osu.Game.Scoring
|
namespace osu.Game.Scoring
|
||||||
{
|
{
|
||||||
public class ScoreManager : ArchiveDownloadModelManager<ScoreInfo, ScoreFileInfo>
|
public class ScoreManager : DownloadableArchiveModelManager<ScoreInfo, ScoreFileInfo>
|
||||||
{
|
{
|
||||||
public override string[] HandledExtensions => new[] { ".osr" };
|
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);
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -35,18 +35,20 @@ namespace osu.Game.Screens.Play
|
|||||||
|
|
||||||
private void onReplay()
|
private void onReplay()
|
||||||
{
|
{
|
||||||
if (scores.IsAvailableLocally(ModelInfo.Value))
|
if (scores.IsAvailableLocally(Model.Value))
|
||||||
{
|
{
|
||||||
game.PresentScore(ModelInfo.Value);
|
game.PresentScore(Model.Value);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
scores.Download(ModelInfo.Value);
|
scores.Download(Model.Value);
|
||||||
|
|
||||||
scores.ItemAdded += (score, _) =>
|
scores.ItemAdded += score =>
|
||||||
{
|
{
|
||||||
if (score.Equals(ModelInfo.Value))
|
if (score.Equals(Model.Value))
|
||||||
game.PresentScore(ModelInfo.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));
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user