mirror of
https://github.com/ppy/osu.git
synced 2024-11-06 11:27:24 +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>.
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
|
using OpenTK;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Game.Rulesets.Mods;
|
using osu.Game.Rulesets.Mods;
|
||||||
using osu.Game.Rulesets.Osu.Mods;
|
using osu.Game.Rulesets.Osu.Mods;
|
||||||
using osu.Game.Rulesets.Scoring;
|
using osu.Game.Rulesets.Scoring;
|
||||||
using osu.Game.Screens.Select.Leaderboards;
|
using osu.Game.Screens.Select.Leaderboards;
|
||||||
using osu.Game.Users;
|
using osu.Game.Users;
|
||||||
using OpenTK;
|
|
||||||
|
|
||||||
namespace osu.Desktop.Tests.Visual
|
namespace osu.Desktop.Tests.Visual
|
||||||
{
|
{
|
||||||
|
@ -31,22 +31,28 @@ namespace osu.Game.Rulesets.Scoring
|
|||||||
[JsonProperty(@"mods")]
|
[JsonProperty(@"mods")]
|
||||||
private string[] modStrings { get; set; }
|
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
|
set
|
||||||
{
|
{
|
||||||
ruleset = value;
|
mods = value;
|
||||||
|
|
||||||
// Handle the mod strings if they are assigned
|
// Assign the mod strings
|
||||||
if (modStrings != null)
|
modStrings = mods.Select(mod => mod.ShortenedName).ToArray();
|
||||||
Mods = ruleset.CreateInstance().GetAllMods().Where(mod => modStrings.Contains(mod.ShortenedName)).ToArray();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Mod[] Mods { get; set; }
|
|
||||||
|
|
||||||
[JsonProperty(@"user")]
|
[JsonProperty(@"user")]
|
||||||
public User User;
|
public User User;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user