mirror of
https://github.com/osukey/osukey.git
synced 2025-08-03 22:56:36 +09:00
Remove local score copying in GetScoresRequest
to allow APIScoreInfo.Beatmap
to be APIBeatmap
This commit is contained in:
@ -39,7 +39,7 @@ namespace osu.Game.Online.API.Requests.Responses
|
||||
public DateTimeOffset Date { get; set; }
|
||||
|
||||
[JsonProperty(@"beatmap")]
|
||||
public IBeatmapInfo Beatmap { get; set; }
|
||||
public APIBeatmap Beatmap { get; set; }
|
||||
|
||||
[JsonProperty("accuracy")]
|
||||
public double Accuracy { get; set; }
|
||||
@ -71,10 +71,8 @@ namespace osu.Game.Online.API.Requests.Responses
|
||||
[JsonConverter(typeof(StringEnumConverter))]
|
||||
public ScoreRank Rank { get; set; }
|
||||
|
||||
IBeatmapInfo IScoreInfo.Beatmap => Beatmap;
|
||||
|
||||
// TODO: nuke
|
||||
public ScoreInfo CreateScoreInfo(RulesetStore rulesets)
|
||||
// TODO: This function will eventually be going away.
|
||||
public ScoreInfo CreateScoreInfo(RulesetStore rulesets, BeatmapInfo beatmap = null)
|
||||
{
|
||||
var ruleset = rulesets.GetRuleset(OnlineRulesetID);
|
||||
|
||||
@ -94,7 +92,6 @@ namespace osu.Game.Online.API.Requests.Responses
|
||||
OnlineScoreID = OnlineID,
|
||||
Date = Date,
|
||||
PP = PP,
|
||||
BeatmapInfo = Beatmap.ToBeatmapInfo(rulesets),
|
||||
RulesetID = OnlineRulesetID,
|
||||
Hash = Replay ? "online" : string.Empty, // todo: temporary?
|
||||
Rank = Rank,
|
||||
@ -102,6 +99,9 @@ namespace osu.Game.Online.API.Requests.Responses
|
||||
Mods = mods,
|
||||
};
|
||||
|
||||
if (beatmap != null)
|
||||
scoreInfo.BeatmapInfo = beatmap;
|
||||
|
||||
if (Statistics != null)
|
||||
{
|
||||
foreach (var kvp in Statistics)
|
||||
@ -138,19 +138,10 @@ namespace osu.Game.Online.API.Requests.Responses
|
||||
return scoreInfo;
|
||||
}
|
||||
|
||||
[JsonProperty(@"beatmapset")]
|
||||
public APIBeatmapSet Metadata
|
||||
{
|
||||
set
|
||||
{
|
||||
// in the deserialisation case we need to ferry this data across.
|
||||
if (Beatmap is APIBeatmap apiBeatmap)
|
||||
apiBeatmap.BeatmapSet = value;
|
||||
}
|
||||
}
|
||||
|
||||
public IRulesetInfo Ruleset => new RulesetInfo { ID = OnlineRulesetID };
|
||||
|
||||
IBeatmapInfo IScoreInfo.Beatmap => Beatmap;
|
||||
|
||||
Dictionary<HitResult, int> IScoreInfo.Statistics => new Dictionary<HitResult, int>(); // TODO: implement... maybe. hitresults have weird mappings per ruleset it would seem.
|
||||
}
|
||||
}
|
||||
|
@ -2,6 +2,7 @@
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using Newtonsoft.Json;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Rulesets;
|
||||
using osu.Game.Scoring;
|
||||
|
||||
@ -15,10 +16,10 @@ namespace osu.Game.Online.API.Requests.Responses
|
||||
[JsonProperty(@"score")]
|
||||
public APIScoreInfo Score;
|
||||
|
||||
public ScoreInfo CreateScoreInfo(RulesetStore rulesets)
|
||||
public ScoreInfo CreateScoreInfo(RulesetStore rulesets, BeatmapInfo beatmap = null)
|
||||
|
||||
{
|
||||
var score = Score.CreateScoreInfo(rulesets);
|
||||
var score = Score.CreateScoreInfo(rulesets, beatmap);
|
||||
score.Position = Position;
|
||||
return score;
|
||||
}
|
||||
|
Reference in New Issue
Block a user