1
0
mirror of https://github.com/ppy/osu.git synced 2025-03-05 07:42:54 +08:00
This commit is contained in:
Dean Herbert 2017-04-24 20:16:31 +09:00
parent 8b048a6706
commit 9670ea9a2a
2 changed files with 6 additions and 21 deletions

View File

@ -1,11 +1,9 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System.Collections.Generic;
using Newtonsoft.Json;
using osu.Framework.IO.Network;
using osu.Game.Database;
using osu.Game.Rulesets.Scoring;
namespace osu.Game.Online.API.Requests
{
@ -13,25 +11,13 @@ namespace osu.Game.Online.API.Requests
{
private readonly BeatmapInfo beatmap;
private string lookupString;
private string lookupString => beatmap.OnlineBeatmapID > 0 ? beatmap.OnlineBeatmapID.ToString() : $@"lookup?checksum={beatmap.Hash}&filename={beatmap.Path}";
public GetBeatmapDetailsRequest(BeatmapInfo beatmap)
{
this.beatmap = beatmap;
}
protected override WebRequest CreateWebRequest()
{
if (beatmap.OnlineBeatmapID > 0)
lookupString = beatmap.OnlineBeatmapID.ToString();
else
lookupString = $@"lookup?checksum={beatmap.Hash}&filename={beatmap.Path}";
var req = base.CreateWebRequest();
return req;
}
protected override string Target => $@"beatmaps/{lookupString}";
}
@ -43,8 +29,8 @@ namespace osu.Game.Online.API.Requests
{
set
{
this.Fails = value.Fails;
this.Retries = value.Retries;
Fails = value.Fails;
Retries = value.Retries;
}
}
@ -54,7 +40,7 @@ namespace osu.Game.Online.API.Requests
{
set
{
this.Ratings = value.Ratings;
Ratings = value.Ratings;
}
}
}

View File

@ -17,7 +17,6 @@ using System.Linq;
using osu.Game.Online.API;
using osu.Game.Online.API.Requests;
using osu.Framework.Threading;
using System;
namespace osu.Game.Screens.Select
{
@ -83,9 +82,9 @@ namespace osu.Game.Screens.Select
return;
requestedBeatmap.Metrics = res;
Schedule(() => updateMetrics(res, true));
Schedule(() => updateMetrics(res));
};
lookup.Failure += e => updateMetrics(null, true);
lookup.Failure += e => updateMetrics(null);
api.Queue(lookup);
}