Formatted and commented the GetAllMods() function

This commit is contained in:
MrTheMake 2017-08-15 12:03:43 +02:00
parent e908a3675e
commit 21ced32297
1 changed files with 8 additions and 1 deletions

View File

@ -21,7 +21,14 @@ public abstract class Ruleset
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);