Add ShortName to rulesets

This commit is contained in:
Dean Herbert 2017-12-08 18:55:25 +09:00
parent 5330ca1fa9
commit 679134c030
6 changed files with 22 additions and 7 deletions

View File

@ -93,6 +93,8 @@ public override IEnumerable<Mod> GetModsFor(ModType type)
public override string Description => "osu!catch";
public override string ShortName => "fruits";
public override Drawable CreateIcon() => new SpriteIcon { Icon = FontAwesome.fa_osu_fruits_o };
public override DifficultyCalculator CreateDifficultyCalculator(Beatmap beatmap, Mod[] mods = null) => new CatchDifficultyCalculator(beatmap);

View File

@ -105,6 +105,8 @@ public override IEnumerable<Mod> GetModsFor(ModType type)
public override string Description => "osu!mania";
public override string ShortName => "mania";
public override Drawable CreateIcon() => new SpriteIcon { Icon = FontAwesome.fa_osu_mania_o };
public override DifficultyCalculator CreateDifficultyCalculator(Beatmap beatmap, Mod[] mods = null) => new ManiaDifficultyCalculator(beatmap);

View File

@ -124,6 +124,8 @@ public override IEnumerable<Mod> GetModsFor(ModType type)
public override string Description => "osu!";
public override string ShortName => "osu";
public override SettingsSubsection CreateSettings() => new OsuSettings();
public override int LegacyID => 0;

View File

@ -95,6 +95,8 @@ public override IEnumerable<Mod> GetModsFor(ModType type)
public override string Description => "osu!taiko";
public override string ShortName => "taiko";
public override Drawable CreateIcon() => new SpriteIcon { Icon = FontAwesome.fa_osu_taiko_o };
public override DifficultyCalculator CreateDifficultyCalculator(Beatmap beatmap, Mod[] mods = null) => new TaikoDifficultyCalculator(beatmap);

View File

@ -63,6 +63,8 @@ public override RulesetContainer CreateRulesetContainerWith(WorkingBeatmap beatm
public override string Description => "dummy";
public override string ShortName => "dummy";
public DummyRuleset(RulesetInfo rulesetInfo)
: base(rulesetInfo)
{

View File

@ -23,13 +23,13 @@ public abstract class Ruleset
public virtual IEnumerable<BeatmapStatistic> GetBeatmapStatistics(WorkingBeatmap beatmap) => new BeatmapStatistic[] { };
public IEnumerable<Mod> GetAllMods() => Enum.GetValues(typeof(ModType)).Cast<ModType>()
// Get all mod types as an IEnumerable<ModType>
.SelectMany(GetModsFor)
// 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
// Get all mod types as an IEnumerable<ModType>
.SelectMany(GetModsFor)
// 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);
@ -66,6 +66,11 @@ protected Ruleset(RulesetInfo rulesetInfo)
/// </summary>
public virtual int LegacyID => -1;
/// <summary>
/// A unique short name to reference this ruleset in online requests.
/// </summary>
public abstract string ShortName { get; }
/// <summary>
/// A list of available variant ids.
/// </summary>