1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-27 14:52:55 +08:00

Formatted and commented the GetAllMods() function

This commit is contained in:
MrTheMake 2017-08-15 12:03:43 +02:00
parent e908a3675e
commit 21ced32297

View File

@ -21,7 +21,14 @@ namespace osu.Game.Rulesets
public virtual IEnumerable<BeatmapStatistic> GetBeatmapStatistics(WorkingBeatmap beatmap) => new BeatmapStatistic[] { };
public IEnumerable<Mod> GetAllMods() => Enum.GetValues(typeof(ModType)).Cast<ModType>().SelectMany(type => GetModsFor(type).Where(mod => mod != null).SelectMany(mod => (mod as MultiMod)?.Mods ?? new[] { mod }));
public IEnumerable<Mod> GetAllMods() => Enum.GetValues(typeof(ModType)).Cast<ModType>()
//Get all mod types as an IEnumerable<ModType>
.SelectMany(type => GetModsFor(type))
// Confine all mods of each mod type into a single IEnumerable<Mod>
.Where(mod => mod != null)
// Filter out all null mods
.SelectMany(mod => (mod as MultiMod)?.Mods ?? new[] { mod });
// Resolve MultiMods as their .Mods property
public abstract IEnumerable<Mod> GetModsFor(ModType type);