1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 20:07:29 +08:00

Assign a score's beatmap and cleanup to the Score class

This commit is contained in:
MrTheMake 2017-08-14 13:30:54 +02:00
parent 718eefa362
commit 920710e7d0
2 changed files with 5 additions and 19 deletions

View File

@ -28,19 +28,8 @@ namespace osu.Game.Rulesets.Scoring
public int Combo { get; set; }
private string[] modStrings;
[JsonProperty(@"mods")]
protected string[] ModStrings
{
get { return modStrings; }
set
{
modStrings = value;
if (ruleset != null)
handleModString();
}
}
protected string[] ModStrings { get; set; }
private RulesetInfo ruleset;
public RulesetInfo Ruleset
@ -50,8 +39,9 @@ namespace osu.Game.Rulesets.Scoring
{
ruleset = value;
if (modStrings != null)
handleModString();
// Handle the mod strings if they are assigned
if (ModStrings != null)
Mods = Ruleset.CreateInstance().GetAllMods().Where(mod => ModStrings.Contains(mod.ShortenedName)).ToArray();
}
}
@ -103,10 +93,5 @@ namespace osu.Game.Rulesets.Scoring
}
public Dictionary<string, dynamic> Statistics = new Dictionary<string, dynamic>();
private void handleModString()
{
Mods = Ruleset.CreateInstance().GetAllMods().Where(mod => modStrings.Contains(mod.ShortenedName)).ToArray();
}
}
}

View File

@ -55,6 +55,7 @@ namespace osu.Game.Screens.Select.Leaderboards
i = 0;
foreach (var s in scores)
{
s.Beatmap = beatmap;
s.Ruleset = beatmap?.Ruleset;
var ls = new LeaderboardScore(s, 1 + i)