mirror of
https://github.com/ppy/osu.git
synced 2024-11-06 06:57:39 +08:00
Changed Mods to be a property
This commit is contained in:
parent
105048500a
commit
586a652b08
@ -1,13 +1,13 @@
|
||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using OpenTK;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Game.Rulesets.Mods;
|
||||
using osu.Game.Rulesets.Osu.Mods;
|
||||
using osu.Game.Rulesets.Scoring;
|
||||
using osu.Game.Screens.Select.Leaderboards;
|
||||
using osu.Game.Users;
|
||||
using OpenTK;
|
||||
|
||||
namespace osu.Desktop.Tests.Visual
|
||||
{
|
||||
|
@ -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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user