mirror of
https://github.com/osukey/osukey.git
synced 2025-08-03 06:36:31 +09:00
Changed Mods to be a property
This commit is contained in:
@ -31,22 +31,28 @@ namespace osu.Game.Rulesets.Scoring
|
||||
[JsonProperty(@"mods")]
|
||||
private string[] modStrings { get; set; }
|
||||
|
||||
private RulesetInfo ruleset;
|
||||
public RulesetInfo Ruleset
|
||||
public RulesetInfo Ruleset;
|
||||
|
||||
private Mod[] mods;
|
||||
public Mod[] Mods
|
||||
{
|
||||
get { return ruleset; }
|
||||
get
|
||||
{
|
||||
// Evaluate the mod strings
|
||||
if (mods == null)
|
||||
mods = Ruleset.CreateInstance().GetAllMods().Where(mod => modStrings.Contains(mod.ShortenedName)).ToArray();
|
||||
|
||||
return mods;
|
||||
}
|
||||
set
|
||||
{
|
||||
ruleset = value;
|
||||
mods = value;
|
||||
|
||||
// Handle the mod strings if they are assigned
|
||||
if (modStrings != null)
|
||||
Mods = ruleset.CreateInstance().GetAllMods().Where(mod => modStrings.Contains(mod.ShortenedName)).ToArray();
|
||||
// Assign the mod strings
|
||||
modStrings = mods.Select(mod => mod.ShortenedName).ToArray();
|
||||
}
|
||||
}
|
||||
|
||||
public Mod[] Mods { get; set; }
|
||||
|
||||
[JsonProperty(@"user")]
|
||||
public User User;
|
||||
|
||||
|
Reference in New Issue
Block a user