mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 19:27:26 +08:00
Assign a score's beatmap and cleanup to the Score class
This commit is contained in:
parent
718eefa362
commit
920710e7d0
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user