mirror of
https://github.com/osukey/osukey.git
synced 2025-05-19 12:37:38 +09:00
Remove unnecessary constructure and make ruleset required
This commit is contained in:
parent
1b91f24044
commit
c871a25dfa
@ -21,16 +21,6 @@ namespace osu.Game.Online.API.Requests
|
|||||||
private readonly LeaderboardScope scope;
|
private readonly LeaderboardScope scope;
|
||||||
private readonly RulesetInfo ruleset;
|
private readonly RulesetInfo ruleset;
|
||||||
|
|
||||||
public GetScoresRequest(BeatmapInfo beatmap)
|
|
||||||
{
|
|
||||||
if (!beatmap.OnlineBeatmapID.HasValue)
|
|
||||||
throw new InvalidOperationException($"Cannot lookup a beatmap's scores without having a populated {nameof(BeatmapInfo.OnlineBeatmapID)}.");
|
|
||||||
|
|
||||||
this.beatmap = beatmap;
|
|
||||||
|
|
||||||
Success += onSuccess;
|
|
||||||
}
|
|
||||||
|
|
||||||
public GetScoresRequest(BeatmapInfo beatmap, RulesetInfo ruleset, LeaderboardScope scope = LeaderboardScope.Global)
|
public GetScoresRequest(BeatmapInfo beatmap, RulesetInfo ruleset, LeaderboardScope scope = LeaderboardScope.Global)
|
||||||
{
|
{
|
||||||
if (!beatmap.OnlineBeatmapID.HasValue)
|
if (!beatmap.OnlineBeatmapID.HasValue)
|
||||||
@ -41,7 +31,7 @@ namespace osu.Game.Online.API.Requests
|
|||||||
|
|
||||||
this.beatmap = beatmap;
|
this.beatmap = beatmap;
|
||||||
this.scope = scope;
|
this.scope = scope;
|
||||||
this.ruleset = ruleset;
|
this.ruleset = ruleset ?? throw new ArgumentNullException(nameof(ruleset));
|
||||||
|
|
||||||
Success += onSuccess;
|
Success += onSuccess;
|
||||||
}
|
}
|
||||||
@ -57,7 +47,7 @@ namespace osu.Game.Online.API.Requests
|
|||||||
var req = base.CreateWebRequest();
|
var req = base.CreateWebRequest();
|
||||||
|
|
||||||
req.AddParameter(@"type", scope.ToString().ToLowerInvariant());
|
req.AddParameter(@"type", scope.ToString().ToLowerInvariant());
|
||||||
req.AddParameter(@"mode", ruleset?.ShortName ?? @"osu");
|
req.AddParameter(@"mode", ruleset.ShortName);
|
||||||
|
|
||||||
return req;
|
return req;
|
||||||
}
|
}
|
||||||
|
@ -244,7 +244,7 @@ namespace osu.Game.Tests.Visual
|
|||||||
if (!api.IsLoggedIn)
|
if (!api.IsLoggedIn)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
lastRequest = new GetScoresRequest(newBeatmap.BeatmapInfo);
|
lastRequest = new GetScoresRequest(newBeatmap.BeatmapInfo, newBeatmap.BeatmapInfo.Ruleset);
|
||||||
lastRequest.Success += res => res.Scores.ForEach(s => scores.Add(new PerformanceDisplay(s, newBeatmap.Beatmap)));
|
lastRequest.Success += res => res.Scores.ForEach(s => scores.Add(new PerformanceDisplay(s, newBeatmap.Beatmap)));
|
||||||
api.Queue(lastRequest);
|
api.Queue(lastRequest);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user