mirror of
https://github.com/ppy/osu.git
synced 2025-02-06 03:02:59 +08:00
Formatted and commented the GetAllMods() function
This commit is contained in:
parent
e908a3675e
commit
21ced32297
@ -21,7 +21,14 @@ namespace osu.Game.Rulesets
|
|||||||
|
|
||||||
public virtual IEnumerable<BeatmapStatistic> GetBeatmapStatistics(WorkingBeatmap beatmap) => new BeatmapStatistic[] { };
|
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);
|
public abstract IEnumerable<Mod> GetModsFor(ModType type);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user